From cf573d54c588e1ee10a7d8979faef2e0ab8bb17e Mon Sep 17 00:00:00 2001 From: mread Date: Wed, 1 Jun 2011 11:36:45 +0100 Subject: tst_qeventloop runs the event loop to ensure socket messages arrive Auto test tst_qeventloop assumed that socket messages would be received within a single call to processEvents(). But this is not necessarily the case, and in particular with the combination of Symbian round robin active scheduler and new socket engine. So tst_qeventloop now uses an event loop to complete the test rather than just a single call to processEvents(). Task-number: QTBUG-15019 Reviewed-by: brad --- tests/auto/qeventloop/tst_qeventloop.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests/auto/qeventloop') diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/qeventloop/tst_qeventloop.cpp index b31f8cd76c..9196a47f14 100644 --- a/tests/auto/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/qeventloop/tst_qeventloop.cpp @@ -602,10 +602,12 @@ public slots: QTcpSocket *serverSocket = server->nextPendingConnection(); serverSocket->write(data, size); serverSocket->flush(); - QTest::qSleep(200); //allow the TCP/IP stack time to loopback the data, so our socket is ready to read - QCoreApplication::processEvents(QEventLoop::ExcludeSocketNotifiers); + QEventLoop loop; + QTimer::singleShot(200, &loop, SLOT(quit())); //allow the TCP/IP stack time to loopback the data, so our socket is ready to read + loop.exec(QEventLoop::ExcludeSocketNotifiers); testResult = dataArrived; - QCoreApplication::processEvents(); //check the deferred event is processed + QTimer::singleShot(200, &loop, SLOT(quit())); + loop.exec(); //check the deferred event is processed serverSocket->close(); QThread::currentThread()->exit(0); } -- cgit v1.2.3