#3910 Unit test for reg exp validator

This commit is contained in:
Gaute Lindkvist
2018-12-19 13:57:37 +01:00
parent 10da90350f
commit 975cd15c32
4 changed files with 62 additions and 3 deletions

View File

@@ -237,6 +237,15 @@ void RimWellPathCompletions::setUnitSystemSpecificDefaults()
m_perforationCollection->setUnitSystemSpecificDefaults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QRegExp RimWellPathCompletions::wellNameForExportRegExp()
{
QRegExp rx("[\\w\\-\\_]{1,8}");
return rx;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -295,9 +304,8 @@ void RimWellPathCompletions::defineEditorAttribute(const caf::PdmFieldHandle* fi
caf::PdmUiLineEditorAttribute* lineEditorAttr = dynamic_cast<caf::PdmUiLineEditorAttribute*>(attribute);
if (field == &m_wellNameForExport && lineEditorAttr)
{
QRegExp rx("[\\w\\-\\_]{1,8}");
QRegExpValidator* validator = new QRegExpValidator(nullptr);
validator->setRegExp(rx);
validator->setRegExp(wellNameForExportRegExp());
lineEditorAttr->validator = validator;
}
}