Corrected download of images.

This commit is contained in:
NissimHadar 2018-05-01 15:27:29 -07:00
parent b722c80b3f
commit a3e4fa8429
3 changed files with 15 additions and 2 deletions

View file

@ -9,6 +9,8 @@
//
#include "Downloader.h"
#include <QMessageBox>
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

View file

@ -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;

View file

@ -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());