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 2020#endif
2121
2222#include < QAction>
23- #include < QEventLoop>
2423#include < QLineEdit>
2524#include < QScopedPointer>
25+ #include < QSignalSpy>
2626#include < QTest>
2727#include < QTextEdit>
2828#include < QtGlobal>
@@ -33,13 +33,14 @@ namespace {
3333// ! Call getblockchaininfo RPC and check first field of JSON output.
3434void TestRpcCommand (RPCConsole* console)
3535{
36- QEventLoop loop;
3736 QTextEdit* messagesWidget = console->findChild <QTextEdit*>(" messagesWidget" );
38- QObject::connect (messagesWidget, &QTextEdit::textChanged, &loop, &QEventLoop::quit);
3937 QLineEdit* lineEdit = console->findChild <QLineEdit*>(" lineEdit" );
38+ QSignalSpy mw_spy (messagesWidget, &QTextEdit::textChanged);
39+ QVERIFY (mw_spy.isValid ());
4040 QTest::keyClicks (lineEdit, " getblockchaininfo" );
4141 QTest::keyClick (lineEdit, Qt::Key_Return);
42- loop.exec ();
42+ QVERIFY (mw_spy.wait (1000 ));
43+ QCOMPARE (mw_spy.count (), 2 );
4344 QString output = messagesWidget->toPlainText ();
4445 UniValue value;
4546 value.read (output.right (output.size () - output.lastIndexOf (QChar::ObjectReplacementCharacter) - 1 ).toStdString ());
You can’t perform that action at this time.
0 commit comments