diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-02-01 19:15:23 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:53:51 -0300 |
commit | 82e9d146016da82c8fab15aacb05e627b5cc5281 (patch) | |
tree | ed3dd05afab1f8733b039b8a5d9d95360a16591f /tests | |
parent | 4551b2421c47d2bba261b2202b019e6cc8a4af28 (diff) |
Fix bug 651 - "Calling disconnect() with no arguments causes segfault"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/signals/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/signals/disconnect_test.py | 32 |
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/signals/CMakeLists.txt b/tests/signals/CMakeLists.txt index c9ef33e83..8e4d36118 100644 --- a/tests/signals/CMakeLists.txt +++ b/tests/signals/CMakeLists.txt @@ -3,6 +3,7 @@ PYSIDE_TEST(bug_311.py) PYSIDE_TEST(bug_312.py) PYSIDE_TEST(bug_319.py) PYSIDE_TEST(decorators_test.py) +PYSIDE_TEST(disconnect_test.py) PYSIDE_TEST(invalid_callback_test.py) PYSIDE_TEST(lambda_gui_test.py) PYSIDE_TEST(lambda_test.py) diff --git a/tests/signals/disconnect_test.py b/tests/signals/disconnect_test.py new file mode 100644 index 000000000..cceaf873e --- /dev/null +++ b/tests/signals/disconnect_test.py @@ -0,0 +1,32 @@ +import unittest +from PySide.QtCore import * + +class Foo(QObject): + bar = Signal() + +class TestDisconnect(unittest.TestCase): + def theSlot1(self): + self.called1 = True + + def theSlot2(self): + self.called2 = True + + def testIt(self): + self.called1 = False + self.called2 = False + f = Foo() + f.bar.connect(self.theSlot1) + f.bar.connect(self.theSlot2) + f.bar.emit() + self.assertTrue(self.called1) + self.assertTrue(self.called2) + + self.called1 = False + self.called2 = False + f.bar.disconnect() + f.bar.emit() + self.assertFalse(self.called1) + self.assertFalse(self.called2) + +if __name__ == '__main__': + unittest.main() |