summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/states/tst_states.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/states/tst_states.cpp')
-rw-r--r--tests/auto/declarative/states/tst_states.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp
index 4847535..17d9263 100644
--- a/tests/auto/declarative/states/tst_states.cpp
+++ b/tests/auto/declarative/states/tst_states.cpp
@@ -72,6 +72,8 @@ private slots:
void incorrectRestoreBug();
void deletingChange();
void deletingState();
+ void tempState();
+ void illegalTempState();
};
void tst_states::basicChanges()
@@ -803,6 +805,33 @@ void tst_states::deletingState()
delete rect;
}
+void tst_states::tempState()
+{
+ QmlEngine engine;
+
+ QmlComponent rectComponent(&engine, SRCDIR "/data/legalTempState.qml");
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QTest::ignoreMessage(QtDebugMsg, "entering placed");
+ QTest::ignoreMessage(QtDebugMsg, "entering idle");
+ rect->setState("placed");
+ QCOMPARE(rect->state(), QLatin1String("idle"));
+}
+
+void tst_states::illegalTempState()
+{
+ QmlEngine engine;
+
+ QmlComponent rectComponent(&engine, SRCDIR "/data/illegalTempState.qml");
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QTest::ignoreMessage(QtWarningMsg, "Can't apply a state change as part of a state definition. ");
+ rect->setState("placed");
+ QCOMPARE(rect->state(), QLatin1String("placed"));
+}
+
QTEST_MAIN(tst_states)
#include "tst_states.moc"