aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtGui/bug_714.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/QtGui/bug_714.py')
-rw-r--r--tests/QtGui/bug_714.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/QtGui/bug_714.py b/tests/QtGui/bug_714.py
new file mode 100644
index 000000000..937ff82be
--- /dev/null
+++ b/tests/QtGui/bug_714.py
@@ -0,0 +1,21 @@
+import unittest
+import sys
+from PySide.QtGui import QLabel, QApplication, QPixmap
+
+class TestLabelPixmap(unittest.TestCase):
+ def testReference(self):
+ l = QLabel()
+ p = QPixmap()
+ l.setPixmap(p) # doesn't increment pixmap ref because this makes a copy
+ self.assertEqual(sys.getrefcount(p), 2)
+
+ p = l.pixmap() # this increment the reference because this is an internal pointer
+ self.assertEqual(sys.getrefcount(p), 3)
+
+ p2 = l.pixmap()
+ self.assertEqual(p, p2)
+
+if __name__ == '__main__':
+ app = QApplication([])
+ unittest.main()
+