summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/QtGui/CMakeLists.txt3
-rw-r--r--tests/QtGui/deepcopy_test.py93
2 files changed, 95 insertions, 1 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 350948b..f40ebfd 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -1,6 +1,7 @@
#Keep this in alphabetical sort
PYSIDE_TEST(api2_test.py)
+PYSIDE_TEST(add_action_test.py)
PYSIDE_TEST(bug_172.py)
PYSIDE_TEST(bug_243.py)
PYSIDE_TEST(bug_300_test.py)
@@ -10,8 +11,8 @@ PYSIDE_TEST(bug_338.py)
PYSIDE_TEST(bug_363.py)
PYSIDE_TEST(bug_367.py)
PYSIDE_TEST(bug_389.py)
-PYSIDE_TEST(add_action_test.py)
PYSIDE_TEST(customproxywidget_test.py)
+PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
PYSIDE_TEST(grandparent_method_test.py)
PYSIDE_TEST(hashabletype_test.py)
diff --git a/tests/QtGui/deepcopy_test.py b/tests/QtGui/deepcopy_test.py
new file mode 100644
index 0000000..2f8f7de
--- /dev/null
+++ b/tests/QtGui/deepcopy_test.py
@@ -0,0 +1,93 @@
+
+import unittest
+from copy import deepcopy
+
+from PySide.QtCore import QPoint
+from PySide.QtGui import QMatrix
+from PySide.QtGui import QMatrix2x2, QMatrix2x3, QMatrix2x4
+from PySide.QtGui import QMatrix3x2, QMatrix3x3, QMatrix3x4
+from PySide.QtGui import QMatrix4x2, QMatrix4x3, QMatrix4x4
+from PySide.QtGui import QVector2D, QVector3D, QVector4D
+from PySide.QtGui import QColor, QTransform, QKeySequence, QQuaternion
+from PySide.QtGui import QPolygon
+
+class DeepCopyHelper:
+ def testCopy(self):
+ copy = deepcopy([self.original])[0]
+ self.assert_(copy is not self.original)
+ self.assertEqual(copy, self.original)
+
+class QColorDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QColor("red")
+
+class QTransformDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8)
+
+class QKeySequenceDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QKeySequence("Ctrl+P")
+
+class QQuaternionDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QQuaternion(1, 2, 3, 4)
+
+class QVector2DDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QVector2D(1, 2)
+
+class QVector3DDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QVector3D(1, 2, 3)
+
+class QVector4DDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QVector4D(1, 2, 3, 4)
+
+class QPolygonDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QPolygon([QPoint(1, 2), QPoint(3, 4), QPoint(5, 6)])
+
+class QMatrixDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QMatrix(1, 2, 3, 4, 5, 6)
+
+class QMatrix2x2DeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QMatrix2x2([1, 2, 3, 4])
+
+class QMatrix2x3DeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QMatrix2x3([1, 2, 3, 4, 5, 6])
+
+class QMatrix2x4DeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QMatrix2x4([1, 2, 3, 4, 5, 6, 7, 8])
+
+class QMatrix3x2DeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QMatrix3x2([1, 2, 3, 4, 5, 6])
+
+class QMatrix3x3DeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QMatrix3x3([1, 2, 3, 4, 5, 6, 7, 8, 9])
+
+class QMatrix3x4DeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QMatrix3x4([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
+
+class QMatrix4x2DeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QMatrix4x2([1, 2, 3, 4, 5, 6, 7, 8])
+
+class QMatrix4x3DeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QMatrix4x3([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
+
+class QMatrix4x4DeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QMatrix4x4([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
+
+if __name__ == '__main__':
+ unittest.main()