File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 2121#endif
2222
2323#include < QAction>
24- #include < QEventLoop>
2524#include < QLineEdit>
2625#include < QScopedPointer>
26+ #include < QSignalSpy>
2727#include < QTest>
2828#include < QTextEdit>
2929#include < QtGlobal>
@@ -34,13 +34,14 @@ namespace {
3434// ! Call getblockchaininfo RPC and check first field of JSON output.
3535void TestRpcCommand (RPCConsole* console)
3636{
37- QEventLoop loop;
3837 QTextEdit* messagesWidget = console->findChild <QTextEdit*>(" messagesWidget" );
39- QObject::connect (messagesWidget, &QTextEdit::textChanged, &loop, &QEventLoop::quit);
4038 QLineEdit* lineEdit = console->findChild <QLineEdit*>(" lineEdit" );
39+ QSignalSpy mw_spy (messagesWidget, &QTextEdit::textChanged);
40+ QVERIFY (mw_spy.isValid ());
4141 QTest::keyClicks (lineEdit, " getblockchaininfo" );
4242 QTest::keyClick (lineEdit, Qt::Key_Return);
43- loop.exec ();
43+ QVERIFY (mw_spy.wait (1000 ));
44+ QCOMPARE (mw_spy.count (), 2 );
4445 QString output = messagesWidget->toPlainText ();
4546 UniValue value;
4647 value.read (output.right (output.size () - output.lastIndexOf (QChar::ObjectReplacementCharacter) - 1 ).toStdString ());
You can’t perform that action at this time.
0 commit comments