mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
Can download the High Fidelity installer.
This commit is contained in:
parent
fb80e9c395
commit
1ffd005b77
9 changed files with 97 additions and 67 deletions
|
@ -11,20 +11,20 @@
|
|||
|
||||
#include <QtWidgets/QMessageBox>
|
||||
|
||||
Downloader::Downloader(QUrl imageUrl, QObject *parent) : QObject(parent) {
|
||||
Downloader::Downloader(QUrl fileURL, QObject *parent) : QObject(parent) {
|
||||
connect(
|
||||
&_networkAccessManager, SIGNAL (finished(QNetworkReply*)),
|
||||
this, SLOT (fileDownloaded(QNetworkReply*))
|
||||
);
|
||||
|
||||
QNetworkRequest request(imageUrl);
|
||||
QNetworkRequest request(fileURL);
|
||||
_networkAccessManager.get(request);
|
||||
}
|
||||
|
||||
void Downloader::fileDownloaded(QNetworkReply* reply) {
|
||||
QNetworkReply::NetworkError error = reply->error();
|
||||
if (error != QNetworkReply::NetworkError::NoError) {
|
||||
QMessageBox::information(0, "Test Aborted", "Failed to download image: " + reply->errorString());
|
||||
QMessageBox::information(0, "Test Aborted", "Failed to download file: " + reply->errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
class Downloader : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Downloader(QUrl imageUrl, QObject *parent = 0);
|
||||
explicit Downloader(QUrl fileURL, QObject *parent = 0);
|
||||
|
||||
QByteArray downloadedData() const;
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ void Test::startTestsEvaluation(const QString& testFolder, const QString& branch
|
|||
}
|
||||
}
|
||||
|
||||
autoTester->downloadImages(expectedImagesURLs, _snapshotDirectory, _expectedImagesFilenames);
|
||||
autoTester->downloadFiles(expectedImagesURLs, _snapshotDirectory, _expectedImagesFilenames);
|
||||
}
|
||||
|
||||
void Test::finishTestsEvaluation(bool isRunningFromCommandline, bool interactiveMode, QProgressBar* progressBar) {
|
||||
|
@ -314,7 +314,7 @@ void Test::createTests() {
|
|||
_snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test images", parent,
|
||||
QFileDialog::ShowDirsOnly);
|
||||
|
||||
// If user cancelled then restore previous selection and return
|
||||
// If user canceled then restore previous selection and return
|
||||
if (_snapshotDirectory == "") {
|
||||
_snapshotDirectory = previousSelection;
|
||||
return;
|
||||
|
@ -329,7 +329,7 @@ void Test::createTests() {
|
|||
_testsRootDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select test root folder", parent,
|
||||
QFileDialog::ShowDirsOnly);
|
||||
|
||||
// If user cancelled then restore previous selection and return
|
||||
// If user canceled then restore previous selection and return
|
||||
if (_testsRootDirectory == "") {
|
||||
_testsRootDirectory = previousSelection;
|
||||
return;
|
||||
|
@ -456,7 +456,7 @@ bool Test::createFileSetup() {
|
|||
_testDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test", parent,
|
||||
QFileDialog::ShowDirsOnly);
|
||||
|
||||
// If user cancelled then restore previous selection and return
|
||||
// If user canceled then restore previous selection and return
|
||||
if (_testDirectory == "") {
|
||||
_testDirectory = previousSelection;
|
||||
return false;
|
||||
|
@ -798,7 +798,7 @@ void Test::createTestsOutline() {
|
|||
_testDirectory =
|
||||
QFileDialog::getExistingDirectory(nullptr, "Please select the tests root folder", parent, QFileDialog::ShowDirsOnly);
|
||||
|
||||
// If user cancelled then restore previous selection and return
|
||||
// If user canceled then restore previous selection and return
|
||||
if (_testDirectory == "") {
|
||||
_testDirectory = previousSelection;
|
||||
return;
|
||||
|
@ -920,10 +920,6 @@ void Test::createTestRailRun() {
|
|||
_testRailInterface.createTestRailRun(outputDirectory);
|
||||
}
|
||||
|
||||
void Test::runNow() {
|
||||
testRunner.run();
|
||||
}
|
||||
|
||||
void Test::updateTestRailRunResult() {
|
||||
QString testResults = QFileDialog::getOpenFileName(nullptr, "Please select the zipped test results to update from", nullptr,
|
||||
"Zipped Test Results (*.zip)");
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "ImageComparer.h"
|
||||
#include "ui/MismatchWindow.h"
|
||||
#include "TestRailInterface.h"
|
||||
#include "TestRunner.h"
|
||||
|
||||
class Step {
|
||||
public:
|
||||
|
@ -65,8 +64,6 @@ public:
|
|||
void createTestRailTestCases();
|
||||
void createTestRailRun();
|
||||
|
||||
void runNow();
|
||||
|
||||
void updateTestRailRunResult();
|
||||
|
||||
void createRecursiveScript();
|
||||
|
@ -108,8 +105,6 @@ private:
|
|||
|
||||
ImageComparer _imageComparer;
|
||||
|
||||
TestRunner testRunner;
|
||||
|
||||
QString _testResultsFolderPath;
|
||||
int _index { 1 };
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Downloader.cpp
|
||||
// TestRunner.cpp
|
||||
//
|
||||
// Created by Nissim Hadar on 1 Sep 2018.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
|
@ -10,14 +10,26 @@
|
|||
#include "TestRunner.h"
|
||||
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
|
||||
#include "ui/AutoTester.h"
|
||||
extern AutoTester* autoTester;
|
||||
|
||||
TestRunner::TestRunner(QObject *parent) : QObject(parent) {
|
||||
}
|
||||
|
||||
void TestRunner::run() {
|
||||
saveExistingHighFidelityAppDataFolder();
|
||||
selectTemporaryFolder();
|
||||
|
||||
QStringList urls;
|
||||
urls << "http://builds.highfidelity.com/HighFidelity-Beta-latest-dev.exe";
|
||||
|
||||
QStringList filenames;
|
||||
filenames << "HighFidelity-Beta-latest-dev.exe";
|
||||
|
||||
autoTester->downloadFiles(urls, _tempDirectory, filenames);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
restoreHighFidelityAppDataFolder();
|
||||
}
|
||||
|
@ -48,4 +60,21 @@ void TestRunner::restoreHighFidelityAppDataFolder() {
|
|||
QDir().rmdir(appDataFolder.path());
|
||||
|
||||
appDataFolder.rename(QDir::fromNativeSeparators(savedAppDataFolder.path()), QDir::toNativeSeparators(appDataFolder.path()));
|
||||
}
|
||||
|
||||
void TestRunner::selectTemporaryFolder() {
|
||||
QString previousSelection = _tempDirectory;
|
||||
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
||||
if (!parent.isNull() && parent.right(1) != "/") {
|
||||
parent += "/";
|
||||
}
|
||||
|
||||
_tempDirectory =
|
||||
QFileDialog::getExistingDirectory(nullptr, "Please select a temporary folder for installation", parent, QFileDialog::ShowDirsOnly);
|
||||
|
||||
// If user canceled then restore previous selection and return
|
||||
if (_tempDirectory == "") {
|
||||
_tempDirectory = previousSelection;
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -12,7 +12,9 @@
|
|||
#define hifi_testRunner_h
|
||||
|
||||
#include <QObject>
|
||||
#include <QDirIterator>
|
||||
#include <QDir>
|
||||
|
||||
#include "Downloader.h"
|
||||
|
||||
class TestRunner : public QObject {
|
||||
Q_OBJECT
|
||||
|
@ -23,10 +25,15 @@ public:
|
|||
|
||||
void saveExistingHighFidelityAppDataFolder();
|
||||
void restoreHighFidelityAppDataFolder();
|
||||
void selectTemporaryFolder();
|
||||
|
||||
private:
|
||||
QDir appDataFolder;
|
||||
QDir savedAppDataFolder;
|
||||
|
||||
QString _tempDirectory;
|
||||
|
||||
Downloader* _downloader;
|
||||
};
|
||||
|
||||
#endif // hifi_testRunner_h
|
|
@ -32,7 +32,7 @@ AutoTester::AutoTester(QWidget* parent) : QMainWindow(parent) {
|
|||
_ui.tabWidget->setTabEnabled(3, false);
|
||||
#endif
|
||||
|
||||
// helpWindow.textBrowser->setText()
|
||||
// _helpWindow.textBrowser->setText()
|
||||
}
|
||||
|
||||
void AutoTester::setup() {
|
||||
|
@ -99,7 +99,7 @@ void AutoTester::on_createTestRailRunButton_clicked() {
|
|||
}
|
||||
|
||||
void AutoTester::on_runNowButton_clicked() {
|
||||
_test->runNow();
|
||||
_testRunner.run();
|
||||
}
|
||||
|
||||
void AutoTester::on_updateTestRailRunResultsButton_clicked() {
|
||||
|
@ -142,7 +142,7 @@ void AutoTester::on_createXMLScriptRadioButton_clicked() {
|
|||
_test->setTestRailCreateMode(XML);
|
||||
}
|
||||
|
||||
void AutoTester::downloadImage(const QUrl& url) {
|
||||
void AutoTester::downloadFile(const QUrl& url) {
|
||||
_downloaders.emplace_back(new Downloader(url, this));
|
||||
connect(_downloaders[_index], SIGNAL(downloaded()), _signalMapper, SLOT(map()));
|
||||
|
||||
|
@ -151,47 +151,46 @@ void AutoTester::downloadImage(const QUrl& url) {
|
|||
++_index;
|
||||
}
|
||||
|
||||
void AutoTester::downloadImages(const QStringList& URLs, const QString& directoryName, const QStringList& filenames) {
|
||||
void AutoTester::downloadFiles(const QStringList& URLs, const QString& directoryName, const QStringList& filenames) {
|
||||
_directoryName = directoryName;
|
||||
_filenames = filenames;
|
||||
|
||||
_numberOfImagesToDownload = URLs.size();
|
||||
_numberOfImagesDownloaded = 0;
|
||||
_numberOfFilesToDownload = URLs.size();
|
||||
_numberOfFilesDownloaded = 0;
|
||||
_index = 0;
|
||||
|
||||
_ui.progressBar->setMinimum(0);
|
||||
_ui.progressBar->setMaximum(_numberOfImagesToDownload - 1);
|
||||
_ui.progressBar->setMaximum(_numberOfFilesToDownload - 1);
|
||||
_ui.progressBar->setValue(0);
|
||||
_ui.progressBar->setVisible(true);
|
||||
|
||||
_downloaders.clear();
|
||||
for (int i = 0; i < _numberOfImagesToDownload; ++i) {
|
||||
QUrl imageURL(URLs[i]);
|
||||
downloadImage(imageURL);
|
||||
for (int i = 0; i < _numberOfFilesToDownload; ++i) {
|
||||
downloadFile(URLs[i]);
|
||||
}
|
||||
|
||||
connect(_signalMapper, SIGNAL(mapped(int)), this, SLOT(saveImage(int)));
|
||||
connect(_signalMapper, SIGNAL(mapped(int)), this, SLOT(saveFile(int)));
|
||||
}
|
||||
|
||||
void AutoTester::saveImage(int index) {
|
||||
void AutoTester::saveFile(int index) {
|
||||
try {
|
||||
QFile file(_directoryName + "/" + _filenames[index]);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(_downloaders[index]->downloadedData());
|
||||
file.close();
|
||||
} catch (...) {
|
||||
QMessageBox::information(0, "Test Aborted", "Failed to save image: " + _filenames[index]);
|
||||
QMessageBox::information(0, "Test Aborted", "Failed to save file: " + _filenames[index]);
|
||||
_ui.progressBar->setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
++_numberOfImagesDownloaded;
|
||||
++_numberOfFilesDownloaded;
|
||||
|
||||
if (_numberOfImagesDownloaded == _numberOfImagesToDownload) {
|
||||
disconnect(_signalMapper, SIGNAL(mapped(int)), this, SLOT(saveImage(int)));
|
||||
if (_numberOfFilesDownloaded == _numberOfFilesToDownload) {
|
||||
disconnect(_signalMapper, SIGNAL(mapped(int)), this, SLOT(saveFile(int)));
|
||||
_test->finishTestsEvaluation(_isRunningFromCommandline, _ui.checkBoxInteractiveMode->isChecked(), _ui.progressBar);
|
||||
} else {
|
||||
_ui.progressBar->setValue(_numberOfImagesDownloaded);
|
||||
_ui.progressBar->setValue(_numberOfFilesDownloaded);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,7 +199,7 @@ void AutoTester::about() {
|
|||
}
|
||||
|
||||
void AutoTester::content() {
|
||||
helpWindow.show();
|
||||
_helpWindow.show();
|
||||
}
|
||||
|
||||
void AutoTester::setUserText(const QString& user) {
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include "../Test.h"
|
||||
|
||||
#include "HelpWindow.h"
|
||||
#include "../TestRunner.h"
|
||||
|
||||
|
||||
class AutoTester : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
@ -30,8 +32,8 @@ public:
|
|||
|
||||
void runFromCommandLine(const QString& testFolder, const QString& branch, const QString& user);
|
||||
|
||||
void downloadImage(const QUrl& url);
|
||||
void downloadImages(const QStringList& URLs, const QString& directoryName, const QStringList& filenames);
|
||||
void downloadFile(const QUrl& url);
|
||||
void downloadFiles(const QStringList& URLs, const QString& directoryName, const QStringList& filenames);
|
||||
|
||||
void setUserText(const QString& user);
|
||||
QString getSelectedUser();
|
||||
|
@ -70,7 +72,7 @@ private slots:
|
|||
|
||||
void on_closeButton_clicked();
|
||||
|
||||
void saveImage(int index);
|
||||
void saveFile(int index);
|
||||
|
||||
void about();
|
||||
void content();
|
||||
|
@ -88,13 +90,15 @@ private:
|
|||
// Used to enable passing a parameter to slots
|
||||
QSignalMapper* _signalMapper;
|
||||
|
||||
int _numberOfImagesToDownload { 0 };
|
||||
int _numberOfImagesDownloaded { 0 };
|
||||
int _numberOfFilesToDownload { 0 };
|
||||
int _numberOfFilesDownloaded { 0 };
|
||||
int _index { 0 };
|
||||
|
||||
bool _isRunningFromCommandline { false };
|
||||
|
||||
HelpWindow helpWindow;
|
||||
HelpWindow _helpWindow;
|
||||
|
||||
TestRunner _testRunner;
|
||||
};
|
||||
|
||||
#endif // hifi_AutoTester_h
|
|
@ -23,7 +23,7 @@
|
|||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>235</x>
|
||||
<x>430</x>
|
||||
<y>620</y>
|
||||
<width>100</width>
|
||||
<height>40</height>
|
||||
|
@ -43,7 +43,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_1">
|
||||
<attribute name="title">
|
||||
|
@ -176,25 +176,12 @@
|
|||
<attribute name="title">
|
||||
<string>Evaluate</string>
|
||||
</attribute>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>230</y>
|
||||
<width>255</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBoxInteractiveMode">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<x>130</x>
|
||||
<y>180</y>
|
||||
<width>131</width>
|
||||
<width>120</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -327,9 +314,9 @@
|
|||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<x>120</x>
|
||||
<y>80</y>
|
||||
<width>81</width>
|
||||
<width>110</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -365,9 +352,9 @@
|
|||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<x>120</x>
|
||||
<y>40</y>
|
||||
<width>81</width>
|
||||
<width>110</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -380,6 +367,19 @@
|
|||
<string>GitHub User</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>630</y>
|
||||
<width>255</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
|
@ -387,7 +387,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>582</width>
|
||||
<height>21</height>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
Loading…
Reference in a new issue