mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Added recursive creation of MD files.
This commit is contained in:
parent
d8f0cfa89a
commit
8e063a600b
5 changed files with 75 additions and 17 deletions
|
@ -304,7 +304,7 @@ void Test::createRecursiveScript() {
|
|||
}
|
||||
|
||||
// This method creates a `testRecursive.js` script in every sub-folder.
|
||||
void Test::createRecursiveScriptsRecursively() {
|
||||
void Test::createAllRecursiveScripts() {
|
||||
// Select folder to start recursing from
|
||||
QString topLevelDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select the root folder for the recursive scripts", ".", QFileDialog::ShowDirsOnly);
|
||||
if (topLevelDirectory == "") {
|
||||
|
@ -559,6 +559,44 @@ void Test::createMDFile() {
|
|||
return;
|
||||
}
|
||||
|
||||
createMDFile(testDirectory);
|
||||
}
|
||||
|
||||
void Test::createAllMDFiles() {
|
||||
// Select folder to start recursing from
|
||||
QString topLevelDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select the root folder for the MD files", ".", QFileDialog::ShowDirsOnly);
|
||||
if (topLevelDirectory == "") {
|
||||
return;
|
||||
}
|
||||
|
||||
// First test if top-level folder has a test.js file
|
||||
const QString testPathname{ topLevelDirectory + "/" + TEST_FILENAME };
|
||||
QFileInfo fileInfo(testPathname);
|
||||
if (fileInfo.exists()) {
|
||||
createMDFile(topLevelDirectory);
|
||||
}
|
||||
|
||||
QDirIterator it(topLevelDirectory.toStdString().c_str(), QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
QString directory = it.next();
|
||||
|
||||
// Only process directories
|
||||
QDir dir;
|
||||
if (!isAValidDirectory(directory)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const QString testPathname{ directory + "/" + TEST_FILENAME };
|
||||
QFileInfo fileInfo(testPathname);
|
||||
if (fileInfo.exists()) {
|
||||
createMDFile(directory);
|
||||
}
|
||||
}
|
||||
|
||||
messageBox.information(0, "Success", "MD files have been created");
|
||||
}
|
||||
|
||||
void Test::createMDFile(QString testDirectory) {
|
||||
// Verify folder contains test.js file
|
||||
QString testFileName(testDirectory + "/" + TEST_FILENAME);
|
||||
QFileInfo testFileInfo(testFileName);
|
||||
|
@ -639,8 +677,8 @@ void Test::createMDFile() {
|
|||
|
||||
int snapShotIndex { 0 };
|
||||
for (size_t i = 0; i < testScriptLines.stepList.size(); ++i) {
|
||||
stream << "### Step " << QString::number(i) << "\n";
|
||||
stream << "- " << testScriptLines.stepList[i + 1]->text << "\n";
|
||||
stream << "### Step " << QString::number(i + 1) << "\n";
|
||||
stream << "- " << testScriptLines.stepList[i]->text << "\n";
|
||||
if (testScriptLines.stepList[i]->takeSnapshot) {
|
||||
stream << "- .rightJustified(5, '0') << ".png)\n";
|
||||
++snapShotIndex;
|
||||
|
|
|
@ -45,11 +45,13 @@ public:
|
|||
void finishTestsEvaluation(bool interactiveMode, QProgressBar* progressBar);
|
||||
|
||||
void createRecursiveScript();
|
||||
void createRecursiveScriptsRecursively();
|
||||
void createAllRecursiveScripts();
|
||||
void createRecursiveScript(QString topLevelDirectory, bool interactiveMode);
|
||||
|
||||
void createTest();
|
||||
void createMDFile();
|
||||
void createAllMDFiles();
|
||||
void createMDFile(QString topLevelDirectory);
|
||||
|
||||
bool compareImageLists(bool isInteractiveMode, QProgressBar* progressBar);
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ void AutoTester::on_createRecursiveScriptButton_clicked() {
|
|||
test->createRecursiveScript();
|
||||
}
|
||||
|
||||
void AutoTester::on_createRecursiveScriptsRecursivelyButton_clicked() {
|
||||
test->createRecursiveScriptsRecursively();
|
||||
void AutoTester::on_createAllRecursiveScriptsButton_clicked() {
|
||||
test->createAllRecursiveScripts();
|
||||
}
|
||||
|
||||
void AutoTester::on_createTestButton_clicked() {
|
||||
|
@ -37,7 +37,11 @@ void AutoTester::on_createTestButton_clicked() {
|
|||
}
|
||||
|
||||
void AutoTester::on_createMDFileButton_clicked() {
|
||||
test->createMDFile();
|
||||
test->createMDFile();
|
||||
}
|
||||
|
||||
void AutoTester::on_createAllMDFilesButton_clicked() {
|
||||
test->createAllMDFiles();
|
||||
}
|
||||
|
||||
void AutoTester::on_closeButton_clicked() {
|
||||
|
|
|
@ -28,10 +28,11 @@ public:
|
|||
private slots:
|
||||
void on_evaluateTestsButton_clicked();
|
||||
void on_createRecursiveScriptButton_clicked();
|
||||
void on_createRecursiveScriptsRecursivelyButton_clicked();
|
||||
void on_createAllRecursiveScriptsButton_clicked();
|
||||
void on_createTestButton_clicked();
|
||||
void on_createMDFileButton_clicked();
|
||||
void on_closeButton_clicked();
|
||||
void on_createMDFileButton_clicked();
|
||||
void on_createAllMDFilesButton_clicked();
|
||||
void on_closeButton_clicked();
|
||||
|
||||
void saveImage(int index);
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>420</y>
|
||||
<x>360</x>
|
||||
<y>400</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -44,7 +44,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>255</y>
|
||||
<y>285</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -70,7 +70,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>23</x>
|
||||
<y>220</y>
|
||||
<y>250</y>
|
||||
<width>131</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
|
@ -86,7 +86,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>310</y>
|
||||
<y>340</y>
|
||||
<width>255</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
|
@ -105,14 +105,14 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create Recursive Scripts Recursively</string>
|
||||
<string>Create all Recursive Scripts</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="createMDFileButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>90</y>
|
||||
<y>80</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -121,6 +121,19 @@
|
|||
<string>Create MD file</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="createAllMDFilesButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>130</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create all MD files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
|
|
Loading…
Reference in a new issue