mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-03 20:57:39 -06:00
#2554 Regression Test : Reorganize setting of current working folder
This commit is contained in:
parent
2e122d2ab3
commit
91428a028d
@ -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);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -99,6 +99,7 @@ public:
|
||||
bool parseArguments();
|
||||
|
||||
void executeRegressionTests(const QString& regressionTestPath, QStringList* testFilter = nullptr);
|
||||
void executeRegressionTests();
|
||||
|
||||
void setActiveReservoirView(Rim3dView*);
|
||||
Rim3dView* activeReservoirView();
|
||||
|
@ -30,8 +30,8 @@ CAF_PDM_SOURCE_INIT(RiaRegressionTest, "RiaRegressionTest");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaRegressionTest::RiaRegressionTest(void)
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault(&applicationWorkingFolder, "workingFolder", "Folder containing <b>compare</b>", "", "Location of compare tool from Image Magic suite", "");
|
||||
applicationWorkingFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
CAF_PDM_InitFieldNoDefault(&folderContainingCompareTool, "workingFolder", "Folder containing <b>compare</b>", "", "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<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
void readSettingsFromApplicationStore();
|
||||
|
||||
public:
|
||||
caf::PdmField<QString> applicationWorkingFolder;
|
||||
caf::PdmField<QString> folderContainingCompareTool;
|
||||
caf::PdmField<QString> regressionTestFolder;
|
||||
caf::PdmField<QString> testFilter;
|
||||
caf::PdmField<bool> showInteractiveDiffImages;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user