aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-02-16 16:07:01 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:53:59 -0300
commit8550948818153625a4f23def6eb2ab1b7e63d30b (patch)
treea30ead73141d2842e24d243fe2e79c177b21d3f2 /tests
parentc8ecf9fea606679be567b9799fd6afb40a370564 (diff)
Fix bug 674 - "QGraphicsScene::clear() is missing"
Diffstat (limited to 'tests')
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_674.py23
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 1c10e5c3a..38975321a 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -39,6 +39,7 @@ PYSIDE_TEST(bug_660.py)
PYSIDE_TEST(bug_662.py)
PYSIDE_TEST(bug_667.py)
PYSIDE_TEST(bug_668.py)
+PYSIDE_TEST(bug_674.py)
PYSIDE_TEST(bug_675.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py)
diff --git a/tests/QtGui/bug_674.py b/tests/QtGui/bug_674.py
new file mode 100644
index 000000000..4d015b577
--- /dev/null
+++ b/tests/QtGui/bug_674.py
@@ -0,0 +1,23 @@
+from PySide.QtCore import *
+from PySide.QtGui import *
+import unittest
+import sys
+
+class TestBug679(unittest.TestCase):
+ '''QGraphicsScene::clear() is missing'''
+ def testIt(self):
+ app = QApplication([])
+
+ scene = QGraphicsScene()
+ hello = scene.addText("Hello")
+ scene.addText("World")
+
+ self.assertEqual(sys.getrefcount(hello), 3)
+ scene.clear()
+ self.assertEqual(sys.getrefcount(hello), 2)
+ self.assertEqual(len(scene.items()), 0)
+ self.assertRaises(RuntimeError, hello.isVisible) # the C++ object was deleted
+
+if __name__ == '__main__':
+ unittest.main()
+