Fixes type system for QAbstractTransition.setTargetState.
And also for QAbstractTransition.targetState method. The test cases for it were expanded.
This commit is contained in:
parent
16b2d0e370
commit
fa6756f52b
2 changed files with 34 additions and 1 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#!/usr/bin/python
|
||||
import unittest
|
||||
from PySide.QtCore import QObject, QState, QFinalState, SIGNAL, QCoreApplication, QTimer, QStateMachine, QSignalTransition, QVariant, QParallelAnimationGroup
|
||||
from sys import getrefcount
|
||||
from PySide.QtCore import QObject, SIGNAL, QCoreApplication, QTimer, QVariant
|
||||
from PySide.QtCore import QState, QFinalState, QStateMachine, QParallelAnimationGroup, QEventTransition
|
||||
|
||||
def addStates(transition):
|
||||
sx = QState()
|
||||
|
|
@ -47,5 +49,24 @@ class QAbstractTransitionTest(unittest.TestCase):
|
|||
QTimer.singleShot(100, app.quit)
|
||||
app.exec_()
|
||||
|
||||
def testRefCountOfTargetState(self):
|
||||
transition = QEventTransition()
|
||||
state1 = QState()
|
||||
refcount1 = getrefcount(state1)
|
||||
transition.setTargetState(state1)
|
||||
self.assertEqual(transition.targetState(), state1)
|
||||
self.assertEqual(getrefcount(transition.targetState()), refcount1 + 1)
|
||||
|
||||
state2 = QState()
|
||||
refcount2 = getrefcount(state2)
|
||||
transition.setTargetState(state2)
|
||||
self.assertEqual(transition.targetState(), state2)
|
||||
self.assertEqual(getrefcount(transition.targetState()), refcount2 + 1)
|
||||
self.assertEqual(getrefcount(state1), refcount1)
|
||||
|
||||
del transition
|
||||
self.assertEqual(getrefcount(state2), refcount2)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue