From b4001abf71b3335cedfaf72ca3b7f25ea46be35c Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 2 Oct 2009 18:37:42 +1000 Subject: Add attached property ECMAScript test --- .../declarative/qmlecmascript/data/attachedProperty.qml | 11 +++++++++++ tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/auto/declarative/qmlecmascript/data/attachedProperty.qml diff --git a/tests/auto/declarative/qmlecmascript/data/attachedProperty.qml b/tests/auto/declarative/qmlecmascript/data/attachedProperty.qml new file mode 100644 index 0000000..c5088e3 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/attachedProperty.qml @@ -0,0 +1,11 @@ +import Qt.test 1.0 +import Qt.test 1.0 as Namespace + +MyQmlObject { + id: Me + property int a: MyQmlObject.value + property int b: Namespace.MyQmlObject.value + property int c: Me.Namespace.MyQmlObject.value + property int d: Me.Namespace.MyQmlObject.value +} + diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index d5d20b6..eca4b92 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -44,6 +44,7 @@ private slots: void objectPropertiesTriggerReeval(); void deferredProperties(); void extensionObjects(); + void attachedProperties(); void enums(); void valueTypeFunctions(); void constantsOverrideBindings(); @@ -379,6 +380,19 @@ void tst_qmlecmascript::extensionObjects() QCOMPARE(object->baseProperty(), 92); } +void tst_qmlecmascript::attachedProperties() +{ + QmlComponent component(&engine, TEST_FILE("attachedProperty.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("a").toInt(), 19); + QCOMPARE(object->property("b").toInt(), 19); + QCOMPARE(object->property("c").toInt(), 19); + QCOMPARE(object->property("d").toInt(), 19); + + // ### Need to test attached property assignment +} + void tst_qmlecmascript::enums() { // Existant enums -- cgit v0.12