summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauro Neto <lauro.neto@openbossa.org>2010-08-09 18:03:24 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-10-13 13:41:21 -0300
commita3b0314c58720194613a87623461abc93469a978 (patch)
tree58bbac55beacf9d71860654c2c99bad9b8a2850e
parent51dd97bebcf49c36402bd3401e5f8b1bf0d1de31 (diff)
downloadpyside-a3b0314c58720194613a87623461abc93469a978.tar.gz
pyside-a3b0314c58720194613a87623461abc93469a978.tar.xz
pyside-a3b0314c58720194613a87623461abc93469a978.zip
Adding deepcopy test for QtCore classes.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Filho <renato.filho@openbossa.org>
-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()