X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FTest%2FTestConstraintAngle.py;h=0d88ec14f1816e3bd9a9d657ad84045d1059729b;hb=21a0c85b52bb93f94680e2342370764e6510e387;hp=3070252604dc486fe525174beb2565cb5dcd841a;hpb=3bae3a116dfb567e8c89830bda607e6b2b6c0174;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/Test/TestConstraintAngle.py b/src/SketchPlugin/Test/TestConstraintAngle.py index 307025260..0d88ec14f 100644 --- a/src/SketchPlugin/Test/TestConstraintAngle.py +++ b/src/SketchPlugin/Test/TestConstraintAngle.py @@ -13,8 +13,8 @@ """ from GeomDataAPI import * from ModelAPI import * -import os import math +from salome.shaper import model #========================================================================= # Auxiliary functions @@ -81,6 +81,7 @@ aEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) aStartPoint.setValue(-10., 15.) aEndPoint.setValue(80., 50.) aSession.finishOperation() +assert (model.dof(aSketchFeature) == 8) #========================================================================= # Make a constraint to keep the angle #========================================================================= @@ -108,6 +109,7 @@ assert (anAngleVal.isInitialized()) assert (refattrA.isInitialized()) assert (refattrB.isInitialized()) assert (angle(aSketchLineA, aSketchLineB) == ANGLE_DEGREE) +assert (model.dof(aSketchFeature) == 7) #========================================================================= # Move line, check that angle is constant #========================================================================= @@ -117,6 +119,7 @@ aStartPoint.setValue(0., -30.) aConstraint.execute() aSession.finishOperation() assert (angle(aSketchLineA, aSketchLineB) == ANGLE_DEGREE) +assert (model.dof(aSketchFeature) == 7) #========================================================================= # Change angle value and check the lines are moved #========================================================================= @@ -126,6 +129,7 @@ anAngleVal.setValue(NEW_ANGLE_DEGREE) aConstraint.execute() aSession.finishOperation() assert (angle(aSketchLineA, aSketchLineB) == NEW_ANGLE_DEGREE) +assert (model.dof(aSketchFeature) == 7) #========================================================================= # Change angle type #========================================================================= @@ -137,17 +141,21 @@ aSession.startOperation() aConstraint.integer("AngleType").setValue(ANGLE_BACKWARD) aSession.finishOperation() assert (angle(aSketchLineA, aSketchLineB) == NEW_ANGLE_DEGREE) +assert (model.dof(aSketchFeature) == 7) #========================================================================= -# TODO: improve test -# 1. remove constraint, move line's start point to -# check that constraint are not applied -# 2. check constrained distance between: -# * point and line -# * two lines +# Remove constraint, move line's point to check the constraint is not applied #========================================================================= +aSession.startOperation() +aDocument.removeFeature(aConstraint) +aSession.finishOperation() +assert (model.dof(aSketchFeature) == 8) +aSession.startOperation() +aStartPoint.setValue(-30., 0.) +aSession.finishOperation() +assert (angle(aSketchLineA, aSketchLineB) != NEW_ANGLE_DEGREE) +assert (model.dof(aSketchFeature) == 8) #========================================================================= # End of test #========================================================================= -import model assert(model.checkPythonDump())