RegressionTest: Improved application configuration

Disable read of faults (preferences)
Disable faults outside filters
Enable result mapping on faults
This commit is contained in:
Magne Sjaastad
2014-01-23 13:17:49 +01:00
parent e0b093d78d
commit dc040d673a
4 changed files with 35 additions and 8 deletions

View File

@@ -1528,8 +1528,20 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
// Open HTML report
QDesktopServices::openUrl(htmlReportFileName);
// Generate diff images
this->preferences()->resetToDefaults();
// Keep current preferences values to be able to restore when regression tests are completed
std::vector<QVariant> preferencesValues;
{
std::vector<caf::PdmFieldHandle*> fields;
this->preferences()->fields(fields);
for (size_t i = 0; i < fields.size(); i++)
{
QVariant v = fields[i]->uiValue();
preferencesValues.push_back(v);
}
}
// Set preferences to make sure regression tests behave identical
this->preferences()->configureForRegressionTests();
for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx)
{
@@ -1545,7 +1557,7 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
}
m_commandQueueLock.unlock();
regressionTestSetFixedSizeForAllViews();
regressionTestConfigureProject();
QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath(generatedFolderName);
saveSnapshotForAllViews(fullPathGeneratedFolder);
@@ -1570,6 +1582,18 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
closeProject(false);
}
// Restore preferences
{
std::vector<caf::PdmFieldHandle*> fields;
this->preferences()->fields(fields);
CVF_ASSERT(fields.size() == preferencesValues.size());
for (size_t i = 0; i < preferencesValues.size(); i++)
{
fields[i]->setValueFromUi(preferencesValues[i]);
}
}
}
}
@@ -1937,7 +1961,7 @@ void RiaApplication::executeRegressionTests(const QString& regressionTestPath)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::regressionTestSetFixedSizeForAllViews()
void RiaApplication::regressionTestConfigureProject()
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (!mainWnd) return;
@@ -1961,6 +1985,9 @@ void RiaApplication::regressionTestSetFixedSizeForAllViews()
// This size is set to match the regression test reference images
riv->viewer()->setFixedSize(1000, 745);
}
riv->faultCollection->showFaultsOutsideFilters.setValueFromUi(false);
riv->faultCollection->showResultsOnFaults.setValueFromUi(true);
}
}
}

View File

@@ -107,7 +107,7 @@ public:
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
void runRegressionTest(const QString& testRootPath);
void updateRegressionTest(const QString& testRootPath );
void regressionTestSetFixedSizeForAllViews();
void regressionTestConfigureProject();
void processNonGuiEvents();

View File

@@ -118,7 +118,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
/// This function is called as part of the regression test system to make sure the configuration
/// for regression tests is consistent
//--------------------------------------------------------------------------------------------------
void RiaPreferences::resetToDefaults()
void RiaPreferences::configureForRegressionTests()
{
useShaders = true;
showHud = false;
@@ -126,6 +126,6 @@ void RiaPreferences::resetToDefaults()
autocomputeSOIL = true;
autocomputeDepthRelatedProperties = true;
readFaultData = true;
readFaultData = false;
}

View File

@@ -33,7 +33,7 @@ public:
RiaPreferences(void);
virtual ~RiaPreferences(void);
void resetToDefaults();
void configureForRegressionTests();
public: // Pdm Fields
caf::PdmField<caf::AppEnum< RiaApplication::RINavigationPolicy > > navigationPolicy;