summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-05-08 14:37:21 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-05-08 14:37:21 (GMT)
commit98f3ebcf1f6751cb76f9268d33faf0bc5ac70f6e (patch)
treea3923f5ea068066999008eaea8d15a316b99592e /tests/auto
parent110473e9eece3231c3df4fc50c3a958c6c25f2de (diff)
downloadQt-98f3ebcf1f6751cb76f9268d33faf0bc5ac70f6e.zip
Qt-98f3ebcf1f6751cb76f9268d33faf0bc5ac70f6e.tar.gz
Qt-98f3ebcf1f6751cb76f9268d33faf0bc5ac70f6e.tar.bz2
gracefully handle deletion of transition's target state
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index fa49ecb..dbc67d1 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -106,6 +106,7 @@ private slots:
void historyStates();
void startAndStop();
void targetStateWithNoParent();
+ void targetStateDeleted();
void transitionToRootState();
void transitionEntersParent();
@@ -1940,6 +1941,18 @@ void tst_QStateMachine::targetStateWithNoParent()
QCOMPARE(machine.error(), QStateMachine::NoCommonAncestorForTransitionError);
}
+void tst_QStateMachine::targetStateDeleted()
+{
+ QStateMachine machine;
+ QState *s1 = new QState(machine.rootState());
+ s1->setObjectName("s1");
+ QState *s2 = new QState(machine.rootState());
+ QAbstractTransition *trans = s1->addTransition(s2);
+ delete s2;
+ QCOMPARE(trans->targetState(), (QAbstractState*)0);
+ QVERIFY(trans->targetStates().isEmpty());
+}
+
void tst_QStateMachine::defaultGlobalRestorePolicy()
{
QStateMachine machine;