Fix bug 821 - "Mapping interface for QPixmapCache"

Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
          Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
Hugo Parente Lima 2011-07-20 17:48:15 -03:00
commit 0c2b68c904
2 changed files with 18 additions and 1 deletions

View file

@ -10,6 +10,8 @@ class QPixmapCacheTest(UsesQApplication):
ok = QPixmapCache.find('img', pm1)
self.assertFalse(ok)
self.assertEqual(QPixmapCache.find('img'), None)
pm2 = QPixmap()
ok = QPixmapCache.insert('img', pm2)
self.assertTrue(ok)
@ -18,11 +20,15 @@ class QPixmapCacheTest(UsesQApplication):
ok = QPixmapCache.find('img', pm3)
self.assertTrue(ok)
self.assertEqual(QPixmapCache.find('img').toImage().bits(), pm3.toImage().bits())
def testWithKey(self):
pm1 = QPixmap()
ok = QPixmapCache.find(QPixmapCache.Key(), pm1)
self.assertFalse(ok)
self.assertEqual(QPixmapCache.find(QPixmapCache.Key()), None)
pm2 = QPixmap()
key = QPixmapCache.insert(pm2)
@ -30,6 +36,7 @@ class QPixmapCacheTest(UsesQApplication):
ok = QPixmapCache.find(key, pm3)
self.assertTrue(ok)
self.assertEqual(QPixmapCache.find(key).toImage().bits(), pm3.toImage().bits())
if __name__ == '__main__':
unittest.main()