-
Notifications
You must be signed in to change notification settings - Fork 207
/
linef2d_test.py
41 lines (37 loc) · 1.88 KB
/
linef2d_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from pylondataprocessingtestcase import PylonDataProcessingTestCase
from pypylon import pylondataprocessing
import unittest
class LineF2DTestSuite(PylonDataProcessingTestCase):
def test_init(self):
testee1 = pylondataprocessing.LineF2D()
self.assertEqual(testee1.PointA.X, 0.0)
self.assertEqual(testee1.PointA.Y, 0.0)
self.assertEqual(testee1.PointB.X, 0.0)
self.assertEqual(testee1.PointB.Y, 0.0)
testee2 = pylondataprocessing.LineF2D(1.2, 3.4, 5.6, 7.8)
self.assertEqual(testee2.PointA.X, 1.2)
self.assertEqual(testee2.PointA.Y, 3.4)
self.assertEqual(testee2.PointB.X, 5.6)
self.assertEqual(testee2.PointB.Y, 7.8)
testee3 = pylondataprocessing.LineF2D(pylondataprocessing.PointF2D(1.22, 3.42), pylondataprocessing.PointF2D(5.62, 7.82))
self.assertEqual(testee3.PointA.X, 1.22)
self.assertEqual(testee3.PointA.Y, 3.42)
self.assertEqual(testee3.PointB.X, 5.62)
self.assertEqual(testee3.PointB.Y, 7.82)
testee4 = pylondataprocessing.LineF2D(testee3)
self.assertEqual(testee4.PointA.X, 1.22)
self.assertEqual(testee4.PointA.Y, 3.42)
self.assertEqual(testee4.PointB.X, 5.62)
self.assertEqual(testee4.PointB.Y, 7.82)
#PointA returns _PointA with a reference to its parent added
#_PointA holds a pointer to the C++ member SLineF2D::PointA
#LineF2D must not be released while using _PointA
self.assertEqual(testee4.PointA.X, testee4._PointA.X)
self.assertEqual(testee4.PointB.X, testee4._PointB.X)
testee4.PointB.Y = 1234.5
self.assertEqual(testee4.PointB.Y, 1234.5)
def test_str(self):
testee = pylondataprocessing.LineF2D(1.2, 3.4, 5.6, 7.8)
self.assertEqual(str(testee), "PointA: (X = 1.2; Y = 3.4); PointB: (X = 5.6; Y = 7.8)")
if __name__ == "__main__":
unittest.main()