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
|
|
@ -2793,6 +2793,18 @@
|
||||||
</modify-argument>
|
</modify-argument>
|
||||||
</modify-function>
|
</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
|
<!-- http://bugs.openbossa.org/show_bug.cgi?id=123
|
||||||
<modify-function signature="setTargetStates(QList<QAbstractState*>)" remove="all"/>
|
<modify-function signature="setTargetStates(QList<QAbstractState*>)" remove="all"/>
|
||||||
<modify-function signature="targetStates() const " remove="all"/>-->
|
<modify-function signature="targetStates() const " remove="all"/>-->
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import unittest
|
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):
|
def addStates(transition):
|
||||||
sx = QState()
|
sx = QState()
|
||||||
|
|
@ -47,5 +49,24 @@ class QAbstractTransitionTest(unittest.TestCase):
|
||||||
QTimer.singleShot(100, app.quit)
|
QTimer.singleShot(100, app.quit)
|
||||||
app.exec_()
|
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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue