Salome HOME
[PythonAPI] added two tests and added transaction commit step in
[modules/shaper.git] / src / PythonAPI / Test / TestSketcherSetPerpendicular.py
1 import unittest
2 import model
3 from TestSketcher import SketcherTestCase
4
5 class SketcherSetPerpendicular(SketcherTestCase):   
6     def runTest(self):
7         l1 = self.sketch.addLine(0, 0, 0, 1)
8         l2 = self.sketch.addLine(0, 0, 1, 1)
9         self.sketch.setPerpendicular(l1.result(), l2.result())
10         model.do()
11         
12         dot_product = (l1.endPointData().x() - l1.startPointData().x()) * \
13                       (l2.endPointData().x() - l2.startPointData().x()) + \
14                       (l1.endPointData().y() - l1.startPointData().y()) * \
15                       (l2.endPointData().y() - l2.startPointData().y())
16         self.assertEqual(dot_product, 0.0)
17
18 if __name__ == "__main__":
19     unittest.main()