diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-02-17 17:54:31 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-02-17 17:54:31 -0300 |
commit | fa6756f52b368270b6e8e0ee4adb499a2afd5499 (patch) | |
tree | f4457552602f908b6c5df0bf3c46e10927eb5b0f | |
parent | 16b2d0e370d4c7f69e846a90737ca56e010cf609 (diff) |
Fixes type system for QAbstractTransition.setTargetState.
And also for QAbstractTransition.targetState method.
The test cases for it were expanded.
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 12 | ||||
-rw-r--r-- | tests/qtcore/qabstracttransition_test.py | 23 |
2 files changed, 34 insertions, 1 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index b6bd90146..48f0b2d3f 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -2793,6 +2793,18 @@ </modify-argument> </modify-function> + <modify-function signature="setTargetState(QAbstractState*)"> + <modify-argument index="1"> + <reference-count action="add"/> + </modify-argument> + </modify-function> + + <modify-function signature="targetState() const"> + <modify-argument index="return"> + <define-ownership class="target" owner="default"/> + </modify-argument> + </modify-function> + <!-- http://bugs.openbossa.org/show_bug.cgi?id=123 <modify-function signature="setTargetStates(QList<QAbstractState*>)" remove="all"/> <modify-function signature="targetStates() const " remove="all"/>--> diff --git a/tests/qtcore/qabstracttransition_test.py b/tests/qtcore/qabstracttransition_test.py index d7e7f0738..a45a7d824 100644 --- a/tests/qtcore/qabstracttransition_test.py +++ b/tests/qtcore/qabstracttransition_test.py @@ -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() + |