summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-05-19 11:08:16 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-05-19 11:14:39 (GMT)
commit8413073fe3946ed37f6424f179898af63767f060 (patch)
tree1c01811fe2233dae2236f3ff7893442b4c28f35e /tests
parent41ba7d4a000181607004d450a8130be902a42274 (diff)
downloadQt-8413073fe3946ed37f6424f179898af63767f060.zip
Qt-8413073fe3946ed37f6424f179898af63767f060.tar.gz
Qt-8413073fe3946ed37f6424f179898af63767f060.tar.bz2
Don't "hope" that a connection gets picked up; do it right!
While downloadProgress and uploadProgress both work on local files. There still may be a delay before the connection is actually picked up. This usually is caught by the processEvents(), but could be missed. Therefore, do a wait if we don't have any pending connections and work in ALL cases. Reviewed-by: Markus Goetz
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index bb199b9..d651ce5 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -2637,7 +2637,8 @@ void tst_QNetworkReply::downloadProgress()
QVERIFY(spy.isValid());
QCoreApplication::instance()->processEvents();
- server.waitForNewConnection(0); // ignore result, since processEvents may have got it
+ if (!server.hasPendingConnections())
+ server.waitForNewConnection(1000);
QVERIFY(server.hasPendingConnections());
QCOMPARE(spy.count(), 0);
@@ -2691,7 +2692,8 @@ void tst_QNetworkReply::uploadProgress()
QVERIFY(finished.isValid());
QCoreApplication::instance()->processEvents();
- server.waitForNewConnection(0); // ignore result, since processEvents may have got it
+ if (!server.hasPendingConnections())
+ server.waitForNewConnection(1000);
QVERIFY(server.hasPendingConnections());
QTcpSocket *receiver = server.nextPendingConnection();