aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-04-05 13:30:56 +0200
committerUlf Hermann <ulf.hermann@qt.io>2024-04-05 20:38:07 +0200
commit0d1462b3ae8b7cf7975828afc6009d6934c20608 (patch)
treea81f8d557f182d1aef76a64e7235aa39c3ecfdf2 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent06b3a0e6d26a55ce92351f3239c93d75ecea49d7 (diff)
QmlCompiler: Handle scripts as type lookups on GetLookup
This can happen if you lookup a script from a type namespace. The type lookup already has facilities for handling (or rather rejecting) it. Pick-to: 6.7 6.5 Fixes: QTBUG-123050 Change-Id: I092b1d2f47edc152b4f3967b4eaf4620a81ce5ef Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 22e04e0df3..980ff1986b 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -112,6 +112,7 @@ private slots:
void functionLookup();
void functionReturningVoid();
void functionTakingVar();
+ void getLookupOfScript();
void getOptionalLookup();
void getOptionalLookup_data();
void getOptionalLookupOnQJSValueNonStrict();
@@ -2110,6 +2111,16 @@ void tst_QmlCppCodegen::functionTakingVar()
QCOMPARE(o->property("c"), QVariant::fromValue<int>(11));
}
+void tst_QmlCppCodegen::getLookupOfScript()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/NotificationItem.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+ QCOMPARE(o->objectName(), u"heading"_s);
+}
+
void tst_QmlCppCodegen::getOptionalLookup_data()
{
QTest::addColumn<QString>("propertyName");