diff options
author | Jarol Rodriguez <jarolrod@tutanota.com> | 2021-05-16 16:27:04 -0400 |
---|---|---|
committer | Jarol Rodriguez <jarolrod@tutanota.com> | 2021-05-17 15:51:24 -0400 |
commit | 7eea659fc908e5edfc90c185a6958ed07ecf5cd4 (patch) | |
tree | d14318e1e94788f9372fbfd9cf281c97ab188e0a /src/qt/test | |
parent | ecf5f2c1a06edd8372402872525f8de1d4277453 (diff) | |
download | bitcoin-7eea659fc908e5edfc90c185a6958ed07ecf5cd4.tar.xz |
qt, test: use qsignalspy instead of qeventloop
Diffstat (limited to 'src/qt/test')
-rw-r--r-- | src/qt/test/apptests.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp index 8dffd2f59f..36b9024541 100644 --- a/src/qt/test/apptests.cpp +++ b/src/qt/test/apptests.cpp @@ -20,9 +20,9 @@ #endif #include <QAction> -#include <QEventLoop> #include <QLineEdit> #include <QScopedPointer> +#include <QSignalSpy> #include <QTest> #include <QTextEdit> #include <QtGlobal> @@ -33,13 +33,14 @@ namespace { //! Call getblockchaininfo RPC and check first field of JSON output. void TestRpcCommand(RPCConsole* console) { - QEventLoop loop; QTextEdit* messagesWidget = console->findChild<QTextEdit*>("messagesWidget"); - QObject::connect(messagesWidget, &QTextEdit::textChanged, &loop, &QEventLoop::quit); QLineEdit* lineEdit = console->findChild<QLineEdit*>("lineEdit"); + QSignalSpy mw_spy(messagesWidget, &QTextEdit::textChanged); + QVERIFY(mw_spy.isValid()); QTest::keyClicks(lineEdit, "getblockchaininfo"); QTest::keyClick(lineEdit, Qt::Key_Return); - loop.exec(); + QVERIFY(mw_spy.wait(1000)); + QCOMPARE(mw_spy.count(), 2); QString output = messagesWidget->toPlainText(); UniValue value; value.read(output.right(output.size() - output.lastIndexOf(QChar::ObjectReplacementCharacter) - 1).toStdString()); |