Adding new-style signal/slot tests.
Based on Marcelo Lira's source code.
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>,
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
16809db86b
commit
9a8bc9c3d1
6 changed files with 254 additions and 0 deletions
29
tests/signals/ref03_test.py
Executable file
29
tests/signals/ref03_test.py
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import unittest
|
||||
from sys import getrefcount
|
||||
from PySide.QtCore import QObject
|
||||
|
||||
class DisconnectSignalsTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.emitter = QObject()
|
||||
|
||||
def tearDown(self):
|
||||
del self.emitter
|
||||
|
||||
def testConnectionRefCount(self):
|
||||
|
||||
def destroyedSlot():
|
||||
pass
|
||||
|
||||
self.assertEqual(getrefcount(destroyedSlot), 2)
|
||||
self.emitter.destroyed.connect(destroyedSlot)
|
||||
self.assertEqual(getrefcount(destroyedSlot), 3)
|
||||
self.emitter.destroyed.disconnect(destroyedSlot)
|
||||
self.assertEqual(getrefcount(destroyedSlot), 2)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue