From 7b324f512f9ac39049b59cd5c7dc8b53c1077951 Mon Sep 17 00:00:00 2001 From: spo Date: Wed, 15 Jun 2016 11:55:14 +0300 Subject: [PATCH] Fix tests for constraints Fillet, Horizontal, Length, Parallel, Perpendicular, Rigid, Vertical --- src/PythonAPI/Test/TestSketcherSetFillet.py | 4 ++-- src/PythonAPI/Test/TestSketcherSetHorizontal.py | 4 ++-- src/PythonAPI/Test/TestSketcherSetLength.py | 6 +++--- src/PythonAPI/Test/TestSketcherSetParallel.py | 4 ++-- src/PythonAPI/Test/TestSketcherSetPerpendicular.py | 4 ++-- src/PythonAPI/Test/TestSketcherSetRadius.py | 6 +++--- src/PythonAPI/Test/TestSketcherSetRigid.py | 2 +- src/PythonAPI/Test/TestSketcherSetVertical.py | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/PythonAPI/Test/TestSketcherSetFillet.py b/src/PythonAPI/Test/TestSketcherSetFillet.py index fc5211b36..95b3d3998 100644 --- a/src/PythonAPI/Test/TestSketcherSetFillet.py +++ b/src/PythonAPI/Test/TestSketcherSetFillet.py @@ -2,12 +2,12 @@ import unittest import model from TestSketcher import SketcherTestCase -class SketcherSetFillet(SketcherTestCase): +class SketcherSetFillet(SketcherTestCase): def runTest(self): l1 = self.sketch.addLine(0, 0, 0, 1) l2 = self.sketch.addLine(0, 1, 1, 1) self.sketch.setCoincident(l1.endPoint(), l2.startPoint()) - self.sketch.setFillet(l1.endPoint(), 10.0) + self.sketch.setFillet([l1.endPoint()], 10.0) model.do() if __name__ == "__main__": diff --git a/src/PythonAPI/Test/TestSketcherSetHorizontal.py b/src/PythonAPI/Test/TestSketcherSetHorizontal.py index 1f0ee545c..68f23d352 100644 --- a/src/PythonAPI/Test/TestSketcherSetHorizontal.py +++ b/src/PythonAPI/Test/TestSketcherSetHorizontal.py @@ -2,10 +2,10 @@ import unittest import model from TestSketcher import SketcherTestCase -class SketcherSetHorizontal(SketcherTestCase): +class SketcherSetHorizontal(SketcherTestCase): def runTest(self): line = self.sketch.addLine(0, 0, 1, 1) - self.sketch.setHorizontal(line.result()) + self.sketch.setHorizontal(line) model.do() self.assertEqual(line.startPoint().y(), line.endPoint().y()) diff --git a/src/PythonAPI/Test/TestSketcherSetLength.py b/src/PythonAPI/Test/TestSketcherSetLength.py index bbbcab6dd..6a4997c80 100644 --- a/src/PythonAPI/Test/TestSketcherSetLength.py +++ b/src/PythonAPI/Test/TestSketcherSetLength.py @@ -4,11 +4,11 @@ import math import TestSketcher from TestSketcher import SketcherTestCase -class SketcherSetLength(SketcherTestCase): +class SketcherSetLength(SketcherTestCase): def runTest(self): # Set the constraint line = self.sketch.addLine(0, 0, 0, 1) - self.sketch.setLength(line.result(), 25.0) + self.sketch.setLength(line, 25.0) # Commit the transaction model.do() # Check the result @@ -17,6 +17,6 @@ class SketcherSetLength(SketcherTestCase): math.pow((line.endPoint().y() - line.startPoint().y()), 2) ) self.assertAlmostEqual(length, 25.0, delta=TestSketcher.DELTA) - + if __name__ == "__main__": unittest.main() \ No newline at end of file diff --git a/src/PythonAPI/Test/TestSketcherSetParallel.py b/src/PythonAPI/Test/TestSketcherSetParallel.py index 75c37ecc3..9e440ab32 100644 --- a/src/PythonAPI/Test/TestSketcherSetParallel.py +++ b/src/PythonAPI/Test/TestSketcherSetParallel.py @@ -2,11 +2,11 @@ import unittest import model from TestSketcher import SketcherTestCase -class SketcherSetParallel(SketcherTestCase): +class SketcherSetParallel(SketcherTestCase): def runTest(self): l1 = self.sketch.addLine(0, 0, 0, 1) l2 = self.sketch.addLine(0, 1, 1, 1) - self.sketch.setParallel(l1.result(), l2.result()) + self.sketch.setParallel(l1, l2) model.do() if __name__ == "__main__": diff --git a/src/PythonAPI/Test/TestSketcherSetPerpendicular.py b/src/PythonAPI/Test/TestSketcherSetPerpendicular.py index 766fc5057..cc4e3e795 100644 --- a/src/PythonAPI/Test/TestSketcherSetPerpendicular.py +++ b/src/PythonAPI/Test/TestSketcherSetPerpendicular.py @@ -8,9 +8,9 @@ class SketcherSetPerpendicular(SketcherTestCase): def runTest(self): l1 = self.sketch.addLine(0, 0, 0, 1) l2 = self.sketch.addLine(0, 0, 1, 1) - self.sketch.setPerpendicular(l1.result(), l2.result()) + self.sketch.setPerpendicular(l1, l2) model.do() - + dot_product = (l1.endPoint().x() - l1.startPoint().x()) * \ (l2.endPoint().x() - l2.startPoint().x()) + \ (l1.endPoint().y() - l1.startPoint().y()) * \ diff --git a/src/PythonAPI/Test/TestSketcherSetRadius.py b/src/PythonAPI/Test/TestSketcherSetRadius.py index 0cb6ad9a0..7f40c547b 100644 --- a/src/PythonAPI/Test/TestSketcherSetRadius.py +++ b/src/PythonAPI/Test/TestSketcherSetRadius.py @@ -2,13 +2,13 @@ import unittest import model from TestSketcher import SketcherTestCase -class SketcherSetRadius(SketcherTestCase): +class SketcherSetRadius(SketcherTestCase): def test_set_radius(self): circle = self.sketch.addCircle(0, 10, 20) self.sketch.setRadius(circle.result(), 30) model.do() self.assertEqual(circle.radius(), 30.0) - + def test_modify_radius(self): circle = self.sketch.addCircle(0, 10, 20) radius_constraint = self.sketch.setRadius(circle.result(), 30) @@ -16,6 +16,6 @@ class SketcherSetRadius(SketcherTestCase): self.sketch.setValue(radius_constraint, 20) model.do() self.assertEqual(circle.radius(), 20.0) - + if __name__ == "__main__": unittest.main(verbosity=2) \ No newline at end of file diff --git a/src/PythonAPI/Test/TestSketcherSetRigid.py b/src/PythonAPI/Test/TestSketcherSetRigid.py index 12e946f03..f47c10adb 100644 --- a/src/PythonAPI/Test/TestSketcherSetRigid.py +++ b/src/PythonAPI/Test/TestSketcherSetRigid.py @@ -5,7 +5,7 @@ from TestSketcher import SketcherTestCase class SketcherSetRigid(SketcherTestCase): def runTest(self): circle = self.sketch.addCircle(0, 10, 20) - self.sketch.setRigid(circle.result()) + self.sketch.setRigid(circle) model.do() circle.setCenter(0, 0) model.do() diff --git a/src/PythonAPI/Test/TestSketcherSetVertical.py b/src/PythonAPI/Test/TestSketcherSetVertical.py index 5128c5b6b..3a4be2488 100644 --- a/src/PythonAPI/Test/TestSketcherSetVertical.py +++ b/src/PythonAPI/Test/TestSketcherSetVertical.py @@ -2,10 +2,10 @@ import unittest import model from TestSketcher import SketcherTestCase -class SketcherSetVertical(SketcherTestCase): +class SketcherSetVertical(SketcherTestCase): def runTest(self): line = self.sketch.addLine(0, 0, 1, 1) - self.sketch.setVertical(line.result()) + self.sketch.setVertical(line) model.do() self.assertEqual(line.startPoint().x(), line.endPoint().x()) -- 2.39.2