Created unit test to test shiboken objects destructor.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
505ba23a9d
commit
4f51600e20
2 changed files with 20 additions and 0 deletions
|
|
@ -28,6 +28,7 @@ PYSIDE_TEST(qmetaobject_test.py)
|
||||||
PYSIDE_TEST(qmodelindex_internalpointer_test.py)
|
PYSIDE_TEST(qmodelindex_internalpointer_test.py)
|
||||||
PYSIDE_TEST(qobject_children_segfault_test.py)
|
PYSIDE_TEST(qobject_children_segfault_test.py)
|
||||||
PYSIDE_TEST(qobject_connect_notify_test.py)
|
PYSIDE_TEST(qobject_connect_notify_test.py)
|
||||||
|
PYSIDE_TEST(qobject_destructor.py)
|
||||||
PYSIDE_TEST(qobject_event_filter_test.py)
|
PYSIDE_TEST(qobject_event_filter_test.py)
|
||||||
PYSIDE_TEST(qobject_inherits_test.py)
|
PYSIDE_TEST(qobject_inherits_test.py)
|
||||||
PYSIDE_TEST(qobject_parent_test.py)
|
PYSIDE_TEST(qobject_parent_test.py)
|
||||||
|
|
|
||||||
19
tests/QtCore/qobject_destructor.py
Normal file
19
tests/QtCore/qobject_destructor.py
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
from PySide import QtCore
|
||||||
|
|
||||||
|
class MyObject(QtCore.QObject):
|
||||||
|
def __init__(self, other=None):
|
||||||
|
QtCore.QObject.__init__(self, None)
|
||||||
|
self._o = other
|
||||||
|
|
||||||
|
class TestDestructor(unittest.TestCase):
|
||||||
|
def testReference(self):
|
||||||
|
o = QtCore.QObject()
|
||||||
|
m = MyObject(o)
|
||||||
|
self.assertEqual(sys.getrefcount(o), 3)
|
||||||
|
del m
|
||||||
|
self.assertEqual(sys.getrefcount(o), 2)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue