diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-09-27 19:03:30 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-09-27 19:41:41 -0300 |
commit | 4787f1eb0fd1363536dc64f168d382e6247f1097 (patch) | |
tree | 24c88f68a95c3f46f09a6cde329e7334d1866db1 /tests | |
parent | 62234b4f86eea914b8bb802f5d5f3c110f5db92a (diff) |
Added hash functions for QLine, QPoint, QRect and QSize classes.
Tests where also added.
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Reviewed by Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtCore/hash_test.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/QtCore/hash_test.py b/tests/QtCore/hash_test.py index 4fdecca7d..6ff24f39f 100644 --- a/tests/QtCore/hash_test.py +++ b/tests/QtCore/hash_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python import unittest from PySide.QtCore import QDate, QDateTime, QTime, QUrl +from PySide.QtCore import QLine, QPoint, QRect, QSize class HashTest(unittest.TestCase): def testInsert(self): @@ -20,6 +21,34 @@ class HashTest(unittest.TestCase): self.assertEqual(myHash[qtime], "QTime") self.assertEqual(myHash[qurl], "QUrl") + def testQPointHash(self): + p1 = QPoint(12, 34) + p2 = QPoint(12, 34) + self.assertFalse(p1 is p2) + self.assertEqual(p1, p2) + self.assertEqual(hash(p1), hash(p2)) + + def testQSizeHash(self): + s1 = QSize(12, 34) + s2 = QSize(12, 34) + self.assertFalse(s1 is s2) + self.assertEqual(s1, s2) + self.assertEqual(hash(s1), hash(s2)) + + def testQRectHash(self): + r1 = QRect(12, 34, 56, 78) + r2 = QRect(12, 34, 56, 78) + self.assertFalse(r1 is r2) + self.assertEqual(r1, r2) + self.assertEqual(hash(r1), hash(r2)) + + def testQLineHash(self): + l1 = QLine(12, 34, 56, 78) + l2 = QLine(12, 34, 56, 78) + self.assertFalse(l1 is l2) + self.assertEqual(l1, l2) + self.assertEqual(hash(l1), hash(l2)) if __name__ == '__main__': unittest.main() + |