aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/thisObject.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp10
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/thisObject.qml b/tests/auto/qml/qqmlecmascript/data/thisObject.qml
new file mode 100644
index 0000000000..c93d0302cf
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/thisObject.qml
@@ -0,0 +1,10 @@
+import QtQml 2.0
+QtObject {
+ property int value: 1
+ property QtObject subObject: QtObject {
+ property int value: 2
+ property int test: {
+ return this.value;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index b1cf8c905f..f4641145ab 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -307,6 +307,7 @@ private slots:
void numberParsing();
void stringParsing();
void qtbug_32801();
+ void thisObject();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -7311,6 +7312,15 @@ void tst_qqmlecmascript::qtbug_32801()
QVERIFY(QMetaObject::invokeMethod(obj.data(), "emitTestSignal"));
}
+void tst_qqmlecmascript::thisObject()
+{
+ QQmlComponent component(&engine, testFileUrl("thisObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object);
+ QCOMPARE(qvariant_cast<QObject*>(object->property("subObject"))->property("test").toInt(), 2);
+ delete object;
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"