tst_QThread: Use QTRY_VERIFY instead of qWaits

These two places were sort of manually implementing QTRY_VERIFY except that they
never time out.

Change-Id: I136e6c7400194327c0475c6acfc019825ccec1b5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
This commit is contained in:
Kari Oikarinen 2018-03-26 17:28:46 +03:00
parent 231ac1b878
commit c7dac6469c

View File

@ -988,9 +988,7 @@ void tst_QThread::exitAndStart()
connect(&sync2, SIGNAL(propChanged(int)), &sync1, SLOT(setProp(int)), Qt::QueuedConnection);
connect(&sync1, SIGNAL(propChanged(int)), &thread, SLOT(quit()), Qt::QueuedConnection);
QMetaObject::invokeMethod(&sync2, "setProp", Qt::QueuedConnection , Q_ARG(int, 89));
QTest::qWait(50);
while(!thread.wait(10))
QTest::qWait(10);
QTRY_VERIFY(thread.wait(10));
QCOMPARE(sync2.m_prop, 89);
QCOMPARE(sync1.m_prop, 89);
}
@ -1026,9 +1024,7 @@ void tst_QThread::exitAndExec()
connect(&sync2, SIGNAL(propChanged(int)), &sync1, SLOT(setProp(int)), Qt::QueuedConnection);
connect(&sync1, SIGNAL(propChanged(int)), &thread, SLOT(quit()), Qt::QueuedConnection);
QMetaObject::invokeMethod(&sync2, "setProp", Qt::QueuedConnection , Q_ARG(int, 89));
QTest::qWait(50);
while(!thread.wait(10))
QTest::qWait(10);
QTRY_VERIFY(thread.wait(10));
QCOMPARE(sync2.m_prop, 89);
QCOMPARE(sync1.m_prop, 89);
}