summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/auto/webchannel/tst_webchannel.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/tests/auto/webchannel/tst_webchannel.cpp b/tests/auto/webchannel/tst_webchannel.cpp
index 4309647..a44220f 100644
--- a/tests/auto/webchannel/tst_webchannel.cpp
+++ b/tests/auto/webchannel/tst_webchannel.cpp
@@ -770,11 +770,6 @@ void TestWebChannel::testInfiniteRecursion()
void TestWebChannel::testAsyncObject()
{
- auto waitForSignal = [] (QSignalSpy& spy) {
- for (int i=0; (i<5) && (spy.count() == 0); i++)
- spy.wait(1000);
- };
-
QWebChannel channel;
channel.connectTo(m_dummyTransport);
@@ -793,8 +788,7 @@ void TestWebChannel::testAsyncObject()
{
QSignalSpy spy(&obj, &TestObject::propChanged);
channel.d_func()->publisher->invokeMethod(&obj, method, args);
- waitForSignal(spy);
- QCOMPARE(spy.count(), 1);
+ QTRY_COMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).at(0).toString(), args.at(0).toString());
}
@@ -810,13 +804,10 @@ void TestWebChannel::testAsyncObject()
{
QSignalSpy spy(&obj, &TestObject::replay);
QMetaObject::invokeMethod(&obj, "fire");
- waitForSignal(spy);
- QCOMPARE(spy.count(), 1);
+ QTRY_COMPARE(spy.count(), 1);
channel.deregisterObject(&obj);
QMetaObject::invokeMethod(&obj, "fire");
- spy.takeFirst();
- waitForSignal(spy);
- QCOMPARE(spy.count(), 1);
+ QTRY_COMPARE(spy.count(), 2);
}
thread.quit();