aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-03-09 17:18:11 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:02 -0300
commit40bbb494874e4f39ca814e23af3f27b9804e7429 (patch)
tree8a6af16a9e2c8907b1bb0c7e03b585b2060c0de6 /tests
parente8a8e3c63e85524bc2edfec1fccf2104cda87f38 (diff)
Created unit test for bug #714.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_714.py21
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 38975321a..5a6931d95 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -41,6 +41,7 @@ PYSIDE_TEST(bug_667.py)
PYSIDE_TEST(bug_668.py)
PYSIDE_TEST(bug_674.py)
PYSIDE_TEST(bug_675.py)
+PYSIDE_TEST(bug_714.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
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()
+