Salome HOME
7c184c5c52f7261fee2bd9eeb6504b4cecfb8d06
[modules/shaper.git] / src / ConstructionAPI / Test / TestPoint.py
1 import unittest
2
3 import ModelAPI
4 import ConstructionAPI
5
6 class PointTestCase(unittest.TestCase):
7
8     def setUp(self):
9         self.session = ModelAPI.ModelAPI_Session.get()
10         self.doc = self.session.moduleDocument()
11         self.session.startOperation()
12         self.feature = self.doc.addFeature("Point")
13         self.feature.execute()
14         self.session.finishOperation()
15
16     def tearDown(self):
17         self.session.closeAll()
18
19     def test_ConstructorWithValues(self):
20         point = ConstructionAPI.ConstructionAPI_Point(self.feature, 10, "20", "x + 30")
21         self.assertEqual(10, point.x().value())
22         self.assertEqual("20", point.y().text())
23         self.assertEqual("x + 30", point.z().text())
24
25     def test_setValue(self):
26         point = ConstructionAPI.ConstructionAPI_Point(self.feature)
27         self.assertEqual(0, point.x().value())
28         self.assertEqual(0, point.y().value())
29         self.assertEqual(0, point.z().value())
30
31         point.setPoint(10, "20", "x + 30")
32         self.assertEqual(10, point.x().value())
33         self.assertEqual("20", point.y().text())
34         self.assertEqual("x + 30", point.z().text())
35
36 if __name__ == "__main__":
37     unittest.main()