From bf29d8da1316982792c55094be9a958d9da3fb46 Mon Sep 17 00:00:00 2001 From: sbh Date: Mon, 28 Jul 2014 14:12:56 +0400 Subject: [PATCH] Length and Concidence constraints tests corrected. --- src/SketchPlugin/Test/TestConstraintConcidence.py | 11 +++++------ src/SketchPlugin/Test/TestConstraintLength.py | 9 +++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/SketchPlugin/Test/TestConstraintConcidence.py b/src/SketchPlugin/Test/TestConstraintConcidence.py index d14cb21e7..bca011f74 100644 --- a/src/SketchPlugin/Test/TestConstraintConcidence.py +++ b/src/SketchPlugin/Test/TestConstraintConcidence.py @@ -70,8 +70,9 @@ aDocument.finishOperation() # Link arc's end and line's start points with concidence constraint #========================================================================= aDocument.startOperation() -aCoincidenceConstraint = aDocument.addFeature("SketchConstraintCoincidence") -aConstraintData = aCoincidenceConstraint.data() +aConstraint = aDocument.addFeature("SketchConstraintCoincidence") +aSketchReflist.append(aConstraint) +aConstraintData = aConstraint.data() reflistA = aConstraintData.refattr("ConstraintEntityA") reflistB = aConstraintData.refattr("ConstraintEntityB") reflistA.setAttr(anArcEndPoint) @@ -93,10 +94,8 @@ aLineEndPoint.setValue(aLineEndPoint.x() + deltaX, aLineEndPoint.y() + deltaY) aDocument.finishOperation() # check that arc's points are moved also -print ("assert anArcEndPoint.x() == %d" % anArcEndPoint.x()) -print ("assert anArcEndPoint.y() == %d" % anArcEndPoint.y()) -print ("assert aLineStartPoint.x() == %d" % aLineStartPoint.x()) -print ("assert aLineStartPoint.y() == %d" % aLineStartPoint.y()) +assert (anArcEndPoint.x() == aLineStartPoint.x()) +assert (anArcEndPoint.y() == aLineStartPoint.y()) #========================================================================= # TODO: improve test # 1. remove constraint, move line to check that constraint are not applied diff --git a/src/SketchPlugin/Test/TestConstraintLength.py b/src/SketchPlugin/Test/TestConstraintLength.py index e9ebab020..fe4539c39 100644 --- a/src/SketchPlugin/Test/TestConstraintLength.py +++ b/src/SketchPlugin/Test/TestConstraintLength.py @@ -51,8 +51,9 @@ aDocument.finishOperation() # Make a constraint to keep the length #========================================================================= aDocument.startOperation() -aCoincidenceConstraint = aDocument.addFeature("SketchConstraintLength") -aConstraintData = aCoincidenceConstraint.data() +aConstraint = aDocument.addFeature("SketchConstraintLength") +aSketchReflist.append(aConstraint) +aConstraintData = aConstraint.data() aLength = aConstraintData.real("ConstraintValue") refattrA = aConstraintData.refattr("ConstraintEntityA") assert (not aLength.isInitialized()) @@ -78,10 +79,10 @@ aDocument.startOperation() aLineAStartPoint.setValue(aLineAStartPoint.x() + deltaX, aLineAStartPoint.y()) aDocument.finishOperation() -assert (aLineAStartPoint.x() == 40) assert (aLineAStartPoint.y() == 25) -assert (aLineAEndPoint.x() == 140) assert (aLineAEndPoint.y() == 25) +# length of the line is the same +assert (aLineAEndPoint.x() - aLineAStartPoint.x() == 100) #========================================================================= # TODO: improve test # 1. remove constraint, move line's start point to -- 2.39.2