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 20
20
#endif
21
21
22
22
#include < QAction>
23
- #include < QEventLoop>
24
23
#include < QLineEdit>
25
24
#include < QScopedPointer>
25
+ #include < QSignalSpy>
26
26
#include < QTest>
27
27
#include < QTextEdit>
28
28
#include < QtGlobal>
@@ -33,13 +33,14 @@ namespace {
33
33
// ! Call getblockchaininfo RPC and check first field of JSON output.
34
34
void TestRpcCommand (RPCConsole* console)
35
35
{
36
- QEventLoop loop;
37
36
QTextEdit* messagesWidget = console->findChild <QTextEdit*>(" messagesWidget" );
38
- QObject::connect (messagesWidget, &QTextEdit::textChanged, &loop, &QEventLoop::quit);
39
37
QLineEdit* lineEdit = console->findChild <QLineEdit*>(" lineEdit" );
38
+ QSignalSpy mw_spy (messagesWidget, &QTextEdit::textChanged);
39
+ QVERIFY (mw_spy.isValid ());
40
40
QTest::keyClicks (lineEdit, " getblockchaininfo" );
41
41
QTest::keyClick (lineEdit, Qt::Key_Return);
42
- loop.exec ();
42
+ QVERIFY (mw_spy.wait (1000 ));
43
+ QCOMPARE (mw_spy.count (), 2 );
43
44
QString output = messagesWidget->toPlainText ();
44
45
UniValue value;
45
46
value.read (output.right (output.size () - output.lastIndexOf (QChar::ObjectReplacementCharacter) - 1 ).toStdString ());
You can’t perform that action at this time.
0 commit comments