summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2011-03-29 04:17:51 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2011-03-29 04:17:51 (GMT)
commit66a1938f34c9b50902e6c88b45fc063abb49830b (patch)
treeea79a39b9076a207fc0ca0508a907d95eb29b3d6 /tests/auto/declarative/qdeclarativeecmascript
parent6567653a003191508ee5561dcd9896cb97cf3ec3 (diff)
parent4da2ba2e788bb63a155e1d10ae559d4366eed875 (diff)
downloadQt-66a1938f34c9b50902e6c88b45fc063abb49830b.zip
Qt-66a1938f34c9b50902e6c88b45fc063abb49830b.tar.gz
Qt-66a1938f34c9b50902e6c88b45fc063abb49830b.tar.bz2
Merge ../qt-qml-staging
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp30
2 files changed, 28 insertions, 8 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml b/tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml
new file mode 100644
index 0000000..31bf69d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml
@@ -0,0 +1,6 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+QtObject {
+ function writeValue2() { MyQmlObject.value2 = 9 }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 2f5581a..f913ab8 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -640,15 +640,29 @@ void tst_qdeclarativeecmascript::overrideExtensionProperties()
void tst_qdeclarativeecmascript::attachedProperties()
{
- QDeclarativeComponent 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);
+ {
+ QDeclarativeComponent 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
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("writeAttachedProperty.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QMetaObject::invokeMethod(object, "writeValue2");
+
+ MyQmlAttachedObject *attached =
+ qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object));
+ QVERIFY(attached != 0);
+
+ QCOMPARE(attached->value2(), 9);
+ }
}
void tst_qdeclarativeecmascript::enums()