Puts images in separate folder.

This commit is contained in:
NissimHadar 2018-10-05 09:50:22 -07:00
parent 19f41eac2b
commit fd7139c39f
2 changed files with 12 additions and 8 deletions

View file

@ -23,8 +23,7 @@ void AWSInterface::createWebPageFromResults(const QString& testResults, const QS
// Extract test failures from zipped folder // Extract test failures from zipped folder
_tempDirectory = tempDirectory; _tempDirectory = tempDirectory;
QDir dir = _tempDirectory; QDir().mkdir(_tempDirectory);
dir.mkdir(_tempDirectory);
JlCompress::extractDir(testResults, _tempDirectory); JlCompress::extractDir(testResults, _tempDirectory);
createHTMLFile(testResults, tempDirectory); createHTMLFile(testResults, tempDirectory);
@ -153,12 +152,15 @@ void AWSInterface::writeTable(QTextStream& stream) {
newNames.append(originalNames[i].split("--tests.")[1]); newNames.append(originalNames[i].split("--tests.")[1]);
} }
QString htmlFolder{ _tempDirectory + "/" + _resultsFolder + "/" + FAILURE_FOLDER };
QDir().mkdir(htmlFolder);
for (int i = 0; i < newNames.length(); ++i) { for (int i = 0; i < newNames.length(); ++i) {
QDir dir(originalNames[i]); QDir dir(originalNames[i]);
dir.rename(originalNames[i], _tempDirectory + "/" + _resultsFolder + "/" + newNames[i]); dir.rename(originalNames[i], htmlFolder + "/" + newNames[i]);
} }
QDirIterator it2((_tempDirectory + "/" + _resultsFolder).toStdString().c_str()); QDirIterator it2((htmlFolder).toStdString().c_str());
while (it2.hasNext()) { while (it2.hasNext()) {
QString nextDirectory = it2.next(); QString nextDirectory = it2.next();
@ -186,7 +188,7 @@ void AWSInterface::writeTable(QTextStream& stream) {
openTable(stream); openTable(stream);
} }
createEntry(testNumber.toInt(), nextDirectory, stream); createEntry(testNumber.toInt(), filename, stream);
} }
closeTable(stream); closeTable(stream);
@ -215,8 +217,8 @@ void AWSInterface::createEntry(int index, const QString& testFailure, QTextStrea
QStringList failureNameComponents = testFailure.split('/'); QStringList failureNameComponents = testFailure.split('/');
QString failureName = failureNameComponents[failureNameComponents.length() - 1]; QString failureName = failureNameComponents[failureNameComponents.length() - 1];
stream << "\t\t\t\t<td><img src=\"" << failureName << "/Actual Image.png\" width = \"576\" height = \"324\" ></td>\n"; stream << "\t\t\t\t<td><img src=\"" << FAILURE_FOLDER << "/" << failureName << "/Actual Image.png\" width = \"576\" height = \"324\" ></td>\n";
stream << "\t\t\t\t<td><img src=\"" << failureName << "/Expected Image.png\" width = \"576\" height = \"324\" ></td>\n"; stream << "\t\t\t\t<td><img src=\"" << FAILURE_FOLDER << "/" << failureName << "/Expected Image.png\" width = \"576\" height = \"324\" ></td>\n";
stream << "\t\t\t\t<td><img src=\"" << failureName << "/Difference Image.png\" width = \"576\" height = \"324\" ></td>\n"; stream << "\t\t\t\t<td><img src=\"" << FAILURE_FOLDER << "/" << failureName << "/Difference Image.png\" width = \"576\" height = \"324\" ></td>\n";
stream << "\t\t\t</tr>\n"; stream << "\t\t\t</tr>\n";
} }

View file

@ -38,6 +38,8 @@ public:
private: private:
QString _tempDirectory; QString _tempDirectory;
QString _resultsFolder; QString _resultsFolder;
const QString FAILURE_FOLDER{ "failures" };
}; };
#endif // hifi_AWSInterface_h #endif // hifi_AWSInterface_h