summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-04-29 14:00:35 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-04-29 14:13:14 (GMT)
commit146a63c8025d4b5a20554e067d0246df9be3e68a (patch)
tree06c0ef9ab94e276648d34a243ff1b808a82674a2 /tests
parenteea1c9f34b9b98c55c48f9ed1dbef9a9883c6f2a (diff)
downloadQt-146a63c8025d4b5a20554e067d0246df9be3e68a.zip
Qt-146a63c8025d4b5a20554e067d0246df9be3e68a.tar.gz
Qt-146a63c8025d4b5a20554e067d0246df9be3e68a.tar.bz2
SCXML defines an atomic state as a <state> with no children or <final>. However,
in SCXML it makes no sense for a <parallel> tag to be atomic, hence have no children, whereas in a dynamic state machine you might set an atomic state as parallel because this should govern the behavior if the state gets children later. We decided that the most intuitive definition is that a state is atomic if it has no children, regardless of whether it has the parallel child mode. With the old definition, transitions from empty parallel states will never be taken, as illustrated by the test.
Diffstat (limited to 'tests')
-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 5ce0f35..3acde49 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -135,6 +135,7 @@ private slots:
//void restorePolicyOnChildState();
void transitionWithParent();
+ void transitionsFromParallelStateWithNoChildren();
void parallelStateTransition();
void parallelStateAssignmentsDone();
@@ -2889,6 +2890,30 @@ void tst_QStateMachine::parallelStateAssignmentsDone()
QCOMPARE(propertyHolder->property("zoot").toInt(), 987);
}
+void tst_QStateMachine::transitionsFromParallelStateWithNoChildren()
+{
+ QStateMachine machine;
+
+ QState *parallelState = new QState(QState::ParallelGroup, machine.rootState());
+ machine.setInitialState(parallelState);
+
+ QState *s1 = new QState(machine.rootState());
+ parallelState->addTransition(new EventTransition(QEvent::User, s1));
+
+ machine.start();
+ QCoreApplication::processEvents();
+
+ QCOMPARE(1, machine.configuration().size());
+ QVERIFY(machine.configuration().contains(parallelState));
+
+ machine.postEvent(new QEvent(QEvent::User));
+
+ QCoreApplication::processEvents();
+
+ QCOMPARE(1, machine.configuration().size());
+ QVERIFY(machine.configuration().contains(s1));
+}
+
void tst_QStateMachine::parallelStateTransition()
{
QStateMachine machine;