summaryrefslogtreecommitdiffstats
path: root/tests/auto/qeventloop
diff options
context:
space:
mode:
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);
}