diff options
author | renatofilho <renato.filho@openbossa.org> | 2010-10-19 15:21:23 -0300 |
---|---|---|
committer | renatofilho <renato.filho@openbossa.org> | 2010-10-19 17:07:37 -0300 |
commit | ae942fd5dae9e59cae78a32ed598001bf70e523e (patch) | |
tree | 0da428c3cdee66337ad15164b1accf9392ffd347 /tests | |
parent | bea4934c04fe49eedff218e9905926ec3477e0b1 (diff) |
Included QSignalTransition constructor to support Signal objects.
Created unit test.
Fixes bug #416
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtGui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtGui/bug_416.py | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 4a293f2dd..21aa7690d 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -12,6 +12,7 @@ PYSIDE_TEST(bug_363.py) PYSIDE_TEST(bug_367.py) PYSIDE_TEST(bug_389.py) PYSIDE_TEST(bug_400.py) +PYSIDE_TEST(bug_416.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_416.py b/tests/QtGui/bug_416.py new file mode 100644 index 000000000..20b8d0c12 --- /dev/null +++ b/tests/QtGui/bug_416.py @@ -0,0 +1,43 @@ +#!/usr/bin/python + +import unittest +from helper import TimedQApplication +from PySide.QtCore import QSignalTransition, QState, Qt, QStateMachine +from PySide.QtGui import QCheckBox + +class CheckedTransition(QSignalTransition): + def __init__(self, check): + QSignalTransition.__init__(self, check.stateChanged[int]) + self.eventTested = False + + def eventTest(self, event): + self.eventTested = True + if not QSignalTransition.eventTest(self, event): + return False + return event.arguments()[0] == Qt.Checked + +class TestBug(TimedQApplication): + def testCase(self): + check = QCheckBox() + check.setTristate(True) + + s1 = QState() + s2 = QState() + + t1 = CheckedTransition(check) + t1.setTargetState(s2) + s1.addTransition(t1) + + machine = QStateMachine() + machine.addState(s1) + machine.addState(s2) + machine.setInitialState(s1) + machine.start() + + check.stateChanged[int].emit(1) + check.show() + self.app.exec_() + self.assert_(t1.eventTested) + +if __name__ == '__main__': + unittest.main() |