summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/QtCore/CMakeLists.txt1
-rw-r--r--tests/QtCore/deepcopy_test.py56
2 files changed, 57 insertions, 0 deletions
diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt
index 30f3ff6..7225da0 100644
--- a/tests/QtCore/CMakeLists.txt
+++ b/tests/QtCore/CMakeLists.txt
@@ -2,6 +2,7 @@ PYSIDE_TEST(bug_278_test.py)
PYSIDE_TEST(bug_332.py)
PYSIDE_TEST(blocking_signals_test.py)
PYSIDE_TEST(child_event_test.py)
+PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(deletelater_test.py)
PYSIDE_TEST(duck_punching_test.py)
PYSIDE_TEST(hash_test.py)
diff --git a/tests/QtCore/deepcopy_test.py b/tests/QtCore/deepcopy_test.py
new file mode 100644
index 0000000..9c14272
--- /dev/null
+++ b/tests/QtCore/deepcopy_test.py
@@ -0,0 +1,56 @@
+
+import unittest
+from copy import deepcopy
+
+from PySide.QtCore import QByteArray, QDate, QDateTime, QTime
+from PySide.QtCore import Qt, QSize, QSizeF, QRect, QRectF
+
+class DeepCopyHelper:
+
+ def testCopy(self):
+ copy = deepcopy([self.original])[0]
+ self.assert_(copy is not self.original)
+ self.assertEqual(copy, self.original)
+
+class QByteArrayDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QByteArray('the quick brown fox jumps over the lazy dog')
+
+
+class QDateDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QDate(2010, 11, 22)
+
+
+class QTimeDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QTime(11, 37, 55, 692)
+
+
+class QDateTimeDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QDateTime(2010, 5, 18, 10, 24, 45, 223, Qt.LocalTime)
+
+
+class QSizeDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QSize(42, 190)
+
+
+class QSizeFDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QSizeF(42.7, 190.2)
+
+
+class QRectDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QRect(100, 200, 300, 400)
+
+
+class QRectFDeepCopy(DeepCopyHelper, unittest.TestCase):
+ def setUp(self):
+ self.original = QRectF(100.33, 200.254, 300.321, 400.123)
+
+
+if __name__ == '__main__':
+ unittest.main()