mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 04:48:09 +02:00
Stores downloaded images in correct folder and with correct filenames.
This commit is contained in:
parent
d29adcd000
commit
4b836a2ca9
3 changed files with 24 additions and 15 deletions
|
@ -198,7 +198,8 @@ void Test::evaluateTests(bool interactiveMode, QProgressBar* progressBar) {
|
||||||
// Images that are in the wrong format are ignored.
|
// Images that are in the wrong format are ignored.
|
||||||
|
|
||||||
QStringList sortedTestResultsFilenames = createListOfAllJPEGimagesInDirectory(pathToTestResultsDirectory);
|
QStringList sortedTestResultsFilenames = createListOfAllJPEGimagesInDirectory(pathToTestResultsDirectory);
|
||||||
QStringList expectedImages;
|
QStringList expectedImagesURLs;
|
||||||
|
QStringList expectedImagesFilenames;
|
||||||
QStringList resultImages;
|
QStringList resultImages;
|
||||||
|
|
||||||
const QString URLPrefix("https://raw.githubusercontent.com");
|
const QString URLPrefix("https://raw.githubusercontent.com");
|
||||||
|
@ -217,14 +218,16 @@ void Test::evaluateTests(bool interactiveMode, QProgressBar* progressBar) {
|
||||||
QString expectedImageFilenameTail = currentFilename.left(currentFilename.length() - 4).right(NUM_DIGITS);
|
QString expectedImageFilenameTail = currentFilename.left(currentFilename.length() - 4).right(NUM_DIGITS);
|
||||||
QString expectedImageFilename = EXPECTED_IMAGE_PREFIX + expectedImageFilenameTail + EXPECTED_IMAGE_TYPE;
|
QString expectedImageFilename = EXPECTED_IMAGE_PREFIX + expectedImageFilenameTail + EXPECTED_IMAGE_TYPE;
|
||||||
|
|
||||||
|
expectedImagesFilenames << expectedImageFilename;
|
||||||
|
|
||||||
QString imageURLString(URLPrefix + "/" + githubUser + "/" + testsRepo + "/" + branch + "/" + expectedImagePartialSourceDirectory + "/" + expectedImageFilename);
|
QString imageURLString(URLPrefix + "/" + githubUser + "/" + testsRepo + "/" + branch + "/" + expectedImagePartialSourceDirectory + "/" + expectedImageFilename);
|
||||||
expectedImages << imageURLString;
|
expectedImagesURLs << imageURLString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//autoTester->downloadImage(QUrl("https://raw.githubusercontent.com/NissimHadar/hifi_tests/addRecursionToAutotester/tests/content/entity/zone/ambientLightInheritance/ExpectedImage_00000.jpg"));
|
autoTester->downloadImages(expectedImagesURLs, pathToTestResultsDirectory, expectedImagesFilenames);
|
||||||
|
|
||||||
autoTester->downloadImages(expectedImages);
|
// Wait for do
|
||||||
|
|
||||||
////if (success) {
|
////if (success) {
|
||||||
//// messageBox.information(0, "Success", "All images are as expected");
|
//// messageBox.information(0, "Success", "All images are as expected");
|
||||||
|
|
|
@ -51,7 +51,7 @@ void AutoTester::on_closeButton_clicked() {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::downloadImage(QUrl url) {
|
void AutoTester::downloadImage(const QUrl& url) {
|
||||||
downloaders.emplace_back(new Downloader(url, this));
|
downloaders.emplace_back(new Downloader(url, this));
|
||||||
connect(downloaders[_index], SIGNAL (downloaded()), signalMapper, SLOT (map()));
|
connect(downloaders[_index], SIGNAL (downloaded()), signalMapper, SLOT (map()));
|
||||||
|
|
||||||
|
@ -60,13 +60,16 @@ void AutoTester::downloadImage(QUrl url) {
|
||||||
++_index;
|
++_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::downloadImages(QStringList listOfURLs) {
|
void AutoTester::downloadImages(const QStringList& URLs, const QString& directoryName, const QStringList& filenames) {
|
||||||
_numberOfImagesToDownload = listOfURLs.size();
|
_directoryName = directoryName;
|
||||||
|
_filenames = filenames;
|
||||||
|
|
||||||
|
_numberOfImagesToDownload = URLs.size();
|
||||||
_numberOfImagesDownloaded = 0;
|
_numberOfImagesDownloaded = 0;
|
||||||
_index = 0;
|
_index = 0;
|
||||||
|
|
||||||
for (int i = 0; i < _numberOfImagesToDownload; ++i) {
|
for (int i = 0; i < _numberOfImagesToDownload; ++i) {
|
||||||
QUrl imageURL(listOfURLs[i]);
|
QUrl imageURL(URLs[i]);
|
||||||
downloadImage(imageURL);
|
downloadImage(imageURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,10 +80,8 @@ void AutoTester::saveImage(int index) {
|
||||||
QPixmap image;
|
QPixmap image;
|
||||||
image.loadFromData(downloaders[index]->downloadedData());
|
image.loadFromData(downloaders[index]->downloadedData());
|
||||||
|
|
||||||
int w = image.width();
|
|
||||||
int h = image.height();
|
image.save(_directoryName + "/" + _filenames[index]);
|
||||||
|
|
||||||
++_numberOfImagesDownloaded;
|
++_numberOfImagesDownloaded;
|
||||||
|
|
||||||
image.save("D:/Dicom/lll_" + QString::number(index) + ".jpg");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ class AutoTester : public QMainWindow {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AutoTester(QWidget *parent = Q_NULLPTR);
|
AutoTester(QWidget *parent = Q_NULLPTR);
|
||||||
void downloadImage(QUrl url);
|
void downloadImage(const QUrl& url);
|
||||||
void downloadImages(QStringList listOfURLs);
|
void downloadImages(const QStringList& URLs, const QString& directoryName, const QStringList& filenames);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_evaluateTestsButton_clicked();
|
void on_evaluateTestsButton_clicked();
|
||||||
|
@ -38,10 +38,15 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AutoTesterClass ui;
|
Ui::AutoTesterClass ui;
|
||||||
|
|
||||||
Test* test;
|
Test* test;
|
||||||
|
|
||||||
std::vector<Downloader*> downloaders;
|
std::vector<Downloader*> downloaders;
|
||||||
|
|
||||||
|
// local storage for parameters - folder to store downloaded files in, and a list of their names
|
||||||
|
QString _directoryName;
|
||||||
|
QStringList _filenames;
|
||||||
|
|
||||||
|
// Used to enable passing a parameter to slots
|
||||||
QSignalMapper* signalMapper;
|
QSignalMapper* signalMapper;
|
||||||
|
|
||||||
int _numberOfImagesToDownload;
|
int _numberOfImagesToDownload;
|
||||||
|
|
Loading…
Reference in a new issue