From c7dac6469c3bc804a70e1afcc0dc7865afc28e5a Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Mon, 26 Mar 2018 17:28:46 +0300 Subject: [PATCH] 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 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Sami Nurmenniemi --- tests/auto/corelib/thread/qthread/tst_qthread.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index 0405896ca7c..aee243d8807 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -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); }