summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-03-19 01:45:47 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-03-21 23:04:58 (GMT)
commit0c1f1b8c8f5641609e1a07622127f4e0780c2247 (patch)
treef59b4736cd7563d1df75bbbbd604218e791c89e1 /tests/auto
parent44b1fc2051df2bfd784ce847ee430edad68e3dbd (diff)
downloadQt-0c1f1b8c8f5641609e1a07622127f4e0780c2247.zip
Qt-0c1f1b8c8f5641609e1a07622127f4e0780c2247.tar.gz
Qt-0c1f1b8c8f5641609e1a07622127f4e0780c2247.tar.bz2
Produce an error when trying to create objects in a PropertyChanges.
State-specific object lifecycle management will be addressed in a future release. Task-number: QTBUG-8318
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/illegalObj.qml12
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp14
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/data/illegalObj.qml b/tests/auto/declarative/qdeclarativestates/data/illegalObj.qml
new file mode 100644
index 0000000..480764e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativestates/data/illegalObj.qml
@@ -0,0 +1,12 @@
+import Qt 4.6
+
+Rectangle {
+ id: myItem
+
+ states : State {
+ PropertyChanges {
+ target: myItem
+ children: Item { id: newItem }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index fe7ec15..9e1d727 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -106,6 +106,7 @@ private slots:
void illegalTempState();
void nonExistantProperty();
void reset();
+ void illegalObjectCreation();
};
void tst_qdeclarativestates::initTestCase()
@@ -964,6 +965,19 @@ void tst_qdeclarativestates::reset()
QVERIFY(text->width() > text->height());
}
+void tst_qdeclarativestates::illegalObjectCreation()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent component(&engine, SRCDIR "/data/illegalObj.qml");
+ QList<QDeclarativeError> errors = component.errors();
+ QVERIFY(errors.count() == 1);
+ const QDeclarativeError &error = errors.at(0);
+ QCOMPARE(error.line(), 9);
+ QCOMPARE(error.column(), 23);
+ QCOMPARE(error.description().toUtf8().constData(), "PropertyChanges does not support creating state-specific objects.");
+}
+
QTEST_MAIN(tst_qdeclarativestates)
#include "tst_qdeclarativestates.moc"