mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Added creation of tests outline .MD file.
This commit is contained in:
parent
8e063a600b
commit
60f4c6788f
5 changed files with 76 additions and 2 deletions
|
@ -688,6 +688,60 @@ void Test::createMDFile(QString testDirectory) {
|
|||
mdFile.close();
|
||||
}
|
||||
|
||||
void Test::createTestsOutline() {
|
||||
QString testsRootDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select the tests root folder", ".", QFileDialog::ShowDirsOnly);
|
||||
if (testsRootDirectory == "") {
|
||||
return;
|
||||
}
|
||||
|
||||
const QString testsOutlineFilename { "testsOutline.md" };
|
||||
QString mdFilename(testsRootDirectory + "/" + testsOutlineFilename);
|
||||
QFile mdFile(mdFilename);
|
||||
if (!mdFile.open(QIODevice::WriteOnly)) {
|
||||
messageBox.critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Failed to create file " + mdFilename);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
QTextStream stream(&mdFile);
|
||||
|
||||
//Test title
|
||||
stream << "# Outline of all tests\n";
|
||||
stream << "Directories with an appended (*) have an automatic test\n\n";
|
||||
|
||||
// We need to know our current depth, as this isn't given by QDirIterator
|
||||
int rootDepth { testsRootDirectory.count('/') };
|
||||
|
||||
QDirIterator it(testsRootDirectory.toStdString().c_str(), QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
QString directory = it.next();
|
||||
|
||||
// Only process directories
|
||||
QDir dir;
|
||||
if (!isAValidDirectory(directory)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore the utils directory
|
||||
if (directory.right(5) == "utils") {
|
||||
continue;
|
||||
}
|
||||
|
||||
int currentDepth = directory.count('/') - rootDepth;
|
||||
QString prefix = QString(" ").repeated(2 * currentDepth - 1) + " - ";
|
||||
stream << prefix;
|
||||
stream << directory.right(directory.length() - directory.lastIndexOf("/") - 1);
|
||||
QFileInfo fileInfo(directory + "/" + TEST_FILENAME);
|
||||
if (fileInfo.exists()) {
|
||||
stream << " (*)";
|
||||
}
|
||||
stream << "\n";
|
||||
}
|
||||
|
||||
mdFile.close();
|
||||
|
||||
messageBox.information(0, "Success", "Test outline file " + testsOutlineFilename + " has been created");
|
||||
}
|
||||
|
||||
void Test::copyJPGtoPNG(QString sourceJPGFullFilename, QString destinationPNGFullFilename) {
|
||||
QFile::remove(destinationPNGFullFilename);
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
void createAllMDFiles();
|
||||
void createMDFile(QString topLevelDirectory);
|
||||
|
||||
void createTestsOutline();
|
||||
|
||||
bool compareImageLists(bool isInteractiveMode, QProgressBar* progressBar);
|
||||
|
||||
QStringList createListOfAll_imagesInDirectory(QString imageFormat, QString pathToImageDirectory);
|
||||
|
|
|
@ -44,6 +44,10 @@ void AutoTester::on_createAllMDFilesButton_clicked() {
|
|||
test->createAllMDFiles();
|
||||
}
|
||||
|
||||
void AutoTester::on_createTestsOutlineButton_clicked() {
|
||||
test->createTestsOutline();
|
||||
}
|
||||
|
||||
void AutoTester::on_closeButton_clicked() {
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ private slots:
|
|||
void on_createTestButton_clicked();
|
||||
void on_createMDFileButton_clicked();
|
||||
void on_createAllMDFilesButton_clicked();
|
||||
void on_createTestsOutlineButton_clicked();
|
||||
void on_closeButton_clicked();
|
||||
|
||||
void saveImage(int index);
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>75</y>
|
||||
<y>35</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -99,7 +99,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>140</y>
|
||||
<y>100</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -134,6 +134,19 @@
|
|||
<string>Create all MD files</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="createTestsOutlineButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>180</y>
|
||||
<width>220</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create Tests Outline</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
|
|
Loading…
Reference in a new issue