Salome HOME
Issue #2130: arc is done not as desired
[modules/shaper.git] / src / SketchPlugin / Test / TestConstraintHorizontal.py
index 337315858e173b5c95ad02c8d5e252ffb106ee31..fa7c6cc04b73c3b40fc8ba69f85e6abf4294a169 100644 (file)
@@ -4,11 +4,13 @@
         
     SketchPlugin_ConstraintHorizontal
         static const std::string MY_CONSTRAINT_HORIZONTAL_ID("SketchConstraintHorizontal");
-        data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::type());
+        data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId());
 
 """
 from GeomDataAPI import *
 from ModelAPI import *
+from salome.shaper import model
+
 #=========================================================================
 # Initialization of the test
 #=========================================================================
@@ -22,13 +24,11 @@ aDocument = aSession.moduleDocument()
 #=========================================================================
 aSession.startOperation()
 aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
 origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
@@ -42,6 +42,7 @@ aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint"))
 aLineStartPoint.setValue(0., 15.)
 aLineEndPoint.setValue(20., 25.)
 aSession.finishOperation()
+assert(model.dof(aSketchFeature) == 4)
 #=========================================================================
 # Assign horizontal constraint for a line
 #=========================================================================
@@ -54,6 +55,7 @@ refattrA.setObject(aResult)
 aHorizontalConstraint.execute()
 aSession.finishOperation()
 assert(aLineStartPoint.y() == aLineEndPoint.y())
+assert(model.dof(aSketchFeature) == 3)
 #=========================================================================
 # Move one of boundary points of a line
 #=========================================================================
@@ -63,6 +65,7 @@ aLineStartPoint.setValue(aLineStartPoint.x() + deltaX,
                          aLineStartPoint.y() + deltaY)
 aSession.finishOperation()
 assert(aLineStartPoint.y() == aLineEndPoint.y())
+assert(model.dof(aSketchFeature) == 3)
 #=========================================================================
 # Move other boundary point of a line
 #=========================================================================
@@ -73,6 +76,9 @@ aLineEndPoint.setValue(aLineEndPoint.x() + deltaX,
                        aLineEndPoint.y() + deltaY)
 aSession.finishOperation()
 assert(aLineStartPoint.y() == aLineEndPoint.y())
+assert(model.dof(aSketchFeature) == 3)
 #=========================================================================
 # End of test
 #=========================================================================
+
+assert(model.checkPythonDump())