summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-05-19 13:23:46 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2011-05-19 14:45:00 -0300
commitb112512793f2f74ec83b87816813935f79e88cc4 (patch)
treec679fac66fa3c569a6f717284ab11d78f888762a
parent6e16fd86f41569070f1114711b46db0d7f76f1c9 (diff)
downloadpyside-b112512793f2f74ec83b87816813935f79e88cc4.tar.gz
pyside-b112512793f2f74ec83b87816813935f79e88cc4.tar.xz
pyside-b112512793f2f74ec83b87816813935f79e88cc4.zip
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 4362115..8f8ff97 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 6cfe6eb..5ff06da 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 44e4c52..6a142d3 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 0000000..33d631b
--- /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()
+