summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-07-13 20:11:45 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-16 10:06:54 +0200
commit0b66f723f06f6d115ea37d4db8bb6c0b5f63885b (patch)
treecb25bae8edea50ff0ca25f281355e58de1851392 /tests
parent034b5fd02e19a47fc542a9216d5de7642c0c5a27 (diff)
Add QStateMachine constructor that takes a ChildMode
Back when QStateMachine was changed to inherit QState, this constructor was conveniently left out because setting the state machine (root state) to be a parallel state group didn't actually work. But as of commit d281aa6936ad01e28dacabb41bd9eb59891f85a1, it does work, so add the missing constructor. Task-number: QTBUG-15430 Change-Id: I68c599baa0ef1bfc869195140cf5daf645e75b8b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
index 77dc8dd1cc..af10f06718 100644
--- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
@@ -210,6 +210,7 @@ private slots:
void createEventTransitionWhenRunning();
void signalTransitionSenderInDifferentThread();
void signalTransitionRegistrationThreadSafety();
+ void childModeConstructor();
};
class TestState : public QState
@@ -4934,5 +4935,46 @@ void tst_QStateMachine::signalTransitionRegistrationThreadSafety()
QTRY_VERIFY(thread.wait());
}
+void tst_QStateMachine::childModeConstructor()
+{
+ {
+ QStateMachine machine(QState::ExclusiveStates);
+ QCOMPARE(machine.childMode(), QState::ExclusiveStates);
+ QVERIFY(machine.parent() == 0);
+ QVERIFY(machine.parentState() == 0);
+ }
+ {
+ QStateMachine machine(QState::ParallelStates);
+ QCOMPARE(machine.childMode(), QState::ParallelStates);
+ QVERIFY(machine.parent() == 0);
+ QVERIFY(machine.parentState() == 0);
+ }
+ {
+ QStateMachine machine(QState::ExclusiveStates, this);
+ QCOMPARE(machine.childMode(), QState::ExclusiveStates);
+ QCOMPARE(machine.parent(), static_cast<QObject *>(this));
+ QVERIFY(machine.parentState() == 0);
+ }
+ {
+ QStateMachine machine(QState::ParallelStates, this);
+ QCOMPARE(machine.childMode(), QState::ParallelStates);
+ QCOMPARE(machine.parent(), static_cast<QObject *>(this));
+ QVERIFY(machine.parentState() == 0);
+ }
+ QState state;
+ {
+ QStateMachine machine(QState::ExclusiveStates, &state);
+ QCOMPARE(machine.childMode(), QState::ExclusiveStates);
+ QCOMPARE(machine.parent(), static_cast<QObject *>(&state));
+ QCOMPARE(machine.parentState(), &state);
+ }
+ {
+ QStateMachine machine(QState::ParallelStates, &state);
+ QCOMPARE(machine.childMode(), QState::ParallelStates);
+ QCOMPARE(machine.parent(), static_cast<QObject *>(&state));
+ QCOMPARE(machine.parentState(), &state);
+ }
+}
+
QTEST_MAIN(tst_QStateMachine)
#include "tst_qstatemachine.moc"