aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
-rw-r--r--tests/auto/qml/qqmllanguage/data/scriptString7.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp22
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/scriptString7.qml b/tests/auto/qml/qqmllanguage/data/scriptString7.qml
new file mode 100644
index 0000000000..a9d5b47e2b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scriptString7.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ intProperty: 100;
+ scriptProperty: intProperty;
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index ede499b336..978c8ed089 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -1888,6 +1888,28 @@ void tst_qqmllanguage::scriptString()
QVERIFY(object != 0);
QCOMPARE(object->scriptProperty().isUndefinedLiteral(), true);
}
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptString7.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QQmlScriptString ss = object->scriptProperty();
+
+ {
+ QQmlExpression expr(ss, /*context*/0, object);
+ QCOMPARE(expr.evaluate().toInt(), int(100));
+ }
+
+ {
+ SimpleObjectWithCustomParser testScope;
+ QVERIFY(testScope.metaObject()->indexOfProperty("intProperty") != object->metaObject()->indexOfProperty("intProperty"));
+
+ testScope.setIntProperty(42);
+ QQmlExpression expr(ss, /*context*/0, &testScope);
+ QCOMPARE(expr.evaluate().toInt(), int(42));
+ }
+ }
}
// Check that default property assignments are correctly spliced into explicit