From a3e4fa84292ab1607ed6cca3a10003ed75825595 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 1 May 2018 15:27:29 -0700 Subject: [PATCH] Corrected download of images. --- tools/auto-tester/src/Downloader.cpp | 9 +++++++++ tools/auto-tester/src/Test.cpp | 7 +++++-- tools/auto-tester/src/ui/AutoTester.cpp | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/auto-tester/src/Downloader.cpp b/tools/auto-tester/src/Downloader.cpp index 030aa95a19..e66b498bd5 100644 --- a/tools/auto-tester/src/Downloader.cpp +++ b/tools/auto-tester/src/Downloader.cpp @@ -9,6 +9,8 @@ // #include "Downloader.h" +#include + Downloader::Downloader(QUrl imageUrl, QObject *parent) : QObject(parent) { connect( &_networkAccessManager, SIGNAL (finished(QNetworkReply*)), @@ -20,6 +22,13 @@ Downloader::Downloader(QUrl imageUrl, QObject *parent) : QObject(parent) { } void Downloader::fileDownloaded(QNetworkReply* reply) { + QNetworkReply::NetworkError error = reply->error(); + if (error != QNetworkReply::NetworkError::NoError) { + QMessageBox messageBox; + messageBox.information(0, "Test Aborted", "Failed to download image: " + reply->errorString()); + return; + } + _downloadedData = reply->readAll(); //emit a signal diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index 57806e80f6..d0a1606cd8 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -221,8 +221,11 @@ void Test::startTestsEvaluation() { QString expectedImageFilenameTail = currentFilename.left(currentFilename.length() - 4).right(NUM_DIGITS); QString expectedImageStoredFilename = EXPECTED_IMAGE_PREFIX + expectedImageFilenameTail + ".png"; - QString imageURLString("https://github.com/" + githubUser + "/hifi_tests/blob/" + gitHubBranch + "/" + - expectedImagePartialSourceDirectory + "/" + expectedImageStoredFilename + "?raw=true"); + //https://raw.githubusercontent.com/highfidelity/hifi_tests/master/tests/content/entity/zone/zoneOrientation/ExpectedImage_00001.png + + + QString imageURLString("https://raw.githubusercontent.com/" + githubUser + "/hifi_tests/" + gitHubBranch + "/" + + expectedImagePartialSourceDirectory + "/" + expectedImageStoredFilename); expectedImagesURLs << imageURLString; diff --git a/tools/auto-tester/src/ui/AutoTester.cpp b/tools/auto-tester/src/ui/AutoTester.cpp index 860868565a..17b1513467 100644 --- a/tools/auto-tester/src/ui/AutoTester.cpp +++ b/tools/auto-tester/src/ui/AutoTester.cpp @@ -86,6 +86,7 @@ void AutoTester::downloadImages(const QStringList& URLs, const QString& director } void AutoTester::saveImage(int index) { + QByteArray q = downloaders[index]->downloadedData(); QPixmap pixmap; pixmap.loadFromData(downloaders[index]->downloadedData());