mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 16:14:35 +02:00
Factor out directory parsing from md file output
This commit is contained in:
parent
1ae66c6c10
commit
e4369feec5
1 changed files with 23 additions and 13 deletions
|
@ -778,6 +778,26 @@ bool TestCreator::createMDFile(const QString& directory) {
|
||||||
|
|
||||||
// ExpectedImage_00000.png OR ExpectedImage_some_stu-ff_00000.png
|
// ExpectedImage_00000.png OR ExpectedImage_some_stu-ff_00000.png
|
||||||
const QRegularExpression firstExpectedImage("^ExpectedImage(_[-_\\w]*)?_00000\\.png$");
|
const QRegularExpression firstExpectedImage("^ExpectedImage(_[-_\\w]*)?_00000\\.png$");
|
||||||
|
std::vector<QString> testDescriptors;
|
||||||
|
std::vector<TestFilter> testFilters;
|
||||||
|
|
||||||
|
for (const auto& potentialImageFile : qDirectory.entryInfoList()) {
|
||||||
|
if (potentialImageFile.isDir()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto firstExpectedImageMatch = firstExpectedImage.match(potentialImageFile.fileName());
|
||||||
|
if (!firstExpectedImageMatch.hasMatch()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString testDescriptor = firstExpectedImageMatch.captured(1);
|
||||||
|
auto filterString = QString(testDescriptor).replace("_", ".").replace("-", ",");
|
||||||
|
TestFilter descriptorAsFilter(filterString);
|
||||||
|
|
||||||
|
testDescriptors.push_back(testDescriptor);
|
||||||
|
testFilters.push_back(descriptorAsFilter);
|
||||||
|
}
|
||||||
|
|
||||||
stream << "## Steps\n";
|
stream << "## Steps\n";
|
||||||
stream << "Press '" + ADVANCE_KEY + "' key to advance step by step\n\n"; // note apostrophes surrounding 'ADVANCE_KEY'
|
stream << "Press '" + ADVANCE_KEY + "' key to advance step by step\n\n"; // note apostrophes surrounding 'ADVANCE_KEY'
|
||||||
|
@ -786,19 +806,9 @@ bool TestCreator::createMDFile(const QString& directory) {
|
||||||
stream << "### Step " << QString::number(i + 1) << "\n";
|
stream << "### Step " << QString::number(i + 1) << "\n";
|
||||||
stream << "- " << testScriptLines.stepList[i]->text << "\n";
|
stream << "- " << testScriptLines.stepList[i]->text << "\n";
|
||||||
if ((i + 1 < testScriptLines.stepList.size()) && testScriptLines.stepList[i]->takeSnapshot) {
|
if ((i + 1 < testScriptLines.stepList.size()) && testScriptLines.stepList[i]->takeSnapshot) {
|
||||||
for (const auto& potentialImageFile : qDirectory.entryInfoList()) {
|
for (int i = 0; i < testDescriptors.size(); ++i) {
|
||||||
if (potentialImageFile.isDir()) {
|
const auto& testDescriptor = testDescriptors[i];
|
||||||
continue;
|
const auto& descriptorAsFilter = testFilters[i];
|
||||||
}
|
|
||||||
|
|
||||||
auto firstExpectedImageMatch = firstExpectedImage.match(potentialImageFile.fileName());
|
|
||||||
if (!firstExpectedImageMatch.hasMatch()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString testDescriptor = firstExpectedImageMatch.captured(1);
|
|
||||||
auto filterString = QString(testDescriptor).replace("_", ".").replace("-", ",");
|
|
||||||
TestFilter descriptorAsFilter(filterString);
|
|
||||||
if (descriptorAsFilter.isValid()) {
|
if (descriptorAsFilter.isValid()) {
|
||||||
stream << "- Expected image on ";
|
stream << "- Expected image on ";
|
||||||
stream << (descriptorAsFilter.allowedTiers.empty() ? "any" : joinVector(descriptorAsFilter.allowedTiers, "/")) << " tier, ";
|
stream << (descriptorAsFilter.allowedTiers.empty() ? "any" : joinVector(descriptorAsFilter.allowedTiers, "/")) << " tier, ";
|
||||||
|
|
Loading…
Reference in a new issue