+# Copyright (C) 2014-2023 CEA, EDF
+#
+# 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
+#
+
"""
Test1966.py
Test case for issue #1966 "Sketch solving is 25 times slower between two studies with middle point"
import math
# convenient ratio of time moving point to time creating sketch
-MOVE_BUILD_RATIO = 0.1
+MOVE_BUILD_RATIO = 0.2
# tolerance for comparison of reals
TOLERANCE = 1.e-7
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
assert math.fabs(aPoint.x() - X) < TOLERANCE and math.fabs(aPoint.y() - Y) < TOLERANCE, "({0}, {1}) != ({2}, {3})".format(aPoint.x(), aPoint.y(), X, Y)
averageTime += movementTime
nbMoves += 1
-print "Movement average time: {0}".format(averageTime / nbMoves)
+print("Movement average time: {0}".format(averageTime / nbMoves))
#=========================================================================
# Change value of SketchConstraintAngle_6 and check execution time.
assert math.fabs(curAngle - ang) < TOLERANCE, "angle {0} != {1} expected".format(curAngle, ang)
averageTime += movementTime
nbMoves += 1
-print "Changing angle average time: {0}".format(averageTime / nbMoves)
+print("Changing angle average time: {0}".format(averageTime / nbMoves))
model.end()