mirror of
https://github.com/overte-org/overte.git
synced 2025-07-27 05:08:54 +02:00
Saves text results in zip file.
This commit is contained in:
parent
936119b246
commit
f5a19efa8c
1 changed files with 22 additions and 6 deletions
|
@ -146,6 +146,11 @@ int Test::checkTextResults() {
|
||||||
|
|
||||||
// Add results to Test Results folder
|
// Add results to Test Results folder
|
||||||
foreach(QString currentFilename, testsFailed) {
|
foreach(QString currentFilename, testsFailed) {
|
||||||
|
appendTestResultsToFile(currentFilename, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(QString currentFilename, testsPassed) {
|
||||||
|
appendTestResultsToFile(currentFilename, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return testsFailed.length();
|
return testsFailed.length();
|
||||||
|
@ -215,17 +220,28 @@ void Test::appendTestResultsToFile(TestResult testResult, QPixmap comparisonImag
|
||||||
}
|
}
|
||||||
|
|
||||||
void::Test::appendTestResultsToFile(QString testResultFilename, bool hasFailed) {
|
void::Test::appendTestResultsToFile(QString testResultFilename, bool hasFailed) {
|
||||||
|
// The test name includes everything until the penultimate period
|
||||||
|
QString testNameTemp = testResultFilename.left(testResultFilename.lastIndexOf('.'));
|
||||||
|
QString testName = testResultFilename.left(testNameTemp.lastIndexOf('.'));
|
||||||
QString resultFolderPath;
|
QString resultFolderPath;
|
||||||
if (hasFailed) {
|
if (hasFailed) {
|
||||||
resultFolderPath = _testResultsFolderPath + "/Failure_";
|
resultFolderPath = _testResultsFolderPath + "/Failure_" + testName;
|
||||||
++_failureIndex;
|
++_failureIndex;
|
||||||
} else {
|
} else {
|
||||||
resultFolderPath = _testResultsFolderPath + "/Success_";
|
resultFolderPath = _testResultsFolderPath + "/Success_" + testName;
|
||||||
++_successIndex;
|
++_successIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QFile::copy(testResultFilename, resultFolderPath)) {
|
if (!QDir().mkdir(resultFolderPath)) {
|
||||||
//// QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Failed to copy " + sourceFile + " to " + destinationFile);
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Failed to create folder " + resultFolderPath);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString source = _snapshotDirectory + "/" + testResultFilename;
|
||||||
|
QString destination = resultFolderPath + "/" + testResultFilename;
|
||||||
|
if (!QFile::copy(source, destination)) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Failed to copy " + source + " to " + destination);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,7 +262,7 @@ void Test::startTestsEvaluation(const bool isRunningFromCommandLine,
|
||||||
if (!parent.isNull() && parent.right(1) != "/") {
|
if (!parent.isNull() && parent.right(1) != "/") {
|
||||||
parent += "/";
|
parent += "/";
|
||||||
}
|
}
|
||||||
_snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test images", parent,
|
_snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the snapshots", parent,
|
||||||
QFileDialog::ShowDirsOnly);
|
QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
// If user canceled then restore previous selection and return
|
// If user canceled then restore previous selection and return
|
||||||
|
@ -384,7 +400,7 @@ void Test::createTests() {
|
||||||
parent += "/";
|
parent += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
_snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test images", parent,
|
_snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the snapshots", parent,
|
||||||
QFileDialog::ShowDirsOnly);
|
QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
// If user canceled then restore previous selection and return
|
// If user canceled then restore previous selection and return
|
||||||
|
|
Loading…
Reference in a new issue