aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/QtGui/qpolygonf_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/tests/QtGui/qpolygonf_test.py')
-rw-r--r--sources/pyside2/tests/QtGui/qpolygonf_test.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/sources/pyside2/tests/QtGui/qpolygonf_test.py b/sources/pyside2/tests/QtGui/qpolygonf_test.py
index 023af533d..d39b44827 100644
--- a/sources/pyside2/tests/QtGui/qpolygonf_test.py
+++ b/sources/pyside2/tests/QtGui/qpolygonf_test.py
@@ -26,24 +26,34 @@
##
#############################################################################
+import os
+import sys
import unittest
-from PySide2.QtCore import *
-from PySide2.QtGui import *
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide2.QtCore import QPoint, QPointF
+from PySide2.QtGui import QPolygon, QPolygonF
+
class QPolygonFNotIterableTest(unittest.TestCase):
"""Test if a QPolygonF is iterable"""
- def testIt(self):
- p = QPolygonF(4)
- self.assertEqual(len(p), 4)
+ def testIt(self):
+ points = []
for i in range(0, 4):
- p[i] = QPointF(float(i), float(i))
+ points.append(QPointF(float(i), float(i)))
+
+ p = QPolygonF(points)
+ self.assertEqual(len(p), 4)
i = 0
for point in p:
self.assertEqual(int(point.x()), i)
self.assertEqual(int(point.y()), i)
- i += 1;
+ i += 1
def testPolygonShiftOperators(self):
p = QPolygon()
@@ -51,5 +61,6 @@ class QPolygonFNotIterableTest(unittest.TestCase):
p << QPoint(10, 20) << QPoint(20, 30) << [QPoint(20, 30), QPoint(40, 50)]
self.assertEqual(len(p), 4)
+
if __name__ == '__main__':
unittest.main()