aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2024-04-23 16:31:58 +0200
committerSami Shalayel <sami.shalayel@qt.io>2024-04-24 16:49:06 +0200
commit5fdd8793c2adc7c2c93f5d02ef33044dc784afa4 (patch)
treeb449275e0b1f5ab005c2daf7e9f344ec13420f1f /tests
parent73a2843dadb5819090e98259806ce4c1a8057f0a (diff)
cmake: fix .qmlls.ini generation for dotted uris
QML Modules with dotted URIs actually should not have .qmlls.ini point the QML modules build folder, but to the build folder from which qmlls can actually find the QML module. For example, a QML module called Dotted.Uri.Hello.World should have the build directory `<buildfolder>/` instead of `<buildfolder>/Dotted/Uri/Hello/World`. Add tests for that, and pick back to 6.7 where the feature was introduced. Pick-to: 6.7 Fixes: QTBUG-124521 Change-Id: I95cf8e0d5894c5ad2c6f3117224d0a1a76cf531f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/CMakeLists.txt1
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/CMakeLists.txt4
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/CMakeLists.txt9
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/CMakeLists.txt4
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/CMakeLists.txt7
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/Main.qml4
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Main.qml4
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/main.cpp33
8 files changed, 66 insertions, 0 deletions
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/CMakeLists.txt b/tests/auto/cmake/test_generate_qmlls_ini/CMakeLists.txt
index d841a1beb5..f0fa09a66a 100644
--- a/tests/auto/cmake/test_generate_qmlls_ini/CMakeLists.txt
+++ b/tests/auto/cmake/test_generate_qmlls_ini/CMakeLists.txt
@@ -14,6 +14,7 @@ target_link_libraries(tst_generate_qmlls_ini PRIVATE Qt6::Test)
set(QT_QML_GENERATE_QMLLS_INI ON CACHE BOOL "" FORCE)
add_subdirectory(SomeSubfolder)
+add_subdirectory(Dotted)
qt_add_qml_module(tst_generate_qmlls_ini
URI MainModule
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/CMakeLists.txt b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/CMakeLists.txt
new file mode 100644
index 0000000000..e3d4518aae
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+add_subdirectory(Uri)
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/CMakeLists.txt b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/CMakeLists.txt
new file mode 100644
index 0000000000..a2edbc25ce
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_add_qml_module(DottedUri
+ URI Dotted.Uri
+ QML_FILES Main.qml
+)
+
+add_subdirectory(Hello)
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/CMakeLists.txt b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/CMakeLists.txt
new file mode 100644
index 0000000000..ecceec7e73
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+add_subdirectory(World)
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/CMakeLists.txt b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/CMakeLists.txt
new file mode 100644
index 0000000000..338674bc93
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_add_qml_module(DottedUri2
+ URI Dotted.Uri.Hello.World
+ QML_FILES Main.qml
+)
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/Main.qml b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/Main.qml
new file mode 100644
index 0000000000..f97cbcf115
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/Main.qml
@@ -0,0 +1,4 @@
+import QtQuick
+
+Item {
+}
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Main.qml b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Main.qml
new file mode 100644
index 0000000000..f97cbcf115
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Main.qml
@@ -0,0 +1,4 @@
+import QtQuick
+
+Item {
+}
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/main.cpp b/tests/auto/cmake/test_generate_qmlls_ini/main.cpp
index 33cf424a2d..a7bdbf1e18 100644
--- a/tests/auto/cmake/test_generate_qmlls_ini/main.cpp
+++ b/tests/auto/cmake/test_generate_qmlls_ini/main.cpp
@@ -45,6 +45,7 @@ void tst_generate_qmlls_ini::qmllsIniAreCorrect()
secondFolder.absolutePath()));
}
+ {
QDir sourceSubfolder = source;
QVERIFY(sourceSubfolder.cd(u"SomeSubfolder"_s));
QDir buildSubfolder(build.absolutePath().append(u"/SomeSubfolder/qml/Some/Sub/Folder"_s));
@@ -56,6 +57,38 @@ void tst_generate_qmlls_ini::qmllsIniAreCorrect()
QCOMPARE(fileContent,
u"[General]\nbuildDir=%1\nno-cmake-calls=false\n"_s.arg(buildSubfolder.absolutePath()));
}
+ }
+
+ {
+ QDir dottedUriSubfolder = source;
+ QVERIFY(dottedUriSubfolder.cd(u"Dotted"_s));
+ QVERIFY(dottedUriSubfolder.cd(u"Uri"_s));
+ {
+ auto file = QFile(dottedUriSubfolder.absoluteFilePath(qmllsIniName));
+ QVERIFY(file.exists());
+ QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
+ const auto fileContent = QString::fromUtf8(file.readAll());
+ QCOMPARE(
+ fileContent,
+ u"[General]\nbuildDir=%1\nno-cmake-calls=false\n"_s.arg(build.absolutePath()));
+ }
+ }
+ {
+ QDir dottedUriSubfolder = source;
+ QVERIFY(dottedUriSubfolder.cd(u"Dotted"_s));
+ QVERIFY(dottedUriSubfolder.cd(u"Uri"_s));
+ QVERIFY(dottedUriSubfolder.cd(u"Hello"_s));
+ QVERIFY(dottedUriSubfolder.cd(u"World"_s));
+ {
+ auto file = QFile(dottedUriSubfolder.absoluteFilePath(qmllsIniName));
+ QVERIFY(file.exists());
+ QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
+ const auto fileContent = QString::fromUtf8(file.readAll());
+ QCOMPARE(
+ fileContent,
+ u"[General]\nbuildDir=%1\nno-cmake-calls=false\n"_s.arg(build.absolutePath()));
+ }
+ }
}
QTEST_MAIN(tst_generate_qmlls_ini)