aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtGui
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-05-19 13:23:46 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:24 -0300
commite93b79399ae54f7cfb67ca73cdb92ea0f91d8a22 (patch)
tree167ae8c3b3a66e5e3e44179d92111088e0dcaa8b /tests/QtGui
parent5e778d0f1b39993fa3eb5976c950caf6e5f4eb85 (diff)
Added the missing QPixmapCache.Key class to the type system.
Unit tests for QPixmapCache were also added. Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/QtGui')
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/qpixmapcache_test.py36
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 44e4c520b..6a142d379 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -108,6 +108,7 @@ PYSIDE_TEST(qpen_test.py)
PYSIDE_TEST(qpicture_test.py)
PYSIDE_TEST(qpixmap_test.py)
PYSIDE_TEST(qpixmap_constructor.py)
+PYSIDE_TEST(qpixmapcache_test.py)
PYSIDE_TEST(qpolygonf_test.py)
PYSIDE_TEST(qpushbutton_test.py)
PYSIDE_TEST(qkeysequence_test.py)
diff --git a/tests/QtGui/qpixmapcache_test.py b/tests/QtGui/qpixmapcache_test.py
new file mode 100644
index 000000000..33d631b92
--- /dev/null
+++ b/tests/QtGui/qpixmapcache_test.py
@@ -0,0 +1,36 @@
+import unittest
+from helper import UsesQApplication
+from PySide.QtGui import QPixmapCache, QPixmap
+
+
+class QPixmapCacheTest(UsesQApplication):
+
+ def testWithString(self):
+ pm1 = QPixmap()
+ ok = QPixmapCache.find('img', pm1)
+ self.assertFalse(ok)
+
+ pm2 = QPixmap()
+ ok = QPixmapCache.insert('img', pm2)
+ self.assertTrue(ok)
+
+ pm3 = QPixmap()
+ ok = QPixmapCache.find('img', pm3)
+ self.assertTrue(ok)
+
+ def testWithKey(self):
+ pm1 = QPixmap()
+ ok = QPixmapCache.find(QPixmapCache.Key(), pm1)
+ self.assertFalse(ok)
+
+ pm2 = QPixmap()
+ key = QPixmapCache.insert(pm2)
+
+ pm3 = QPixmap()
+ ok = QPixmapCache.find(key, pm3)
+ self.assertTrue(ok)
+
+
+if __name__ == '__main__':
+ unittest.main()
+