mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 03:53:34 +02:00
WIP.
This commit is contained in:
parent
5bb4023fb5
commit
07267f9fe6
4 changed files with 84 additions and 2 deletions
tools/auto-tester/src
32
tools/auto-tester/src/Downloader.cpp
Normal file
32
tools/auto-tester/src/Downloader.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// Downloader.cpp
|
||||
//
|
||||
// Created by Nissim Hadar on 1 Mar 2018.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "Downloader.h"
|
||||
|
||||
Downloader::Downloader(QUrl imageUrl, QObject *parent) : QObject(parent) {
|
||||
connect(
|
||||
&_networkAccessManager, SIGNAL (finished(QNetworkReply*)),
|
||||
this, SLOT (fileDownloaded(QNetworkReply*))
|
||||
);
|
||||
|
||||
QNetworkRequest request(imageUrl);
|
||||
_networkAccessManager.get(request);
|
||||
}
|
||||
|
||||
void Downloader::fileDownloaded(QNetworkReply* reply) {
|
||||
_downloadedData = reply->readAll();
|
||||
|
||||
//emit a signal
|
||||
reply->deleteLater();
|
||||
emit downloaded();
|
||||
}
|
||||
|
||||
QByteArray Downloader::downloadedData() const {
|
||||
return _downloadedData;
|
||||
}
|
48
tools/auto-tester/src/Downloader.h
Normal file
48
tools/auto-tester/src/Downloader.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
//
|
||||
// Downloader.h
|
||||
//
|
||||
// Created by Nissim Hadar on 1 Mar 2018.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_downloader_h
|
||||
#define hifi_downloader_h
|
||||
|
||||
#include <QObject>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QUrl>
|
||||
#include <QDateTime>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDebug>
|
||||
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
|
||||
class Downloader : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Downloader(QUrl imageUrl, QObject *parent = 0);
|
||||
|
||||
QByteArray downloadedData() const;
|
||||
|
||||
signals:
|
||||
void downloaded();
|
||||
|
||||
private slots:
|
||||
void fileDownloaded(QNetworkReply* pReply);
|
||||
|
||||
private:
|
||||
QNetworkAccessManager _networkAccessManager;
|
||||
QByteArray _downloadedData;
|
||||
};
|
||||
|
||||
#endif // hifi_downloader_h
|
|
@ -214,7 +214,9 @@ void Test::evaluateTests(bool interactiveMode, QProgressBar* progressBar) {
|
|||
}
|
||||
}
|
||||
|
||||
autoTester->downloadImage(QUrl("http://ribafreixo.com/wp-content/uploads/2017/03/Order-Now-Button-300x113.png"));
|
||||
////autoTester->downloadImage(QUrl("http://ribafreixo.com/wp-content/uploads/2017/03/Order-Now-Button-300x113.png"));
|
||||
////autoTester->downloadImage(QUrl("https://github.com/NissimHadar/hifi_tests/blob/addRecursionToAutotester/tests/content/entity/zone/ambientLightInheritance/ExpectedImage_00000.jpg?raw=true"));
|
||||
autoTester->downloadImage(QUrl("https://hifi-content.s3.amazonaws.com/nissim/autoTester/resources/ColourBox.jpg"));
|
||||
////bool success = compareImageLists(expectedImages, resultImages, pathToImageDirectory, interactiveMode, progressBar);
|
||||
|
||||
////if (success) {
|
||||
|
|
|
@ -60,5 +60,5 @@ void AutoTester::saveImage() {
|
|||
image.loadFromData(downloader->downloadedData());
|
||||
int er = image.width();
|
||||
int df = image.height();
|
||||
image.save("D:/Dicom/lll.png");
|
||||
image.save("D:/Dicom/lll.jpg");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue