aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--PySide/QtGui/CMakeLists.txt1
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml1
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/qpixmapcache_test.py36
4 files changed, 39 insertions, 0 deletions
diff --git a/PySide/QtGui/CMakeLists.txt b/PySide/QtGui/CMakeLists.txt
index 4362115d4..8f8ff9703 100644
--- a/PySide/QtGui/CMakeLists.txt
+++ b/PySide/QtGui/CMakeLists.txt
@@ -242,6 +242,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpen_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpictureio_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpicture_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpixmapcache_wrapper.cpp
+${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpixmapcache_key_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpixmap_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qplaintextdocumentlayout_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qplaintextedit_wrapper.cpp
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 6cfe6eb97..5ff06da5e 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -2380,6 +2380,7 @@
</modify-function>
</object-type>
<object-type name="QPixmapCache">
+ <value-type name="Key"/>
<!-- ### Obsolete. -->
<modify-function signature="find(QString)" remove="all"/>
<modify-function signature="find(QString,QPixmap&amp;)" remove="all"/>
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()
+