Skip to content

Commit

Permalink
to be removed: test tool - add a button to simulate a crash
Browse files Browse the repository at this point in the history
Signed-off-by: AlexandraTrifan <[email protected]>
  • Loading branch information
AlexandraTrifan committed Oct 13, 2023
1 parent cfe1d2a commit 129bb19
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/src/scopymainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ ScopyMainWindow::ScopyMainWindow(QWidget *parent)

// auto id = api->addDevice("m2k","ip:127.0.0.1");
// auto id = api->addDevice("iio","ip:10.48.65.163");
// auto id = api->addDevice("iio","ip:192.168.2.1");
// auto id = api->addDevice("test","");
// auto id = api->addDevice("test","ip:192.168.2.1");
auto id = api->addDevice("test","");

// api->connectDevice(id);
api->connectDevice(id);
// api->switchTool(id, "Oscilloscope");
#endif

Expand Down
20 changes: 20 additions & 0 deletions plugins/testplugin/src/testtool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,26 @@ TestTool::TestTool(QWidget *parent)
hv->setVisible(b);
hv->raise();
});

MenuControlButton *crash = new MenuControlButton(this);
crash->setName("Crash");
tool->addWidgetToBottomContainerHelper(crash, TTA_RIGHT);

connect(crash,&QAbstractButton::toggled,this,&TestTool::crashSlot);
}

void TestTool::crashed(bool crash)
{
if (crash) {
delete reinterpret_cast<QString*>(0xFEE1DEAD);
// ::raise(SIGILL);
}
}

void TestTool::crashSlot(bool toggled)
{
// QtConcurrent::run(std::bind(&TestTool::crashed, this, true));
crashed(true);
}

QWidget *TestTool::createMenu(QWidget *parent)
Expand Down
3 changes: 2 additions & 1 deletion plugins/testplugin/src/testtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ class SCOPY_TESTPLUGIN_EXPORT TestTool : public QWidget
public:
TestTool(QWidget *parent = nullptr);
void initData();
void crashed(bool crash);
public Q_SLOTS:
void acquireData();

void crashSlot(bool toggled);
private:
int testDataSize = 128;
double amplitude = 0.5;
Expand Down

0 comments on commit 129bb19

Please sign in to comment.