From 57201d97635d02eadf7d41d334425aa4d53083d2 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 18 Jan 2010 10:01:01 +1000 Subject: Autotest for non-existent properties specified in a PropertyChanges. Task-number: QTBUG-7394 --- tests/auto/declarative/states/data/nonExistantProp.qml | 11 +++++++++++ tests/auto/declarative/states/tst_states.cpp | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/auto/declarative/states/data/nonExistantProp.qml 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(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" -- cgit v0.12