summaryrefslogtreecommitdiffstats
path: root/tests/auto/qeventloop
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-06-01 11:36:45 +0100
committermread <qt-info@nokia.com>2011-06-01 13:04:53 +0100
commitcf573d54c588e1ee10a7d8979faef2e0ab8bb17e (patch)
tree4d369ac9acc9655f14b07e4bde8d62456b26e412 /tests/auto/qeventloop
parente31bcd340a24a8698ee4dc85dd2ccb2bd6ab10e7 (diff)
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
Diffstat (limited to 'tests/auto/qeventloop')
-rw-r--r--tests/auto/qeventloop/tst_qeventloop.cpp8
1 files changed, 5 insertions, 3 deletions
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);
}