summaryrefslogtreecommitdiff
path: root/tests/auto/files/tst_files.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/files/tst_files.cpp')
-rw-r--r--tests/auto/files/tst_files.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/tests/auto/files/tst_files.cpp b/tests/auto/files/tst_files.cpp
index 8ac1924..cf26117 100644
--- a/tests/auto/files/tst_files.cpp
+++ b/tests/auto/files/tst_files.cpp
@@ -258,9 +258,15 @@ void tst_Files::fileUploadDownload()
QNetworkRequest req;
req.setUrl(QUrl(downloadData["expiringUrl"].toString()));
QNetworkReply *reply = client.networkManager()->get(req);
- QVERIFY(reply);
- QSignalSpy downloadSpy(reply, SIGNAL(finished()));
- QTRY_COMPARE(downloadSpy.count(), 1);
+ QTRY_VERIFY(reply->isFinished());
+ if (reply->error() != QNetworkReply::NoError) {
+ // the test has failed already, let's printout some debugging information
+ qDebug() << "downloadData:" << downloadData;
+ qDebug() << "reply->readAll():" << reply->readAll();
+ qDebug() << "reply->error() and errorString():" << reply->error() << reply->errorString();
+ qDebug() << "reply http code:" << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).value<int>();
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ }
QByteArray imageData = reply->readAll();
reply->deleteLater();
QImage img = QImage::fromData(imageData);
@@ -325,9 +331,15 @@ void tst_Files::fileUploadDownload()
QNetworkRequest req;
req.setUrl(QUrl(downloadData["expiringUrl"].toString()));
QNetworkReply *reply = client.networkManager()->get(req);
- QVERIFY(reply);
- QSignalSpy downloadSpy(reply, SIGNAL(finished()));
- QTRY_COMPARE(downloadSpy.count(), 1);
+ QTRY_VERIFY(reply->isFinished());
+ if (reply->error() != QNetworkReply::NoError) {
+ // the test has failed already, let's printout some debugging information
+ qDebug() << "downloadData:" << downloadData;
+ qDebug() << "reply->readAll():" << reply->readAll();
+ qDebug() << "reply->error() and errorString():" << reply->error() << reply->errorString();
+ qDebug() << "reply http code:" << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).value<int>();
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ }
QByteArray imageData = reply->readAll();
reply->deleteLater();
QImage img = QImage::fromData(imageData);