summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/declarative/states/data/nonExistantProp.qml11
-rw-r--r--tests/auto/declarative/states/tst_states.cpp14
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/declarative/states/data/nonExistantProp.qml b/tests/auto/declarative/states/data/nonExistantProp.qml
new file mode 100644
index 0000000..582029d
--- /dev/null
+++ b/tests/auto/declarative/states/data/nonExistantProp.qml
@@ -0,0 +1,11 @@
+import Qt 4.6
+Rectangle {
+ id: MyRectangle
+
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: MyRectangle; colr: "blue" }
+ }
+}
diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp
index 3c89747..bf8948a 100644
--- a/tests/auto/declarative/states/tst_states.cpp
+++ b/tests/auto/declarative/states/tst_states.cpp
@@ -75,6 +75,7 @@ private slots:
void deletingState();
void tempState();
void illegalTempState();
+ void nonExistantProperty();
};
void tst_states::basicChanges()
@@ -857,6 +858,19 @@ void tst_states::illegalTempState()
QCOMPARE(rect->state(), QLatin1String("placed"));
}
+void tst_states::nonExistantProperty()
+{
+ QmlEngine engine;
+
+ QmlComponent rectComponent(&engine, SRCDIR "/data/nonExistantProp.qml");
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QTest::ignoreMessage(QtWarningMsg, "QML PropertyChanges (file://" SRCDIR "/data/nonExistantProp.qml:9:9) Cannot assign to non-existant property \"colr\"");
+ rect->setState("blue");
+ QCOMPARE(rect->state(), QLatin1String("blue"));
+}
+
QTEST_MAIN(tst_states)
#include "tst_states.moc"