aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/QtGui/qtransform_test.py59
1 files changed, 58 insertions, 1 deletions
diff --git a/tests/QtGui/qtransform_test.py b/tests/QtGui/qtransform_test.py
index 450bf3292..8cac92711 100644
--- a/tests/QtGui/qtransform_test.py
+++ b/tests/QtGui/qtransform_test.py
@@ -1,5 +1,6 @@
import unittest
-from PySide.QtGui import QTransform
+from PySide.QtCore import QPointF
+from PySide.QtGui import QTransform, QPolygonF, QPolygonF
class QTransformTest(unittest.TestCase):
@@ -11,6 +12,62 @@ class QTransformTest(unittest.TestCase):
self.assert_(isinstance(ty, float))
self.assertEqual((tx, ty), values)
+ def testquadToQuad(self):
+ q1 = QPolygonF()
+ q1.append(QPointF(10.0, 10.0))
+ q1.append(QPointF(20.0, 10.0))
+ q1.append(QPointF(10.0, -10.0))
+ q1.append(QPointF(20.0, -10.0))
+
+ q2 = QPolygonF()
+ q2.append(QPointF(20.0, 20.0))
+ q2.append(QPointF(30.0, 20.0))
+ q2.append(QPointF(20.0, -20.0))
+ q2.append(QPointF(30.0, -20.0))
+
+ t1 = QTransform()
+ r1 = QTransform.quadToQuad(q1, q2, t1)
+ r2 = QTransform.quadToQuad(q1, q2)
+
+ self.assertTrue(r1)
+ self.assert_(r2)
+
+ self.assertEqual(t1, r2)
+
+ def testquadToSquare(self):
+ q1 = QPolygonF()
+ q1.append(QPointF(10.0, 10.0))
+ q1.append(QPointF(20.0, 10.0))
+ q1.append(QPointF(10.0, -10.0))
+ q1.append(QPointF(20.0, -10.0))
+
+ t1 = QTransform()
+ r1 = QTransform.quadToSquare(q1, t1)
+ r2 = QTransform.quadToSquare(q1)
+
+ self.assertTrue(r1)
+ self.assert_(r2)
+
+ self.assertEqual(t1, r2)
+
+
+ def testsquareToQuad(self):
+ q1 = QPolygonF()
+ q1.append(QPointF(10.0, 10.0))
+ q1.append(QPointF(20.0, 10.0))
+ q1.append(QPointF(10.0, -10.0))
+ q1.append(QPointF(20.0, -10.0))
+
+ t1 = QTransform()
+ r1 = QTransform.squareToQuad(q1, t1)
+ r2 = QTransform.squareToQuad(q1)
+
+ self.assertTrue(r1)
+ self.assert_(r2)
+
+ self.assertEqual(t1, r2)
+
+
if __name__ == "__main__":
unittest.main()