X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FTest%2FTestConstraintDistanceHorizontal.py;h=29cfb568025fcc4482f30f47de0d864e47ccf611;hb=aa7ce8bd36a44173fd76fefa189d8b6123d76ad2;hp=24278747112d3c0b53efa128acf1c87452511983;hpb=7074394f8f08413d885f63be01df6bd5007b868c;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/Test/TestConstraintDistanceHorizontal.py b/src/SketchPlugin/Test/TestConstraintDistanceHorizontal.py index 242787471..29cfb5680 100644 --- a/src/SketchPlugin/Test/TestConstraintDistanceHorizontal.py +++ b/src/SketchPlugin/Test/TestConstraintDistanceHorizontal.py @@ -125,7 +125,10 @@ while d >= -30.: DISTANCE1 = d aDistance.setValue(DISTANCE1) aSession.finishOperation() - assert math.fabs(horizontalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1) + if DISTANCE1 == 0: + assert(aHDist1.error() != "") + else: + assert math.fabs(horizontalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1) d += dStep assert (model.dof(aSketchFeature) == 3) @@ -158,9 +161,12 @@ while d >= -50.: DISTANCE2 = d aDistance.setValue(DISTANCE2) aSession.finishOperation() - assert math.fabs(horizontalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(anExtCoords, aPoint1Coords), DISTANCE2) - assert math.fabs(aPoint1Coords.x() - DISTANCE2) < 1.e-5, "Wrong point coordinates ({}, {}), expected x = {}".format(aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2) - assert math.fabs(horizontalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1) + if DISTANCE2 == 0: + assert(aHDist2.error() != "") + else: + assert math.fabs(horizontalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(anExtCoords, aPoint1Coords), DISTANCE2) + assert math.fabs(aPoint1Coords.x() - DISTANCE2) < 1.e-5, "Wrong point coordinates ({}, {}), expected x = {}".format(aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2) + assert math.fabs(horizontalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1) d += dStep assert (model.dof(aSketchFeature) == 2) @@ -217,7 +223,10 @@ while d >= -50.: DISTANCE3 = d aDistance.setValue(DISTANCE3) aSession.finishOperation() - assert math.fabs(horizontalDistance(aStartPoint, aEndPoint) - DISTANCE3) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(aStartPoint, aEndPoint), DISTANCE3) + if DISTANCE3 == 0: + assert(aHDist3.error() != "") + else: + assert math.fabs(horizontalDistance(aStartPoint, aEndPoint) - DISTANCE3) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(aStartPoint, aEndPoint), DISTANCE3) d += dStep assert (model.dof(aSketchFeature) == 6)