diff options
author | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-04-23 09:46:02 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-04-23 09:46:02 (GMT) |
commit | ad1441fcb1c66ddafd890c1aa22a631d12c4ee0d (patch) | |
tree | 07eb8ddd0b6976d001486ef536906ff1cdf7bdde /tests | |
parent | 404db2ceac0ad4770c77f42e8f8a9cd003b151a1 (diff) | |
download | Qt-ad1441fcb1c66ddafd890c1aa22a631d12c4ee0d.zip Qt-ad1441fcb1c66ddafd890c1aa22a631d12c4ee0d.tar.gz Qt-ad1441fcb1c66ddafd890c1aa22a631d12c4ee0d.tar.bz2 |
Remove API for setting specific restore policies on states. We have no clear
use case for this, so it has been removed. If the requirement arises we can
add it back in later. Since it no longer makes sense to have it in
QAbstractState, the RestorePolicy enum has been moved to QStateMachine.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qstate/tst_qstate.cpp | 25 | ||||
-rw-r--r-- | tests/auto/qstatemachine/tst_qstatemachine.cpp | 41 |
2 files changed, 28 insertions, 38 deletions
diff --git a/tests/auto/qstate/tst_qstate.cpp b/tests/auto/qstate/tst_qstate.cpp index f79fcd4..f082caf 100644 --- a/tests/auto/qstate/tst_qstate.cpp +++ b/tests/auto/qstate/tst_qstate.cpp @@ -9,9 +9,7 @@ #include "qstate.h" #include "qstatemachine.h" -#include "qactiontransition.h" #include "qsignaltransition.h" -#include "qstateaction.h" // Will try to wait for the condition while allowing event processing #define QTRY_COMPARE(__expr, __expected) \ @@ -45,7 +43,6 @@ private slots: void assignProperty(); void assignPropertyTwice(); void historyInitialState(); - void addEntryAction(); private: bool functionCalled; @@ -214,22 +211,6 @@ public slots: }; -void tst_QState::addEntryAction() -{ - QStateMachine sm; - - TestClass testObject; - - QState *s0 = new QState(sm.rootState()); - s0->addEntryAction(new QStateInvokeMethodAction(&testObject, "slot")); - sm.setInitialState(s0); - - sm.start(); - QCoreApplication::processEvents(); - - QCOMPARE(testObject.called, true); -} - void tst_QState::assignProperty() { QStateMachine machine; @@ -265,11 +246,11 @@ void tst_QState::assignPropertyTwice() QCOMPARE(object->property("fooBar").toInt(), 30); } -class EventTestTransition: public QActionTransition +class EventTestTransition: public QAbstractTransition { public: EventTestTransition(QEvent::Type type, QState *targetState) - : QActionTransition(QList<QAbstractState*>() << targetState), m_type(type) + : QAbstractTransition(QList<QAbstractState*>() << targetState), m_type(type) { } @@ -279,6 +260,8 @@ protected: return e->type() == m_type; } + void onTransition() {} + private: QEvent::Type m_type; diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index bf3ff71..2fa9b1a 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -121,14 +121,17 @@ private slots: void customErrorStateNotInGraph(); void transitionToStateNotInGraph(); void restoreProperties(); + void defaultGlobalRestorePolicy(); void globalRestorePolicySetToRestore(); void globalRestorePolicySetToDoNotRestore(); - void restorePolicyNotInherited(); - void mixedRestoreProperties(); - void setRestorePolicyToDoNotRestore(); - void setGlobalRestorePolicyToGlobalRestore(); - void restorePolicyOnChildState(); + + //void restorePolicyNotInherited(); + //void mixedRestoreProperties(); + //void setRestorePolicyToDoNotRestore(); + //void setGlobalRestorePolicyToGlobalRestore(); + //void restorePolicyOnChildState(); + void transitionWithParent(); void simpleAnimation(); @@ -923,22 +926,20 @@ void tst_QStateMachine::restoreProperties() object->setProperty("b", 2); QStateMachine machine; + machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); QState *S1 = new QState(); S1->setObjectName("S1"); S1->assignProperty(object, "a", 3); - S1->setRestorePolicy(QState::RestoreProperties); machine.addState(S1); QState *S2 = new QState(); S2->setObjectName("S2"); S2->assignProperty(object, "b", 5); - S2->setRestorePolicy(QState::RestoreProperties); machine.addState(S2); QState *S3 = new QState(); S3->setObjectName("S3"); - S3->setRestorePolicy(QState::RestoreProperties); machine.addState(S3); QFinalState *S4 = new QFinalState(); @@ -1668,6 +1669,7 @@ void tst_QStateMachine::defaultGlobalRestorePolicy() QCOMPARE(propertyHolder->property("b").toInt(), 4); } +/* void tst_QStateMachine::restorePolicyNotInherited() { QStateMachine machine; @@ -1714,12 +1716,12 @@ void tst_QStateMachine::restorePolicyNotInherited() QCOMPARE(propertyHolder->property("a").toInt(), 3); QCOMPARE(propertyHolder->property("b").toInt(), 4); -} +}*/ void tst_QStateMachine::globalRestorePolicySetToDoNotRestore() { QStateMachine machine; - machine.setGlobalRestorePolicy(QState::DoNotRestoreProperties); + machine.setGlobalRestorePolicy(QStateMachine::DoNotRestoreProperties); QObject *propertyHolder = new QObject(); propertyHolder->setProperty("a", 1); @@ -1756,6 +1758,7 @@ void tst_QStateMachine::globalRestorePolicySetToDoNotRestore() QCOMPARE(propertyHolder->property("b").toInt(), 4); } +/* void tst_QStateMachine::setRestorePolicyToDoNotRestore() { QObject *object = new QObject(); @@ -1812,19 +1815,20 @@ void tst_QStateMachine::setGlobalRestorePolicyToGlobalRestore() { s_countWarnings = false; QStateMachine machine; - machine.setGlobalRestorePolicy(QState::GlobalRestorePolicy); + machine.setGlobalRestorePolicy(QStateMachine::GlobalRestorePolicy); - QCOMPARE(machine.globalRestorePolicy(), QState::DoNotRestoreProperties); + QCOMPARE(machine.globalRestorePolicy(), QStateMachine::DoNotRestoreProperties); QCOMPARE(s_msgType, QtWarningMsg); s_msgType = QtDebugMsg; - machine.setGlobalRestorePolicy(QState::RestoreProperties); - machine.setGlobalRestorePolicy(QState::GlobalRestorePolicy); + machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); + machine.setGlobalRestorePolicy(QStateMachine::GlobalRestorePolicy); - QCOMPARE(machine.globalRestorePolicy(), QState::RestoreProperties); + QCOMPARE(machine.globalRestorePolicy(), QStateMachine::RestoreProperties); QCOMPARE(s_msgType, QtWarningMsg); } + void tst_QStateMachine::restorePolicyOnChildState() { QStateMachine machine; @@ -1873,11 +1877,12 @@ void tst_QStateMachine::restorePolicyOnChildState() QCOMPARE(propertyHolder->property("a").toInt(), 1); QCOMPARE(propertyHolder->property("b").toInt(), 2); } +*/ void tst_QStateMachine::globalRestorePolicySetToRestore() { QStateMachine machine; - machine.setGlobalRestorePolicy(QState::RestoreProperties); + machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); QObject *propertyHolder = new QObject(); propertyHolder->setProperty("a", 1); @@ -1914,6 +1919,7 @@ void tst_QStateMachine::globalRestorePolicySetToRestore() QCOMPARE(propertyHolder->property("b").toInt(), 2); } +/* void tst_QStateMachine::mixedRestoreProperties() { QStateMachine machine; @@ -1980,6 +1986,7 @@ void tst_QStateMachine::mixedRestoreProperties() // Enter s3, restore QCOMPARE(propertyHolder->property("a").toInt(), 5); } +*/ void tst_QStateMachine::transitionWithParent() { @@ -2224,7 +2231,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation() void tst_QStateMachine::animatedGlobalRestoreProperty() { QStateMachine machine; - machine.setGlobalRestorePolicy(QState::RestoreProperties); + machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); QObject *object = new QObject(); object->setProperty("foo", 1.0); |