From: mpv Date: Wed, 23 Nov 2016 11:35:45 +0000 (+0300) Subject: Added unit test for the issue #1806 X-Git-Tag: V_2.6.0~68 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=be09d02207dd92533e4b2977f21085768fda0c85;p=modules%2Fshaper.git Added unit test for the issue #1806 --- diff --git a/src/ParametersPlugin/CMakeLists.txt b/src/ParametersPlugin/CMakeLists.txt index d57d1d4ec..e5c32be9e 100644 --- a/src/ParametersPlugin/CMakeLists.txt +++ b/src/ParametersPlugin/CMakeLists.txt @@ -77,4 +77,5 @@ INSTALL(FILES ${QM_RESOURCES} DESTINATION ${SHAPER_INSTALL_QM_RESOURCES}) ADD_UNIT_TESTS(TestParameterCreation.py TestParameterRename.py TestParameterChangeValue.py + Test1806.py ) diff --git a/src/ParametersPlugin/Test/Test1806.py b/src/ParametersPlugin/Test/Test1806.py new file mode 100644 index 000000000..096a9657b --- /dev/null +++ b/src/ParametersPlugin/Test/Test1806.py @@ -0,0 +1,51 @@ +""" + Test1806.py + Unit test for testing the expression evaluation even no parameters are created + +""" +#========================================================================= +# Initialization of the test +#========================================================================= +from ModelAPI import * +from GeomDataAPI import * + +__updated__ = "2016-11-23" + +aSession = ModelAPI_Session.get() +aPartSet = aSession.moduleDocument() + +#========================================================================= +# Create a part +#========================================================================= +aSession.startOperation() +aPartFeature = aPartSet.addFeature("Part") +aSession.finishOperation() + +aPart = aSession.activeDocument() +#========================================================================= +# Create a sketch with a line and length +#========================================================================= +aSession.startOperation() +aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) +aXOYPlane = objectToResult(aPartSet.objectByName("Construction", "XOY")) +aSketchFeature.selection("External").setValue(aXOYPlane, None) +# Create lines +aLine = aSketchFeature.addFeature("SketchLine") +aStart = geomDataAPI_Point2D(aLine.attribute("StartPoint")) +aStart.setValue(0, 0) +anEnd = geomDataAPI_Point2D(aLine.attribute("EndPoint")) +anEnd.setValue(200, 0) + +aDistance = aSketchFeature.addFeature("SketchConstraintDistance") +aDistance.refattr("ConstraintEntityA").setAttr(aStart) +aDistance.refattr("ConstraintEntityB").setAttr(anEnd) +aDistance.real("ConstraintValue").setText("25/2") + +aSession.finishOperation() + +assert(aDistance.real("ConstraintValue").value() == 12.5) +#========================================================================= +# End of test +#========================================================================= +import model +assert(model.checkPythonDump())