Salome HOME
Cosmetics. Move XML files to the separate folder inside a corresponding project in VS.
[modules/shaper.git] / src / SketchPlugin / Test / Test1673.py
index 550515673408f2d0383e9578592aa3cebb1c2e32..4caa894e70e0d405f94c3f3ad2a3904e1734c7f3 100644 (file)
@@ -1,3 +1,22 @@
+# Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
 """
     Test1673.py
     Test case for issue #1673 "Drag and drop the extremity of an arc is too slow"
@@ -228,13 +247,16 @@ SketchConstraintVertical_11.setName("SketchConstraintVertical_12")
 model.do()
 
 sketchTime = timer() - sketchTime
-print "Sketch creation time: {0}".format(sketchTime)
+print("Sketch creation time: {0}".format(sketchTime))
 expectedTime = MOVE_BUILD_RATIO * sketchTime
 averageTime = 0
 nbMoves = 0
 
-# Sketch is overconstrained, check the message
-assert Sketch_1.solverError().value() != "", "FAILED: Sketch should report over-constrained situation"
+# Two vertical constraints: due to #1889 the sketch is invalid now, not overconstrained
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(not aFactory.validate(SketchConstraintVertical_10.feature()))
+#assert Sketch_1.solverError().value() != "", "FAILED: Sketch should report over-constrained situation"
 
 # Remove duplicated Vertical constraints
 Part_1_doc.removeFeature(SketchConstraintVertical_10.feature())
@@ -260,14 +282,13 @@ for ang in range(0, 50):
     aEndPoint.setValue(X, Y)
     model.do()
     movementTime = timer() - movementTime
-    print movementTime
     assert movementTime < expectedTime, "Time to move point {0} is greater than expected {1}".format(movementTime, expectedTime)
     assert math.fabs(aEndPoint.x() - X) < TOLERANCE and math.fabs(aEndPoint.y() - Y) < TOLERANCE, "({0}, {1}) != ({2}, {3})".format(aEndPoint.x(), aEndPoint.y(), X, Y)
     averageTime += movementTime
     nbMoves += 1
     aDeltaX = aEndPoint.x() - aCenter.x()
-    aDeltaY - aEndPoint.y() - aCenter.y()
-print "Movement average time: {0}".format(averageTime / nbMoves)
+    aDeltaY = aEndPoint.y() - aCenter.y()
+print("Movement average time: {0}".format(averageTime / nbMoves))
 
 model.end()