diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2009-07-14 11:05:11 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2009-07-14 11:33:49 (GMT) |
commit | ec11bd70c78cbdb07b399b058fabdb16d66072b0 (patch) | |
tree | a29b7061a0624df7539750dc2e9183c5068912f1 /tests/auto | |
parent | a2bad25383e565233a0c2527e04cef9f6b577f14 (diff) | |
download | Qt-ec11bd70c78cbdb07b399b058fabdb16d66072b0.zip Qt-ec11bd70c78cbdb07b399b058fabdb16d66072b0.tar.gz Qt-ec11bd70c78cbdb07b399b058fabdb16d66072b0.tar.bz2 |
QNetworkReply: Add isFinished() method
The isFinished() method will return true if the reply has successfully
finished or has been aborted.
Task-number: 257349
Reviewed-by: Thiago Macieira
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index cb1cb9b..f2bfb1f 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -1003,6 +1003,7 @@ void tst_QNetworkReply::stateChecking() QCOMPARE(reply->request(), req); QCOMPARE(int(reply->operation()), int(QNetworkAccessManager::GetOperation)); QCOMPARE(reply->error(), QNetworkReply::NoError); + QCOMPARE(reply->isFinished(), false); QCOMPARE(reply->url(), url); reply->abort(); @@ -1324,6 +1325,9 @@ void tst_QNetworkReply::getErrors() QTEST(reply->readAll().isEmpty(), "dataIsEmpty"); + QVERIFY(reply->isFinished()); + QVERIFY(!reply->isRunning()); + QFETCH(int, httpStatusCode); if (httpStatusCode != 0) { QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), httpStatusCode); @@ -3237,6 +3241,8 @@ void tst_QNetworkReply::downloadProgress() connect(reply, SIGNAL(downloadProgress(qint64,qint64)), &QTestEventLoop::instance(), SLOT(exitLoop())); QVERIFY(spy.isValid()); + QVERIFY(!reply->isFinished()); + QVERIFY(reply->isRunning()); QCoreApplication::instance()->processEvents(); if (!server.hasPendingConnections()) @@ -3257,6 +3263,8 @@ void tst_QNetworkReply::downloadProgress() QTestEventLoop::instance().enterLoop(2); QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(spy.count() > 0); + QVERIFY(!reply->isFinished()); + QVERIFY(reply->isRunning()); QList<QVariant> args = spy.last(); QCOMPARE(args.at(0).toInt(), i*data.size()); @@ -3270,6 +3278,8 @@ void tst_QNetworkReply::downloadProgress() QTestEventLoop::instance().enterLoop(2); QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(spy.count() > 0); + QVERIFY(!reply->isRunning()); + QVERIFY(reply->isFinished()); QList<QVariant> args = spy.last(); QCOMPARE(args.at(0).toInt(), loopCount * data.size()); |