summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-09-29 14:48:54 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-09-29 14:48:54 (GMT)
commitc275874bf96dbca05e9a2c15cd970138d78ac595 (patch)
tree89509226eb74ad860e8a3061893891f1d133fbf0 /tests
parentb1c2caf933942b3a77a0332aecb66a7f0fdd2316 (diff)
parent544f06f1fe29e986cd2b3fd1fd7198d688275969 (diff)
downloadQt-c275874bf96dbca05e9a2c15cd970138d78ac595.zip
Qt-c275874bf96dbca05e9a2c15cd970138d78ac595.tar.gz
Qt-c275874bf96dbca05e9a2c15cd970138d78ac595.tar.bz2
Merge commit 'qt/4.6' into mmfphonon
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 463dbf6..b808f7f 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -120,6 +120,7 @@ private slots:
void assignPropertyWithAnimation();
void postEvent();
void cancelDelayedEvent();
+ void postDelayedEventAndStop();
void stateFinished();
void parallelStates();
void parallelRootState();
@@ -1638,6 +1639,44 @@ void tst_QStateMachine::cancelDelayedEvent()
QVERIFY(machine.configuration().contains(s2));
}
+void tst_QStateMachine::postDelayedEventAndStop()
+{
+ QStateMachine machine;
+ QState *s1 = new QState(&machine);
+ QFinalState *s2 = new QFinalState(&machine);
+ s1->addTransition(new StringTransition("a", s2));
+ machine.setInitialState(s1);
+
+ QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ machine.start();
+ QTRY_COMPARE(startedSpy.count(), 1);
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s1));
+
+ int id1 = machine.postDelayedEvent(new StringEvent("a"), 0);
+ QVERIFY(id1 != -1);
+ QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
+ machine.stop();
+ QTRY_COMPARE(stoppedSpy.count(), 1);
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s1));
+
+ machine.start();
+ QTRY_COMPARE(startedSpy.count(), 2);
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s1));
+
+ int id2 = machine.postDelayedEvent(new StringEvent("a"), 1000);
+ QVERIFY(id2 != -1);
+ machine.stop();
+ QTRY_COMPARE(stoppedSpy.count(), 2);
+ machine.start();
+ QTRY_COMPARE(startedSpy.count(), 3);
+ QTestEventLoop::instance().enterLoop(2);
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s1));
+}
+
void tst_QStateMachine::stateFinished()
{
QStateMachine machine;