From f7e29f7d2757e6ac577aea998f53ba6745b0e75d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 11 Feb 2025 12:12:16 +0100 Subject: QtQml: Clean up qmldir redirection We need to perform the redirection before inserting imports into namespaces. Through the redirection we might discover a module that we have already imported before. In that case we must not import it again. Pick-to: 6.9 6.8 Fixes: QTBUG-133587 Change-Id: I47a279461763b5397137002a9e7c7d3bfc7ad15d Reviewed-by: Fabian Kosmale --- tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp') diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 8216bf0125..d3f917e280 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -187,6 +187,7 @@ private slots: void multiDirectory(); void multiForeign(); void multiLookup(); + void multiRedirect(); void multipleCtors(); void namespaceWithEnum(); void noBuiltinsImport(); @@ -3804,6 +3805,18 @@ void tst_QmlCppCodegen::multiLookup() QCOMPARE(quitSpy.size(), 1); } +void tst_QmlCppCodegen::multiRedirect() +{ + QQmlEngine engine; + QQmlComponent component(&engine, QUrl(u"qrc:/qt/qml/TestTypes/multiRedirect.qml"_s)); + QVERIFY2(!component.isError(), qPrintable(component.errorString())); + + QScopedPointer object(component.create()); + QVERIFY(!object.isNull()); + + QCOMPARE(object->objectName(), u"green"_s); +} + void tst_QmlCppCodegen::multipleCtors() { QQmlEngine engine; -- cgit v1.2.3