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>
This commit is contained in:
parent
bea4934c04
commit
ae942fd5da
3 changed files with 62 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
43
tests/QtGui/bug_416.py
Normal file
43
tests/QtGui/bug_416.py
Normal file
|
|
@ -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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue