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
27
tests/signals/ref01_test.py
Executable file
27
tests/signals/ref01_test.py
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import unittest
|
||||
from PySide.QtCore import QObject, Signal
|
||||
|
||||
class BoundAndUnboundSignalsTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.methods = set(('connect', 'disconnect', 'emit'))
|
||||
|
||||
def tearDown(self):
|
||||
del self.methods
|
||||
|
||||
def testUnboundSignal(self):
|
||||
self.assertEqual(type(QObject.destroyed), Signal)
|
||||
self.assertFalse(self.methods.issubset(dir(QObject.destroyed)))
|
||||
|
||||
def testBoundSignal(self):
|
||||
obj = QObject()
|
||||
self.assertNotEqual(type(obj.destroyed), Signal)
|
||||
self.assert_(self.methods.issubset(dir(obj.destroyed)))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue