diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 1370d9f2de..ffe32f65e9 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -28,6 +28,7 @@ #include "RiaLogging.h" #include "RiaPreferences.h" #include "RiaProjectModifier.h" +#include "RiaRegressionTest.h" #include "RiaSocketServer.h" #include "RiaVersionInfo.h" #include "RiaViewRedrawScheduler.h" @@ -1994,6 +1995,18 @@ void RiaApplication::runRegressionTest(const QString& testRootPath, QStringList* { m_runningRegressionTests = true; + RiaRegressionTest regressionTestConfig; + regressionTestConfig.readSettingsFromApplicationStore(); + + QString currentApplicationPath = QDir::currentPath(); + if (!regressionTestConfig.folderContainingCompareTool().isEmpty()) + { + // Windows Only : The image compare tool requires current working directory to be at the folder + // containing the image compare tool + + QDir::setCurrent(regressionTestConfig.folderContainingCompareTool()); + } + QString generatedFolderName = RegTestNames::generatedFolderName; QString diffFolderName = RegTestNames::diffFolderName; QString baseFolderName = RegTestNames::baseFolderName; @@ -2189,6 +2202,8 @@ void RiaApplication::runRegressionTest(const QString& testRootPath, QStringList* RiaLogging::info("\n"); logInfoTextWithTimeInSeconds(timeStamp, "Completed regression tests"); + QDir::setCurrent(currentApplicationPath); + m_runningRegressionTests = false; } @@ -2449,6 +2464,20 @@ void RiaApplication::executeRegressionTests(const QString& regressionTestPath, Q } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaApplication::executeRegressionTests() +{ + RiaRegressionTest testConfig; + testConfig.readSettingsFromApplicationStore(); + + QString testPath = testConfig.regressionTestFolder(); + QStringList testFilter = testConfig.testFilter().split(";", QString::SkipEmptyParts); + + executeRegressionTests(testPath, &testFilter); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Application/RiaApplication.h b/ApplicationCode/Application/RiaApplication.h index 04acc543f6..17d0bae7f9 100644 --- a/ApplicationCode/Application/RiaApplication.h +++ b/ApplicationCode/Application/RiaApplication.h @@ -99,6 +99,7 @@ public: bool parseArguments(); void executeRegressionTests(const QString& regressionTestPath, QStringList* testFilter = nullptr); + void executeRegressionTests(); void setActiveReservoirView(Rim3dView*); Rim3dView* activeReservoirView(); diff --git a/ApplicationCode/Application/Tools/RiaRegressionTest.cpp b/ApplicationCode/Application/Tools/RiaRegressionTest.cpp index 95ea9d8f1f..15bfa02db9 100644 --- a/ApplicationCode/Application/Tools/RiaRegressionTest.cpp +++ b/ApplicationCode/Application/Tools/RiaRegressionTest.cpp @@ -30,8 +30,8 @@ CAF_PDM_SOURCE_INIT(RiaRegressionTest, "RiaRegressionTest"); //-------------------------------------------------------------------------------------------------- RiaRegressionTest::RiaRegressionTest(void) { - CAF_PDM_InitFieldNoDefault(&applicationWorkingFolder, "workingFolder", "Folder containing compare", "", "Location of compare tool from Image Magic suite", ""); - applicationWorkingFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); + CAF_PDM_InitFieldNoDefault(&folderContainingCompareTool, "workingFolder", "Folder containing compare", "", "Location of compare tool from Image Magic suite", ""); + folderContainingCompareTool.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); CAF_PDM_InitFieldNoDefault(®ressionTestFolder, "regressionTestFolder", "Regression Test Folder", "", "", ""); regressionTestFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); @@ -71,7 +71,7 @@ void RiaRegressionTest::readSettingsFromApplicationStore() //-------------------------------------------------------------------------------------------------- void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) { - if (field == &applicationWorkingFolder || field == ®ressionTestFolder) + if (field == &folderContainingCompareTool || field == ®ressionTestFolder) { caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast(attribute); if (myAttr) diff --git a/ApplicationCode/Application/Tools/RiaRegressionTest.h b/ApplicationCode/Application/Tools/RiaRegressionTest.h index b46d6f93a1..2a35031084 100644 --- a/ApplicationCode/Application/Tools/RiaRegressionTest.h +++ b/ApplicationCode/Application/Tools/RiaRegressionTest.h @@ -36,7 +36,7 @@ public: void readSettingsFromApplicationStore(); public: - caf::PdmField applicationWorkingFolder; + caf::PdmField folderContainingCompareTool; caf::PdmField regressionTestFolder; caf::PdmField testFilter; caf::PdmField showInteractiveDiffImages; diff --git a/ApplicationCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.cpp index fad2f14568..6d62294ae9 100644 --- a/ApplicationCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.cpp +++ b/ApplicationCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.cpp @@ -41,14 +41,7 @@ bool RicLaunchRegressionTestsFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicLaunchRegressionTestsFeature::onActionTriggered(bool isChecked) { - RiaRegressionTest regTestConfig; - - caf::PdmSettings::readFieldsFromApplicationStore(®TestConfig); - - QStringList testFilter = regTestConfig.testFilter().split(";", QString::SkipEmptyParts); - - // Launch regression test using the current test folder and test filter - RiaApplication::instance()->executeRegressionTests(regTestConfig.regressionTestFolder, &testFilter); + RiaApplication::instance()->executeRegressionTests(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index 4c33cb1426..63e7e581bd 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -1726,16 +1726,8 @@ void RiuMainWindow::slotShowRegressionTestDialog() // Write preferences using QSettings and apply them to the application regTestConfig.writeSettingsToApplicationStore(); - QString currentApplicationPath = QDir::currentPath(); - - QDir::setCurrent(regTestConfig.applicationWorkingFolder); - - QStringList testFilter = regTestConfig.testFilter().split(";", QString::SkipEmptyParts); - RiaApplication* app = RiaApplication::instance(); - app->executeRegressionTests(regTestConfig.regressionTestFolder, &testFilter); - - QDir::setCurrent(currentApplicationPath); + app->executeRegressionTests(); } }