Skip to content

Commit cf23962

Browse files
committed
Merge e2b55cd into merged_master (Bitcoin PR bitcoin-core/gui#335)
2 parents ed64f56 + e2b55cd commit cf23962

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/qt/test/apptests.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
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.
3535
void 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());

0 commit comments

Comments
 (0)