mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Added selection of branch from the command line.
This commit is contained in:
parent
ee675b0f1c
commit
9ca27468f6
6 changed files with 106 additions and 27 deletions
|
@ -25,6 +25,10 @@ extern AutoTester* autoTester;
|
|||
|
||||
Test::Test() {
|
||||
mismatchWindow.setModal(true);
|
||||
|
||||
if (autoTester) {
|
||||
autoTester->loadBranchCombo(GIT_HUB_BRANCHES);
|
||||
}
|
||||
}
|
||||
|
||||
bool Test::createTestResultsFolderPath(const QString& directory) {
|
||||
|
@ -177,7 +181,7 @@ void Test::appendTestResultsToFile(const QString& testResultsFolderPath, TestFai
|
|||
comparisonImage.save(failureFolderPath + "/" + "Difference Image.png");
|
||||
}
|
||||
|
||||
void Test::startTestsEvaluation(const QString& testFolder) {
|
||||
void Test::startTestsEvaluation(const QString& testFolder, const QString& branchFromCommandLine) {
|
||||
if (testFolder.isNull()) {
|
||||
// Get list of JPEG images in folder, sorted by name
|
||||
QString previousSelection = snapshotDirectory;
|
||||
|
@ -225,6 +229,8 @@ void Test::startTestsEvaluation(const QString& testFolder) {
|
|||
expectedImagesFilenames.clear();
|
||||
expectedImagesFullFilenames.clear();
|
||||
|
||||
QString branch = (branchFromCommandLine.isNull()) ? autoTester->getSelectedBranch() : branchFromCommandLine ;
|
||||
|
||||
foreach(QString currentFilename, sortedTestResultsFilenames) {
|
||||
QString fullCurrentFilename = snapshotDirectory + "/" + currentFilename;
|
||||
if (isInSnapshotFilenameFormat("png", currentFilename)) {
|
||||
|
@ -237,7 +243,7 @@ void Test::startTestsEvaluation(const QString& testFolder) {
|
|||
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/" + GIT_HUB_BRANCH + "/" +
|
||||
QString imageURLString("https://raw.githubusercontent.com/" + GIT_HUB_USER + "/hifi_tests/" + branch + "/" +
|
||||
expectedImagePartialSourceDirectory + "/" + expectedImageStoredFilename);
|
||||
|
||||
expectedImagesURLs << imageURLString;
|
||||
|
@ -406,7 +412,9 @@ void Test::createRecursiveScript(const QString& topLevelDirectory, bool interact
|
|||
|
||||
textStream << "user = \"" + GIT_HUB_USER + "/\";" << endl;
|
||||
textStream << "repository = \"" + GIT_HUB_REPOSITORY + "/\";" << endl;
|
||||
textStream << "branch = \"" + GIT_HUB_BRANCH + "/\";" << endl << endl;
|
||||
|
||||
QString branch = autoTester->getSelectedBranch();
|
||||
textStream << "branch = \"" + branch + "/\";" << endl << endl;
|
||||
|
||||
// Wait 10 seconds before starting
|
||||
textStream << "Test.wait(10000);" << endl << endl;
|
||||
|
|
|
@ -37,7 +37,7 @@ class Test {
|
|||
public:
|
||||
Test();
|
||||
|
||||
void startTestsEvaluation(const QString& testFolder = QString());
|
||||
void startTestsEvaluation(const QString& testFolder = QString(), const QString& branchFromCommandLine = QString());
|
||||
void finishTestsEvaluation(bool isRunningFromCommandline, bool interactiveMode, QProgressBar* progressBar);
|
||||
|
||||
void createRecursiveScript();
|
||||
|
@ -106,7 +106,9 @@ private:
|
|||
// Used for accessing GitHub
|
||||
const QString GIT_HUB_USER{ "highfidelity" };
|
||||
const QString GIT_HUB_REPOSITORY{ "hifi_tests" };
|
||||
const QString GIT_HUB_BRANCH{ "master" };
|
||||
|
||||
// The branch is user-selected
|
||||
const QStringList GIT_HUB_BRANCHES{ "master", "RC69" };
|
||||
|
||||
const QString DATETIME_FORMAT{ "yyyy-MM-dd_hh-mm-ss" };
|
||||
|
||||
|
|
|
@ -10,23 +10,49 @@
|
|||
#include <QtWidgets/QApplication>
|
||||
#include "ui/AutoTester.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
AutoTester* autoTester;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// Only parameter is "--testFolder"
|
||||
// If no parameters then run in interactive mode
|
||||
// Parameter --testFolder <folder containing the test images>
|
||||
// Parameter --branch <branch on GitHub>
|
||||
// default is "master"
|
||||
//
|
||||
QString testFolder;
|
||||
if (argc == 3) {
|
||||
if (QString(argv[1]) == "--testFolder") {
|
||||
testFolder = QString(argv[2]);
|
||||
QString branch;
|
||||
if (argc > 2) {
|
||||
for (int i = 1; i < argc - 1; ++i)
|
||||
if (QString(argv[i]) == "--testFolder") {
|
||||
++i;
|
||||
if (i < argc) {
|
||||
testFolder = QString(argv[i]);
|
||||
} else {
|
||||
std::cout << "Missing parameter after --testFolder" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
} else if (QString(argv[i]) == "--branch") {
|
||||
++i;
|
||||
if (i < argc) {
|
||||
branch = QString(argv[i]);
|
||||
} else {
|
||||
std::cout << "Missing parameter after --branch" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
std::cout << "Unknown parameter" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
QApplication application(argc, argv);
|
||||
|
||||
autoTester = new AutoTester();
|
||||
autoTester->setup();
|
||||
|
||||
if (!testFolder.isNull()) {
|
||||
autoTester->runFromCommandLine(testFolder);
|
||||
autoTester->runFromCommandLine(testFolder, branch);
|
||||
} else {
|
||||
autoTester->show();
|
||||
}
|
||||
|
|
|
@ -29,13 +29,15 @@ AutoTester::AutoTester(QWidget *parent) : QMainWindow(parent) {
|
|||
ui.hideTaskbarButton->setVisible(false);
|
||||
ui.showTaskbarButton->setVisible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AutoTester::setup() {
|
||||
test = new Test();
|
||||
}
|
||||
|
||||
void AutoTester::runFromCommandLine(const QString& testFolder) {
|
||||
void AutoTester::runFromCommandLine(const QString& testFolder, const QString& branch) {
|
||||
isRunningFromCommandline = true;
|
||||
test->startTestsEvaluation(testFolder);
|
||||
test->startTestsEvaluation(testFolder, branch);
|
||||
}
|
||||
|
||||
void AutoTester::on_evaluateTestsButton_clicked() {
|
||||
|
@ -150,3 +152,11 @@ void AutoTester::saveImage(int index) {
|
|||
void AutoTester::about() {
|
||||
QMessageBox::information(0, "About", QString("Built ") + __DATE__ + " : " + __TIME__);
|
||||
}
|
||||
|
||||
void AutoTester::loadBranchCombo(const QStringList& items) {
|
||||
ui.branchComboBox->addItems(items);
|
||||
}
|
||||
|
||||
QString AutoTester::getSelectedBranch() {
|
||||
return ui.branchComboBox->currentText();
|
||||
}
|
|
@ -23,11 +23,16 @@ class AutoTester : public QMainWindow {
|
|||
public:
|
||||
AutoTester(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
void runFromCommandLine(const QString& testFolder);
|
||||
void setup();
|
||||
|
||||
void runFromCommandLine(const QString& testFolder, const QString& branch);
|
||||
|
||||
void downloadImage(const QUrl& url);
|
||||
void downloadImages(const QStringList& URLs, const QString& directoryName, const QStringList& filenames);
|
||||
|
||||
void loadBranchCombo(const QStringList& items);
|
||||
QString getSelectedBranch();
|
||||
|
||||
private slots:
|
||||
void on_evaluateTestsButton_clicked();
|
||||
void on_createRecursiveScriptButton_clicked();
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
<widget class="QPushButton" name="evaluateTestsButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>285</y>
|
||||
<x>340</x>
|
||||
<y>275</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -56,8 +56,8 @@
|
|||
<widget class="QPushButton" name="createRecursiveScriptButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>35</y>
|
||||
<x>340</x>
|
||||
<y>95</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -69,8 +69,8 @@
|
|||
<widget class="QCheckBox" name="checkBoxInteractiveMode">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>23</x>
|
||||
<y>250</y>
|
||||
<x>343</x>
|
||||
<y>240</y>
|
||||
<width>131</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
|
@ -85,8 +85,8 @@
|
|||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>340</y>
|
||||
<x>340</x>
|
||||
<y>330</y>
|
||||
<width>255</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
|
@ -98,8 +98,8 @@
|
|||
<widget class="QPushButton" name="createAllRecursiveScriptsButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>100</y>
|
||||
<x>340</x>
|
||||
<y>160</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -150,8 +150,8 @@
|
|||
<widget class="QPushButton" name="showTaskbarButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>490</x>
|
||||
<y>280</y>
|
||||
<x>10</x>
|
||||
<y>410</y>
|
||||
<width>91</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -163,8 +163,8 @@
|
|||
<widget class="QPushButton" name="hideTaskbarButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>490</x>
|
||||
<y>230</y>
|
||||
<x>10</x>
|
||||
<y>360</y>
|
||||
<width>91</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -173,6 +173,34 @@
|
|||
<string>Hide Taskbar</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="branchComboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>428</x>
|
||||
<y>41</y>
|
||||
<width>131</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>30</y>
|
||||
<width>81</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>GitHub Branch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
|
|
Loading…
Reference in a new issue