blob: 4d015b57790dd46342d3a51d3176d87c1d71f916 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()
|