summaryrefslogtreecommitdiffstats
path: root/tests/auto/qstatemachine
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-06-22 12:44:55 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-06-22 12:50:11 (GMT)
commitdb92a780ceb130b6fa91ad866e521237c4b255b8 (patch)
tree01d7e77c82f652799cdfac86aadc6d8cf3e317b4 /tests/auto/qstatemachine
parent24146ce4ad076fb6337b591d24e5a8c6a290fe41 (diff)
downloadQt-db92a780ceb130b6fa91ad866e521237c4b255b8.zip
Qt-db92a780ceb130b6fa91ad866e521237c4b255b8.tar.gz
Qt-db92a780ceb130b6fa91ad866e521237c4b255b8.tar.bz2
perform normalization of signatures for signal transitions
Make state->addTransition(foo, SIGNAL( bar( ) ), ...) work.
Diffstat (limited to 'tests/auto/qstatemachine')
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 1cc2a8e..553833c 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -1981,6 +1981,31 @@ void tst_QStateMachine::signalTransitions()
QCOMPARE(machine.configuration().size(), 1);
QVERIFY(machine.configuration().contains(s3));
}
+ // signature normalization
+ {
+ QStateMachine machine;
+ SignalEmitter emitter;
+ QState *s0 = new QState(machine.rootState());
+ QFinalState *s1 = new QFinalState(machine.rootState());
+ QSignalTransition *t0 = s0->addTransition(&emitter, SIGNAL( signalWithNoArg( ) ), s1);
+ QVERIFY(t0 != 0);
+ QCOMPARE(t0->signal(), QByteArray(SIGNAL( signalWithNoArg( ) )));
+
+ QSignalTransition *t1 = s0->addTransition(&emitter, SIGNAL( signalWithStringArg( const QString & ) ), s1);
+ QVERIFY(t1 != 0);
+ QCOMPARE(t1->signal(), QByteArray(SIGNAL( signalWithStringArg( const QString & ) )));
+
+ QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ machine.setInitialState(s0);
+ machine.start();
+ QTRY_COMPARE(startedSpy.count(), 1);
+ QCOMPARE(finishedSpy.count(), 0);
+
+ emitter.emitSignalWithNoArg();
+
+ QTRY_COMPARE(finishedSpy.count(), 1);
+ }
}
void tst_QStateMachine::eventTransitions()