Salome HOME
Added unit test for the issue #1806
authormpv <mpv@opencascade.com>
Wed, 23 Nov 2016 11:35:45 +0000 (14:35 +0300)
committermpv <mpv@opencascade.com>
Wed, 23 Nov 2016 11:35:45 +0000 (14:35 +0300)
src/ParametersPlugin/CMakeLists.txt
src/ParametersPlugin/Test/Test1806.py [new file with mode: 0644]

index d57d1d4ecd3b7ee0e3211ba79179d08d33fe917a..e5c32be9e745d355b3c7a9625326984d91e057e0 100644 (file)
@@ -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 (file)
index 0000000..096a965
--- /dev/null
@@ -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())