diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index a6577f6890..950b5b3892 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -1757,6 +1757,19 @@ void RiaApplication::runRegressionTest(const QString& testRootPath) RiaImageCompareReporter imageCompareReporter; + // Minor workaround + // Use registry to define if interactive diff images should be created + // Defined by user in RiaRegressionTest + { + QSettings settings; + + bool useInteractiveDiff = settings.value("showInteractiveDiffImages").toBool(); + if (useInteractiveDiff) + { + imageCompareReporter.showInteractiveOnly(); + } + } + for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx) { QDir testCaseFolder(folderList[dirIdx].filePath()); diff --git a/ApplicationCode/Application/RiaImageCompareReporter.cpp b/ApplicationCode/Application/RiaImageCompareReporter.cpp index c3ec958414..cf140fe3ab 100644 --- a/ApplicationCode/Application/RiaImageCompareReporter.cpp +++ b/ApplicationCode/Application/RiaImageCompareReporter.cpp @@ -23,6 +23,9 @@ RiaImageCompareReporter::RiaImageCompareReporter(void) { + m_showOriginal = true; + m_showGenerated = true; + m_showInteractiveDiff = false; } @@ -68,6 +71,12 @@ void RiaImageCompareReporter::generateHTMLReport(const std::string& fileName) html += "\n"; html += "\n"; html += "Regression-Test Report\n"; + + if (m_showInteractiveDiff) + { + html += cssString(); + } + html += "\n"; html += "\n"; html += "\n"; @@ -93,8 +102,21 @@ void RiaImageCompareReporter::generateHTMLReport(const std::string& fileName) html += " \n"; html += " \n"; - html += " \"" \n"; - html += " \"" \n"; + if (m_showOriginal) + { + html += " \"" \n"; + } + + if (m_showGenerated) + { + html += " \"" \n"; + } + + if (m_showInteractiveDiff) + { + html += "
\n"; + } + html += " \"" \n"; html += " \n"; @@ -110,6 +132,16 @@ void RiaImageCompareReporter::generateHTMLReport(const std::string& fileName) output << html; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaImageCompareReporter::showInteractiveOnly() +{ + m_showOriginal = false; + m_showGenerated = false; + m_showInteractiveDiff = true; +} + //-------------------------------------------------------------------------------------------------- /// Retuns the names of the *.png files in a directory. The names are without path, but with extention //-------------------------------------------------------------------------------------------------- @@ -133,3 +165,51 @@ std::vector RiaImageCompareReporter::getPngFilesInDirectory(const s return fileNames; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RiaImageCompareReporter::cssString() const +{ + std::string html; + + html += ""; + + return html; +} diff --git a/ApplicationCode/Application/RiaImageCompareReporter.h b/ApplicationCode/Application/RiaImageCompareReporter.h index 01afad29cd..e580a55a52 100644 --- a/ApplicationCode/Application/RiaImageCompareReporter.h +++ b/ApplicationCode/Application/RiaImageCompareReporter.h @@ -30,10 +30,14 @@ public: void addImageDirectoryComparisonSet(const std::string& title, const std::string& baseImageDir, const std::string& newImagesDir, const std::string& diffImagesDir ); void generateHTMLReport(const std::string& filenName); + void showInteractiveOnly(); + private: static std::vector getPngFilesInDirectory(const std::string& searchPath); + std::string cssString() const; +private: struct DirSet { DirSet(const std::string& title, const std::string& baseImageDir, const std::string& newImagesDir, const std::string& diffImagesDir ) @@ -50,5 +54,9 @@ private: }; std::vector m_directorySets; + + bool m_showOriginal; + bool m_showGenerated; + bool m_showInteractiveDiff; }; diff --git a/ApplicationCode/Application/RiaRegressionTest.cpp b/ApplicationCode/Application/RiaRegressionTest.cpp index 9fb9377b65..f05e1f28e6 100644 --- a/ApplicationCode/Application/RiaRegressionTest.cpp +++ b/ApplicationCode/Application/RiaRegressionTest.cpp @@ -32,6 +32,8 @@ RiaRegressionTest::RiaRegressionTest(void) CAF_PDM_InitFieldNoDefault(®ressionTestFolder, "regressionTestFolder", "Regression Test Folder", "", "", ""); regressionTestFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); + + CAF_PDM_InitField(&showInteractiveDiffImages, "showInteractiveDiffImages", false, "Interactive diff images", "", "", ""); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Application/RiaRegressionTest.h b/ApplicationCode/Application/RiaRegressionTest.h index daa941dc61..9462c626e9 100644 --- a/ApplicationCode/Application/RiaRegressionTest.h +++ b/ApplicationCode/Application/RiaRegressionTest.h @@ -35,6 +35,7 @@ public: public: caf::PdmField applicationWorkingFolder; caf::PdmField regressionTestFolder; + caf::PdmField showInteractiveDiffImages; protected: virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);