Fix bug 674 - "QGraphicsScene::clear() is missing"

This commit is contained in:
Hugo Parente Lima 2011-02-16 16:07:01 -02:00
commit 8550948818
3 changed files with 39 additions and 1 deletions

View file

@ -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)

23
tests/QtGui/bug_674.py Normal file
View file

@ -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()