summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-01-18 00:01:01 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-01-18 00:03:16 (GMT)
commit57201d97635d02eadf7d41d334425aa4d53083d2 (patch)
tree3188e91ebc9680b7637aa9da1cba508b945ef880 /tests/auto/declarative
parente3a49db846fb5c59173256a3b758a2c00a3476b9 (diff)
downloadQt-57201d97635d02eadf7d41d334425aa4d53083d2.zip
Qt-57201d97635d02eadf7d41d334425aa4d53083d2.tar.gz
Qt-57201d97635d02eadf7d41d334425aa4d53083d2.tar.bz2
Autotest for non-existent properties specified in a PropertyChanges.
Task-number: QTBUG-7394
Diffstat (limited to 'tests/auto/declarative')
-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"