aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2018-02-15 11:51:25 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2018-05-25 09:15:16 +0000
commit8274f78ffd1a7f1b8295e7a4dd653dd107f22acb (patch)
tree62f2e087602ff7001761428b967ed6bd6f48adca /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
parent3b4d27bf55348751ff6b454e834c0d0634d759b4 (diff)
Correctly set this object when calling scope/context functions5.6
When a function is called that is in a QML scope or a QML context, set the 'this' object to the QML scope. Note: this patch is 5.9 specific. 5.11 has a similair issue, but the implementation is quite different, so that needs a separate fix. Task-number: QTBUG-59357 Change-Id: Ia78e012d413c40a094e957f4020502cd055ac286 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> (cherry picked from commit b2420780df98cb3c98553da18a5b1bc5b64e9e83)
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 5f6185ad01..fc54e069aa 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -258,6 +258,8 @@ private slots:
void valueTypeGroupPropertiesInBehavior();
+ void thisInQmlScope();
+
private:
QQmlEngine engine;
QStringList defaultImportPathList;
@@ -4171,6 +4173,19 @@ void tst_qqmllanguage::valueTypeGroupPropertiesInBehavior()
QCOMPARE(animation->property("easing").value<QEasingCurve>().type(), QEasingCurve::InOutQuad);
}
+void tst_qqmllanguage::thisInQmlScope()
+{
+ QQmlEngine engine;
+
+ QQmlComponent component(&engine, testFileUrl("thisInQmlScope.qml"));
+ QTRY_VERIFY(component.isReady());
+ VERIFY_ERRORS(0);
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(!o.isNull());
+ QCOMPARE(o->property("x"), QVariant(42));
+ QCOMPARE(o->property("y"), QVariant(42));
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"