diff options
author | mread <qt-info@nokia.com> | 2011-06-01 10:36:45 (GMT) |
---|---|---|
committer | mread <qt-info@nokia.com> | 2011-06-01 12:04:53 (GMT) |
commit | cf573d54c588e1ee10a7d8979faef2e0ab8bb17e (patch) | |
tree | 4d369ac9acc9655f14b07e4bde8d62456b26e412 /tests | |
parent | e31bcd340a24a8698ee4dc85dd2ccb2bd6ab10e7 (diff) | |
download | Qt-cf573d54c588e1ee10a7d8979faef2e0ab8bb17e.zip Qt-cf573d54c588e1ee10a7d8979faef2e0ab8bb17e.tar.gz Qt-cf573d54c588e1ee10a7d8979faef2e0ab8bb17e.tar.bz2 |
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')
-rw-r--r-- | tests/auto/qeventloop/tst_qeventloop.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/qeventloop/tst_qeventloop.cpp index b31f8cd..9196a47 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); } |