summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkreply
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2010-01-18 14:57:21 +0100
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-01-18 16:48:03 +0100
commitb5d3b999fa9c52246c8d4e4c1389df105d96cced (patch)
tree35edc2742f9a170237c7f266fdc89648264c1853 /tests/auto/qnetworkreply
parentc4a842563d40e8b4c3693a8acb77c9aff6f06e29 (diff)
Enhance QFileNetworkReply
It is now considered as finished immediatly after creation to avoid an event loop spin. Had to change the auto tests a bit to account for the new behaviour. Reviewed-by: Peter Hartmann
Diffstat (limited to 'tests/auto/qnetworkreply')
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 33753f10f5..3bf06d7a5f 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -838,13 +838,20 @@ void tst_QNetworkReply::stateChecking()
QVERIFY(reply->isOpen());
QVERIFY(reply->isReadable());
QVERIFY(!reply->isWritable());
- QCOMPARE(reply->errorString(), QString("Unknown error"));
+
+ // both behaviours are OK since we might change underlying behaviour again
+ if (!reply->isFinished())
+ QCOMPARE(reply->errorString(), QString("Unknown error"));
+ else
+ QVERIFY(!reply->errorString().isEmpty());
+
QCOMPARE(reply->manager(), &manager);
QCOMPARE(reply->request(), req);
QCOMPARE(int(reply->operation()), int(QNetworkAccessManager::GetOperation));
- QCOMPARE(reply->error(), QNetworkReply::NoError);
- QCOMPARE(reply->isFinished(), false);
+ // error and not error are OK since we might change underlying behaviour again
+ if (!reply->isFinished())
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
QCOMPARE(reply->url(), url);
reply->abort();
@@ -1151,7 +1158,8 @@ void tst_QNetworkReply::getErrors()
QNetworkReplyPtr reply = manager.get(request);
reply->setParent(this); // we have expect-fails
- QCOMPARE(reply->error(), QNetworkReply::NoError);
+ if (!reply->isFinished())
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
// now run the request:
connect(reply, SIGNAL(finished()),
@@ -1512,6 +1520,7 @@ void tst_QNetworkReply::ioGetFromFile()
QNetworkRequest request(QUrl::fromLocalFile(file.fileName()));
QNetworkReplyPtr reply = manager.get(request);
+ QVERIFY(reply->isFinished()); // a file should immediatly be done
DataReader reader(reply);
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
@@ -3170,7 +3179,9 @@ void tst_QNetworkReply::ioPostToHttpEmptyUploadProgress()
void tst_QNetworkReply::lastModifiedHeaderForFile()
{
- QFileInfo fileInfo(SRCDIR "./bigfile");
+ QFileInfo fileInfo(SRCDIR "/bigfile");
+ QVERIFY(fileInfo.exists());
+
QUrl url = QUrl::fromLocalFile(fileInfo.filePath());
QNetworkRequest request(url);