summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-04-28 11:47:00 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-04-28 13:37:58 (GMT)
commit772cb8c46b96e850b391f157e4870895e53748d4 (patch)
tree2f83598b4ce1636beb6a553cbbfb2d1bfb5069f0 /tests
parenta3e862a07bd724c02d1860eb106dfb245659775b (diff)
downloadQt-772cb8c46b96e850b391f157e4870895e53748d4.zip
Qt-772cb8c46b96e850b391f157e4870895e53748d4.tar.gz
Qt-772cb8c46b96e850b391f157e4870895e53748d4.tar.bz2
Add a test for the semantics of transitions from a region in parallel states.
This test checks for the behavior I expected, but that's apparently not how it's defined in the SCXML algorithm. Currently it XFAILs, and we'll either have to fix the algorithm or the test when we get word back on what the correct semantics are.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 54446a6..db25ad5 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -133,6 +133,7 @@ private slots:
//void restorePolicyOnChildState();
void transitionWithParent();
+ void parallelStateTransition();
void simpleAnimation();
void twoAnimations();
@@ -2808,6 +2809,52 @@ void tst_QStateMachine::overrideDefaultTargetAnimationWithSource()
QCOMPARE(counter.counter, 2); // specific animation started and stopped
}
+void tst_QStateMachine::parallelStateTransition()
+{
+ QStateMachine machine;
+
+ QState *parallelState = new QState(QState::ParallelGroup, machine.rootState());
+ machine.setInitialState(parallelState);
+
+ QState *s1 = new QState(parallelState);
+ QState *s2 = new QState(parallelState);
+
+ QState *s1InitialChild = new QState(s1);
+ s1->setInitialState(s1InitialChild);
+
+ QState *s2InitialChild = new QState(s2);
+ s2->setInitialState(s2InitialChild);
+
+ QState *s1OtherChild = new QState(s1);
+ QState *s2OtherChild = new QState(s2);
+
+ s1->addTransition(new EventTransition(QEvent::User, s1OtherChild));
+
+ machine.start();
+ QCoreApplication::processEvents();
+
+ QVERIFY(machine.configuration().contains(parallelState));
+ QVERIFY(machine.configuration().contains(s1));
+ QVERIFY(machine.configuration().contains(s2));
+ QVERIFY(machine.configuration().contains(s1InitialChild));
+ QVERIFY(machine.configuration().contains(s2InitialChild));
+ QCOMPARE(machine.configuration().size(), 5);
+
+ machine.postEvent(new QEvent(QEvent::User));
+ QCoreApplication::processEvents();
+
+ QVERIFY(machine.configuration().contains(parallelState));
+
+ QVERIFY(machine.configuration().contains(s1));
+
+ QEXPECT_FAIL("", "This failure is defined in the algorithm. We need to find out what behavior is correct.", Abort);
+ QVERIFY(machine.configuration().contains(s2));
+ QVERIFY(machine.configuration().contains(s1OtherChild));
+ QVERIFY(machine.configuration().contains(s2InitialChild));
+ QCOMPARE(machine.configuration().size(), 5);
+
+}
+
QTEST_MAIN(tst_QStateMachine)
#include "tst_qstatemachine.moc"