From 5f50a7b7e40acada275a39ddadd80da7a75ed2b6 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 14 May 2009 18:14:28 +1000 Subject: Add id shortcut test --- .../qmlbindengine/idShortcutInvalidates.1.txt | 10 ++++++++++ .../qmlbindengine/idShortcutInvalidates.txt | 9 +++++++++ .../qmlbindengine/tst_qmlbindengine.cpp | 22 ++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt create mode 100644 tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt diff --git a/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt new file mode 100644 index 0000000..2687465 --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt @@ -0,0 +1,10 @@ +MyQmlObject { + objectProperty: if(1) OtherObject + + property var obj + + obj: Object { + id: OtherObject + } +} + diff --git a/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt new file mode 100644 index 0000000..4aa20ae --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt @@ -0,0 +1,9 @@ +MyQmlObject { + objectProperty: OtherObject + + property var obj + + obj: Object { + id: OtherObject + } +} diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp index dd82d4f..a0554f3 100644 --- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp +++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp @@ -15,6 +15,7 @@ public: tst_qmlbindengine() {} private slots: + void idShortcutInvalidates(); void boolPropertiesEvaluateAsBool(); void methods(); void signalAssignment(); @@ -29,6 +30,27 @@ private: QmlEngine engine; }; +void tst_qmlbindengine::idShortcutInvalidates() +{ + { + QmlComponent component(&engine, TEST_FILE("idShortcutInvalidates.txt")); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QVERIFY(object->objectProperty() != 0); + delete object->objectProperty(); + QVERIFY(object->objectProperty() == 0); + } + + { + QmlComponent component(&engine, TEST_FILE("idShortcutInvalidates.1.txt")); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QVERIFY(object->objectProperty() != 0); + delete object->objectProperty(); + QVERIFY(object->objectProperty() == 0); + } +} + void tst_qmlbindengine::boolPropertiesEvaluateAsBool() { { -- cgit v0.12