diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-07-07 05:43:11 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-11 08:42:40 +0200 |
commit | 28e9a602cb35fc621dec36e28e8556ca0052551e (patch) | |
tree | 06a4c556acd1fdfaca484a350f355cac59ed6222 /tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp | |
parent | 0d8789ad300c2950855176e17cb17d7b1e7f39f9 (diff) |
statemachine: Emit finished() signal when the initial state is final
It's legal to set a QFinalState as the initial state. The state
machine should correctly emit the finished() signal upon entering
such a state in the initial transition, and don't do any further
processing.
Change-Id: Ica8d3fadbbde604512ea1136624af54eb3b13b11
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp')
-rw-r--r-- | tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp index b048f9c2f0..64f8d3aa9b 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -193,6 +193,7 @@ private slots: void setPropertyAfterRestore(); void transitionWithNoTarget_data(); void transitionWithNoTarget(); + void initialStateIsFinal(); void restorePropertiesSimple(); void restoreProperties2(); @@ -4196,6 +4197,17 @@ void tst_QStateMachine::transitionWithNoTarget() delete object; } +void tst_QStateMachine::initialStateIsFinal() +{ + QStateMachine machine; + QFinalState *f = new QFinalState(&machine); + machine.setInitialState(f); + QSignalSpy finishedSpy(&machine, SIGNAL(finished())); + machine.start(); + QTRY_VERIFY(machine.configuration().contains(f)); + QTRY_COMPARE(finishedSpy.count(), 1); +} + class PropertyObject : public QObject { Q_OBJECT |