summaryrefslogtreecommitdiffstats
path: root/tests/auto/qstatemachine
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-06-22 09:15:32 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-06-22 11:55:45 (GMT)
commitfaac8a24d682ef0cfee52bef3ec1754d27c212b9 (patch)
treec85df3f639ab6a1ed6e91da7b985f00e41323d26 /tests/auto/qstatemachine
parent527f6e411fed3b27abe637a6bbcbb47f4110b69f (diff)
downloadQt-faac8a24d682ef0cfee52bef3ec1754d27c212b9.zip
Qt-faac8a24d682ef0cfee52bef3ec1754d27c212b9.tar.gz
Qt-faac8a24d682ef0cfee52bef3ec1754d27c212b9.tar.bz2
add test for parallel root state (which currently isn't supported)
Diffstat (limited to 'tests/auto/qstatemachine')
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index b39f0a1..1cc2a8e 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -118,6 +118,7 @@ private slots:
void postEvent();
void stateFinished();
void parallelStates();
+ void parallelRootState();
void allSourceToTargetConfigurations();
void signalTransitions();
void eventTransitions();
@@ -1633,6 +1634,29 @@ void tst_QStateMachine::parallelStates()
QVERIFY(machine.configuration().contains(s2));
}
+void tst_QStateMachine::parallelRootState()
+{
+ QStateMachine machine;
+ QState *root = machine.rootState();
+ QCOMPARE(root->childMode(), QState::ExclusiveStates);
+ root->setChildMode(QState::ParallelStates);
+ QCOMPARE(root->childMode(), QState::ParallelStates);
+
+ QState *s1 = new QState(root);
+ QFinalState *s1_f = new QFinalState(s1);
+ s1->setInitialState(s1_f);
+ QState *s2 = new QState(root);
+ QFinalState *s2_f = new QFinalState(s2);
+ s2->setInitialState(s2_f);
+
+ QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QTest::ignoreMessage(QtWarningMsg, "QStateMachine::start: No initial state set for machine. Refusing to start.");
+ machine.start();
+ QCoreApplication::processEvents();
+ QEXPECT_FAIL("", "parallel root state is not supported (task 256587)", Continue);
+ QCOMPARE(startedSpy.count(), 1);
+}
+
void tst_QStateMachine::allSourceToTargetConfigurations()
{
QStateMachine machine;