diff options
author | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-05-07 11:03:59 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-05-07 11:07:59 (GMT) |
commit | b39781b214e2502e0884bce88aa3ac324f2d0b12 (patch) | |
tree | d763aa5bf9b3d291f3d49865f9b5708e3bb02939 /tests/auto/qstatemachine | |
parent | 8da0e32d111bbada65d60fa26e14ca72211517b6 (diff) | |
download | Qt-b39781b214e2502e0884bce88aa3ac324f2d0b12.zip Qt-b39781b214e2502e0884bce88aa3ac324f2d0b12.tar.gz Qt-b39781b214e2502e0884bce88aa3ac324f2d0b12.tar.bz2 |
Make it impossible to have root state as source or target of transition or as error state
Since the root state has no ancestors, it cannot be source or target in
transitions since there will be no LCA for the transition, which is required for
the algorithm of enterStates and exitStates. In SCXML the root state cannot be
target or source of a transition. By the same logic, it cannot be an error
state. The root state will always have a valid machine, since it's added to
a machine immediately, which makes this code possible.
Diffstat (limited to 'tests/auto/qstatemachine')
-rw-r--r-- | tests/auto/qstatemachine/tst_qstatemachine.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index edd6459..9b7bff3 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -254,6 +254,8 @@ private: void tst_QStateMachine::transitionToRootState() { + s_countWarnings = false; + QStateMachine machine; QState *initialState = new QState(); @@ -668,6 +670,8 @@ void tst_QStateMachine::errorStateHasErrors() void tst_QStateMachine::errorStateIsRootState() { + s_countWarnings = false; + QStateMachine machine; machine.setErrorState(machine.rootState()); @@ -691,9 +695,8 @@ void tst_QStateMachine::errorStateIsRootState() machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1))); QCoreApplication::processEvents(); - QEXPECT_FAIL("", "Covered by transitionToRootState test. Remove this when that test passes", Continue); QCOMPARE(machine.configuration().count(), 1); - QVERIFY(machine.configuration().contains(initialState)); + QVERIFY(machine.configuration().contains(machine.errorState())); } void tst_QStateMachine::errorStateEntersParentFirst() |