mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Allow multiple evaluations.
This commit is contained in:
parent
fdf0beba9c
commit
25834c3809
6 changed files with 117 additions and 58 deletions
|
@ -27,7 +27,8 @@ Test::Test() {
|
|||
mismatchWindow.setModal(true);
|
||||
|
||||
if (autoTester) {
|
||||
autoTester->loadBranchCombo(GIT_HUB_BRANCHES);
|
||||
autoTester->setUserText("highfidelity");
|
||||
autoTester->setBranchText("master");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,7 @@ void Test::appendTestResultsToFile(const QString& testResultsFolderPath, TestFai
|
|||
comparisonImage.save(failureFolderPath + "/" + "Difference Image.png");
|
||||
}
|
||||
|
||||
void Test::startTestsEvaluation(const QString& testFolder, const QString& branchFromCommandLine) {
|
||||
void Test::startTestsEvaluation(const QString& testFolder, const QString& branchFromCommandLine, const QString& userFromCommandLine) {
|
||||
if (testFolder.isNull()) {
|
||||
// Get list of JPEG images in folder, sorted by name
|
||||
QString previousSelection = snapshotDirectory;
|
||||
|
@ -213,7 +214,8 @@ void Test::startTestsEvaluation(const QString& testFolder, const QString& branch
|
|||
expectedImagesFilenames.clear();
|
||||
expectedImagesFullFilenames.clear();
|
||||
|
||||
QString branch = (branchFromCommandLine.isNull()) ? autoTester->getSelectedBranch() : branchFromCommandLine ;
|
||||
QString branch = (branchFromCommandLine.isNull()) ? autoTester->getSelectedBranch() : branchFromCommandLine;
|
||||
QString user = (userFromCommandLine.isNull()) ? autoTester->getSelectedUser() : userFromCommandLine;
|
||||
|
||||
foreach(QString currentFilename, sortedTestResultsFilenames) {
|
||||
QString fullCurrentFilename = snapshotDirectory + "/" + currentFilename;
|
||||
|
@ -227,7 +229,7 @@ void Test::startTestsEvaluation(const QString& testFolder, const QString& branch
|
|||
QString expectedImageFilenameTail = currentFilename.left(currentFilename.length() - 4).right(NUM_DIGITS);
|
||||
QString expectedImageStoredFilename = EXPECTED_IMAGE_PREFIX + expectedImageFilenameTail + ".png";
|
||||
|
||||
QString imageURLString("https://raw.githubusercontent.com/" + GIT_HUB_USER + "/hifi_tests/" + branch + "/" +
|
||||
QString imageURLString("https://raw.githubusercontent.com/" + user + "/" + GIT_HUB_REPOSITORY + "/" + branch + "/" +
|
||||
expectedImagePartialSourceDirectory + "/" + expectedImageStoredFilename);
|
||||
|
||||
expectedImagesURLs << imageURLString;
|
||||
|
@ -301,7 +303,7 @@ void Test::includeTest(QTextStream& textStream, const QString& testPathname) {
|
|||
QString partialPath = extractPathFromTestsDown(testPathname);
|
||||
QString partialPathWithoutTests = partialPath.right(partialPath.length() - 7);
|
||||
|
||||
textStream << "Script.include(repositoryPath + \"" << partialPathWithoutTests + "\");" << endl;
|
||||
textStream << "Script.include(testsRootPath + \"" << partialPathWithoutTests + "\");" << endl;
|
||||
}
|
||||
|
||||
// Creates a single script in a user-selected folder.
|
||||
|
@ -397,10 +399,14 @@ void Test::createRecursiveScript(const QString& topLevelDirectory, bool interact
|
|||
textStream << "// This is an automatically generated file, created by auto-tester on " << QDateTime::currentDateTime().toString(DATE_TIME_FORMAT) << endl << endl;
|
||||
|
||||
// Include 'autoTest.js'
|
||||
textStream << "Script.include(\"https://raw.githubusercontent.com/highfidelity/hifi_tests/master/tests/utils/branchUtils.js\");" << endl;
|
||||
QString branch = autoTester->getSelectedBranch();
|
||||
QString user = autoTester->getSelectedUser();
|
||||
|
||||
textStream << "PATH_TO_THE_REPO_PATH_UTILS_FILE = \"https://raw.githubusercontent.com/" + user + "/hifi_tests/" + branch + "/tests/utils/branchUtils.js\";" << endl;
|
||||
textStream << "Script.include(PATH_TO_THE_REPO_PATH_UTILS_FILE);" << endl;
|
||||
textStream << "var autoTester = createAutoTester(Script.resolvePath(\".\"));" << endl << endl;
|
||||
|
||||
textStream << "var repositoryPath = autoTester.getRepositoryPath();" << endl << endl;
|
||||
textStream << "var testsRootPath = autoTester.getTestsRootPath();" << endl << endl;
|
||||
|
||||
// Wait 10 seconds before starting
|
||||
textStream << "if (typeof Test !== 'undefined') {" << endl;
|
||||
|
|
|
@ -37,7 +37,7 @@ class Test {
|
|||
public:
|
||||
Test();
|
||||
|
||||
void startTestsEvaluation(const QString& testFolder = QString(), const QString& branchFromCommandLine = QString());
|
||||
void startTestsEvaluation(const QString& testFolder = QString(), const QString& branchFromCommandLine = QString(), const QString& userFromCommandLine = QString());
|
||||
void finishTestsEvaluation(bool isRunningFromCommandline, bool interactiveMode, QProgressBar* progressBar);
|
||||
|
||||
void createRecursiveScript();
|
||||
|
@ -102,12 +102,8 @@ private:
|
|||
QStringList resultImagesFullFilenames;
|
||||
|
||||
// Used for accessing GitHub
|
||||
const QString GIT_HUB_USER{ "highfidelity" };
|
||||
const QString GIT_HUB_REPOSITORY{ "hifi_tests" };
|
||||
|
||||
// The branch is user-selected
|
||||
const QStringList GIT_HUB_BRANCHES{ "master", "RC69" };
|
||||
|
||||
const QString DATETIME_FORMAT{ "yyyy-MM-dd_hh-mm-ss" };
|
||||
|
||||
ExtractedText getTestScriptLines(QString testFileName);
|
||||
|
|
|
@ -19,11 +19,17 @@ int main(int argc, char *argv[]) {
|
|||
// Parameter --testFolder <folder containing the test images>
|
||||
// Parameter --branch <branch on GitHub>
|
||||
// default is "master"
|
||||
//
|
||||
// Parameter --user <GitHub user>
|
||||
// default is "highfidelity"
|
||||
// Parameter --repository <repository on GitHub>
|
||||
// default is "highfidelity"
|
||||
|
||||
QString testFolder;
|
||||
QString branch;
|
||||
if (argc > 2) {
|
||||
for (int i = 1; i < argc - 1; ++i)
|
||||
|
||||
QString branch{ "master" };
|
||||
QString user{ "highfidelity" };
|
||||
|
||||
for (int i = 1; i < argc - 1; ++i) {
|
||||
if (QString(argv[i]) == "--testFolder") {
|
||||
++i;
|
||||
if (i < argc) {
|
||||
|
@ -40,6 +46,14 @@ int main(int argc, char *argv[]) {
|
|||
std::cout << "Missing parameter after --branch" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
} else if (QString(argv[i]) == "--user") {
|
||||
++i;
|
||||
if (i < argc) {
|
||||
user = QString(argv[i]);
|
||||
} else {
|
||||
std::cout << "Missing parameter after --user" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
std::cout << "Unknown parameter" << endl;
|
||||
exit(-1);
|
||||
|
@ -52,7 +66,7 @@ int main(int argc, char *argv[]) {
|
|||
autoTester->setup();
|
||||
|
||||
if (!testFolder.isNull()) {
|
||||
autoTester->runFromCommandLine(testFolder, branch);
|
||||
autoTester->runFromCommandLine(testFolder, branch, user);
|
||||
} else {
|
||||
autoTester->show();
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ void AutoTester::setup() {
|
|||
test = new Test();
|
||||
}
|
||||
|
||||
void AutoTester::runFromCommandLine(const QString& testFolder, const QString& branch) {
|
||||
void AutoTester::runFromCommandLine(const QString& testFolder, const QString& branch, const QString& user) {
|
||||
isRunningFromCommandline = true;
|
||||
test->startTestsEvaluation(testFolder, branch);
|
||||
test->startTestsEvaluation(testFolder, branch, user);
|
||||
}
|
||||
|
||||
void AutoTester::on_evaluateTestsButton_clicked() {
|
||||
|
@ -118,6 +118,7 @@ void AutoTester::downloadImages(const QStringList& URLs, const QString& director
|
|||
ui.progressBar->setValue(0);
|
||||
ui.progressBar->setVisible(true);
|
||||
|
||||
downloaders.clear();
|
||||
for (int i = 0; i < _numberOfImagesToDownload; ++i) {
|
||||
QUrl imageURL(URLs[i]);
|
||||
downloadImage(imageURL);
|
||||
|
@ -141,6 +142,7 @@ void AutoTester::saveImage(int index) {
|
|||
++_numberOfImagesDownloaded;
|
||||
|
||||
if (_numberOfImagesDownloaded == _numberOfImagesToDownload) {
|
||||
disconnect(signalMapper, SIGNAL (mapped(int)), this, SLOT (saveImage(int)));
|
||||
test->finishTestsEvaluation(isRunningFromCommandline, ui.checkBoxInteractiveMode->isChecked(), ui.progressBar);
|
||||
} else {
|
||||
ui.progressBar->setValue(_numberOfImagesDownloaded);
|
||||
|
@ -151,10 +153,19 @@ void AutoTester::about() {
|
|||
QMessageBox::information(0, "About", QString("Built ") + __DATE__ + " : " + __TIME__);
|
||||
}
|
||||
|
||||
void AutoTester::loadBranchCombo(const QStringList& items) {
|
||||
ui.branchComboBox->addItems(items);
|
||||
void AutoTester::setUserText(const QString& user) {
|
||||
ui.userTextEdit->setText(user);
|
||||
}
|
||||
|
||||
QString AutoTester::getSelectedUser()
|
||||
{
|
||||
return ui.userTextEdit->toPlainText();
|
||||
}
|
||||
|
||||
void AutoTester::setBranchText(const QString& branch) {
|
||||
ui.branchTextEdit->setText(branch);
|
||||
}
|
||||
|
||||
QString AutoTester::getSelectedBranch() {
|
||||
return ui.branchComboBox->currentText();
|
||||
}
|
||||
return ui.branchTextEdit->toPlainText();
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include <QSignalMapper>
|
||||
#include <QTextEdit>
|
||||
#include "ui_AutoTester.h"
|
||||
|
||||
#include "../Downloader.h"
|
||||
|
@ -25,12 +26,15 @@ public:
|
|||
|
||||
void setup();
|
||||
|
||||
void runFromCommandLine(const QString& testFolder, const QString& branch);
|
||||
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 loadBranchCombo(const QStringList& items);
|
||||
void setUserText(const QString& user);
|
||||
QString getSelectedUser();
|
||||
|
||||
void setBranchText(const QString& branch);
|
||||
QString getSelectedBranch();
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>583</width>
|
||||
<height>514</height>
|
||||
<width>612</width>
|
||||
<height>537</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -17,8 +17,8 @@
|
|||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>410</y>
|
||||
<x>380</x>
|
||||
<y>430</y>
|
||||
<width>101</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -43,9 +43,9 @@
|
|||
<widget class="QPushButton" name="evaluateTestsButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<y>275</y>
|
||||
<width>220</width>
|
||||
<x>430</x>
|
||||
<y>270</y>
|
||||
<width>101</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -57,7 +57,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<y>30</y>
|
||||
<y>110</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -69,8 +69,8 @@
|
|||
<widget class="QCheckBox" name="checkBoxInteractiveMode">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<y>250</y>
|
||||
<x>320</x>
|
||||
<y>280</y>
|
||||
<width>131</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
|
@ -85,7 +85,7 @@
|
|||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<x>320</x>
|
||||
<y>330</y>
|
||||
<width>255</width>
|
||||
<height>23</height>
|
||||
|
@ -99,7 +99,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<y>80</y>
|
||||
<y>170</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -112,7 +112,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>100</y>
|
||||
<y>110</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -125,7 +125,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>150</y>
|
||||
<y>160</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -138,7 +138,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>220</y>
|
||||
<y>250</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -151,43 +151,33 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>410</y>
|
||||
<width>91</width>
|
||||
<y>440</y>
|
||||
<width>211</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show Taskbar</string>
|
||||
<string>Show Windows Taskbar</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="hideTaskbarButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>360</y>
|
||||
<width>91</width>
|
||||
<y>390</y>
|
||||
<width>211</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hide Taskbar</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="branchComboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>418</x>
|
||||
<y>211</y>
|
||||
<width>131</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
<string>Hide Windows Taskbar</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<y>220</y>
|
||||
<y>55</y>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
|
@ -201,13 +191,51 @@
|
|||
<string>GitHub Branch</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<y>15</y>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>GitHub User</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="userTextEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>12</y>
|
||||
<width>140</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="branchTextEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>50</y>
|
||||
<width>140</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>583</width>
|
||||
<width>612</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
Loading…
Reference in a new issue