aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-02-16 10:59:21 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-02-21 14:27:53 +0100
commit49dc279bdcfb121089aabb86d6475e371a8f9430 (patch)
treeae44ba00b03d93c2e78a0a63c6073991883fc794 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent655087e05d6976bdbe91b40017de4062f67fbcca (diff)
QmlCompiler: Use original scope type for SetLookup
This is in line with what we do for GetLookup. The concrete type can be rewritten by the basic blocks pass, depending on other places where it's used. We want to generate the lookup we've found at type propagation time. The lookup is still valid here. If it wasn't we would have noticed in a later iteration of the type propagation pass. Pick-to: 6.7 Fixes: QTBUG-117798 Change-Id: I0ddb9866e4deec7c5b6a53a5c0f9785b51d47480 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index c9ca1387f2..ccaffbcd72 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -205,6 +205,7 @@ private slots:
void scopeVsObject();
void sequenceToIterable();
void setLookupConversion();
+ void setLookupOriginalScope();
void shadowedAsCasts();
void shadowedMethod();
void shadowedPrimitiveCmpEqNull();
@@ -4161,6 +4162,24 @@ void tst_QmlCppCodegen::setLookupConversion()
QCOMPARE(o->property("value").toInt(), 9);
}
+void tst_QmlCppCodegen::setLookupOriginalScope()
+{
+ QQmlEngine e;
+ QQmlComponent c(&e, QUrl(u"qrc:/qt/qml/TestTypes/setLookupOriginalScope.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+
+ QObject *v = o->property("variable").value<QObject *>();
+ QCOMPARE(v->property("value").toInt(), 0);
+
+ QMetaObject::invokeMethod(o.data(), "trigger");
+ QObject *edit = o->property("edit").value<QObject *>();
+ QVERIFY(edit);
+ QCOMPARE(edit->property("myOutput").value<QObject *>(), v);
+ QCOMPARE(v->property("value").toInt(), 55);
+}
+
void tst_QmlCppCodegen::shadowedAsCasts()
{
QQmlEngine e;