Created new unittest model.
Separete unittest for module.
Only run unittest for compiled modules.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>,
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
471486732b
commit
ab918abc1e
211 changed files with 241 additions and 79 deletions
35
tests/QtCore/qstate_test.py
Normal file
35
tests/QtCore/qstate_test.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/python
|
||||
import unittest
|
||||
from PySide.QtCore import QObject, QState, QFinalState, SIGNAL, QCoreApplication, QTimer, QStateMachine, QSignalTransition, QVariant
|
||||
|
||||
|
||||
class QStateTest(unittest.TestCase):
|
||||
def testBasic(self):
|
||||
app = QCoreApplication([])
|
||||
|
||||
o = QObject()
|
||||
o.setProperty("text", QVariant("INdT"))
|
||||
|
||||
machine = QStateMachine()
|
||||
s1 = QState()
|
||||
s1.assignProperty(o, "text", QVariant("Rocks"));
|
||||
|
||||
s2 = QFinalState()
|
||||
t = s1.addTransition(o, SIGNAL("change()"), s2);
|
||||
self.assert_(isinstance(t, QSignalTransition))
|
||||
|
||||
machine.addState(s1)
|
||||
machine.addState(s2)
|
||||
machine.setInitialState(s1)
|
||||
machine.start()
|
||||
|
||||
o.emit(SIGNAL("change()"))
|
||||
|
||||
QTimer.singleShot(100, app.quit)
|
||||
app.exec_()
|
||||
|
||||
txt = o.property("text").toString()
|
||||
self.assert_(txt, "Rocks")
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue