summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-03-21 09:00:01 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-03-21 09:00:01 (GMT)
commitdeefcaaa5bfaf22ee31ae9da2965ab627b0c43b5 (patch)
treef6d8171283540eb887aeb4fd7727d7ab8e720459 /tests
parentfd110f31ce6b50b5258e6066073276a858fb88cd (diff)
parent521a13e3f0a66c31bbf95304de3c7384042a39aa (diff)
downloadQt-deefcaaa5bfaf22ee31ae9da2965ab627b0c43b5.zip
Qt-deefcaaa5bfaf22ee31ae9da2965ab627b0c43b5.tar.gz
Qt-deefcaaa5bfaf22ee31ae9da2965ab627b0c43b5.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Fix writing to an attached property from script.
Diffstat (limited to 'tests')
-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 40b0e1b..48466d5 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -639,15 +639,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()