diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-11-05 13:17:56 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-11-06 13:07:37 (GMT) |
commit | e0679bf4aaf3e31d2d8f4dd596fcdd76b0a7ed69 (patch) | |
tree | 1ab2b6ecfd68f195d0cd48369024e7eda5bf4c94 | |
parent | 5667e9b59ab3461c23f0adf35eaf393e4097461a (diff) | |
download | Qt-e0679bf4aaf3e31d2d8f4dd596fcdd76b0a7ed69.zip Qt-e0679bf4aaf3e31d2d8f4dd596fcdd76b0a7ed69.tar.gz Qt-e0679bf4aaf3e31d2d8f4dd596fcdd76b0a7ed69.tar.bz2 |
Add test for QEventTransition when filtering on a QApplication instance
Test for 8ec037effce7f515fffed6b05c011e385fb52593.
Reviewed-by: Gunnar
-rw-r--r-- | tests/auto/qstatemachine/tst_qstatemachine.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 9a2b2ed..fd39515 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -208,6 +208,7 @@ private slots: void task260403_clonedSignals(); void postEventFromOtherThread(); + void eventFilterForApplication(); }; tst_QStateMachine::tst_QStateMachine() @@ -4276,5 +4277,35 @@ void tst_QStateMachine::postEventFromOtherThread() QTRY_COMPARE(finishedSpy.count(), 1); } +void tst_QStateMachine::eventFilterForApplication() +{ + QStateMachine machine; + + QState *s1 = new QState(&machine); + { + machine.setInitialState(s1); + } + + QState *s2 = new QState(&machine); + + QEventTransition *transition = new QEventTransition(QCoreApplication::instance(), + QEvent::ApplicationActivate); + transition->setTargetState(s2); + s1->addTransition(transition); + + machine.start(); + QCoreApplication::processEvents(); + + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s1)); + + QCoreApplication::postEvent(QCoreApplication::instance(), + new QEvent(QEvent::ApplicationActivate)); + QCoreApplication::processEvents(); + + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s2)); +} + QTEST_MAIN(tst_QStateMachine) #include "tst_qstatemachine.moc" |