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:
parent
231ac1b878
commit
c7dac6469c
@ -988,9 +988,7 @@ void tst_QThread::exitAndStart()
|
|||||||
connect(&sync2, SIGNAL(propChanged(int)), &sync1, SLOT(setProp(int)), Qt::QueuedConnection);
|
connect(&sync2, SIGNAL(propChanged(int)), &sync1, SLOT(setProp(int)), Qt::QueuedConnection);
|
||||||
connect(&sync1, SIGNAL(propChanged(int)), &thread, SLOT(quit()), Qt::QueuedConnection);
|
connect(&sync1, SIGNAL(propChanged(int)), &thread, SLOT(quit()), Qt::QueuedConnection);
|
||||||
QMetaObject::invokeMethod(&sync2, "setProp", Qt::QueuedConnection , Q_ARG(int, 89));
|
QMetaObject::invokeMethod(&sync2, "setProp", Qt::QueuedConnection , Q_ARG(int, 89));
|
||||||
QTest::qWait(50);
|
QTRY_VERIFY(thread.wait(10));
|
||||||
while(!thread.wait(10))
|
|
||||||
QTest::qWait(10);
|
|
||||||
QCOMPARE(sync2.m_prop, 89);
|
QCOMPARE(sync2.m_prop, 89);
|
||||||
QCOMPARE(sync1.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(&sync2, SIGNAL(propChanged(int)), &sync1, SLOT(setProp(int)), Qt::QueuedConnection);
|
||||||
connect(&sync1, SIGNAL(propChanged(int)), &thread, SLOT(quit()), Qt::QueuedConnection);
|
connect(&sync1, SIGNAL(propChanged(int)), &thread, SLOT(quit()), Qt::QueuedConnection);
|
||||||
QMetaObject::invokeMethod(&sync2, "setProp", Qt::QueuedConnection , Q_ARG(int, 89));
|
QMetaObject::invokeMethod(&sync2, "setProp", Qt::QueuedConnection , Q_ARG(int, 89));
|
||||||
QTest::qWait(50);
|
QTRY_VERIFY(thread.wait(10));
|
||||||
while(!thread.wait(10))
|
|
||||||
QTest::qWait(10);
|
|
||||||
QCOMPARE(sync2.m_prop, 89);
|
QCOMPARE(sync2.m_prop, 89);
|
||||||
QCOMPARE(sync1.m_prop, 89);
|
QCOMPARE(sync1.m_prop, 89);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user