aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtCore/qobject_destructor.py
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-07-28 17:50:11 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-07-29 14:13:26 -0300
commit4f51600e20b25f05eb9730c131ca3cd51eaa1774 (patch)
tree818741acdf641a3ca49768dd88f1e9a7a8a93325 /tests/QtCore/qobject_destructor.py
parent505ba23a9d63e7c6d014f3c5bd5b1cdf778aac56 (diff)
Created unit test to test shiboken objects destructor.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/QtCore/qobject_destructor.py')
-rw-r--r--tests/QtCore/qobject_destructor.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/QtCore/qobject_destructor.py b/tests/QtCore/qobject_destructor.py
new file mode 100644
index 000000000..036bf1d76
--- /dev/null
+++ b/tests/QtCore/qobject_destructor.py
@@ -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()