aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBurak Hancerli <burak.hancerli@qt.io>2023-09-25 11:53:11 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2023-09-25 15:43:37 +0000
commita8a58c1747f87bb2ce0d8262c88ea1dafecfa116 (patch)
tree644918808c9a9164fc6efbc899b4c691f4344883
parentbc1d59048277ae4da37cd562a01a4ada2b5618e9 (diff)
QmlProject: Fix skipping some nodes with QDS prefix
This patch also contains the test data and updated test code for the converters to test QDS prefixed version of .qmlproject file. Task-number: QDS-10503 Change-Id: I496ba6f3d4d3cf90e75c2959c4196f4607677ea1 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Aleksei German <aleksei.german@qt.io> (cherry picked from commit d39efd465c93d2c45687f19bf885679f52919ad3) Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r--src/plugins/qmlprojectmanager/buildsystem/projectitem/converters.cpp2
-rw-r--r--tests/unit/tests/unittests/qmlprojectmanager/converters-test.cpp12
-rw-r--r--tests/unit/tests/unittests/qmlprojectmanager/data/README.md6
-rw-r--r--tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.jsontoqml98
-rw-r--r--tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.qmlproject112
-rw-r--r--tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.qmltojson178
6 files changed, 402 insertions, 6 deletions
diff --git a/src/plugins/qmlprojectmanager/buildsystem/projectitem/converters.cpp b/src/plugins/qmlprojectmanager/buildsystem/projectitem/converters.cpp
index 8487c00cd7..d380bedc75 100644
--- a/src/plugins/qmlprojectmanager/buildsystem/projectitem/converters.cpp
+++ b/src/plugins/qmlprojectmanager/buildsystem/projectitem/converters.cpp
@@ -272,7 +272,7 @@ QJsonObject qmlProjectTojson(const Utils::FilePath &projectFile)
if (childNode->name().contains("files", Qt::CaseInsensitive)) {
PropsPair propsPair;
FileProps fileProps;
- const QString childNodeName = childNode->name().toLower();
+ const QString childNodeName = childNode->name().toLower().remove("qds.");
const QmlJS::SimpleReaderNode::Property childNodeFilter = childNode->property("filter");
const QmlJS::SimpleReaderNode::Property childNodeDirectory = childNode->property(
"directory");
diff --git a/tests/unit/tests/unittests/qmlprojectmanager/converters-test.cpp b/tests/unit/tests/unittests/qmlprojectmanager/converters-test.cpp
index 4131ec48a5..a1ad263cf7 100644
--- a/tests/unit/tests/unittests/qmlprojectmanager/converters-test.cpp
+++ b/tests/unit/tests/unittests/qmlprojectmanager/converters-test.cpp
@@ -10,7 +10,7 @@
namespace {
constexpr QLatin1String localTestDataDir{UNITTEST_DIR "/qmlprojectmanager/data"};
-class DataSet : public testing::TestWithParam<QString>
+class QmlProjectConverter : public testing::TestWithParam<QString>
{
public:
void setDataSource(const QString &dataSetName)
@@ -64,10 +64,12 @@ private:
};
INSTANTIATE_TEST_SUITE_P(QmlProjectItem,
- DataSet,
- ::testing::Values(QString("test-set-1"), QString("test-set-2")));
+ QmlProjectConverter,
+ ::testing::Values(QString("test-set-1"),
+ QString("test-set-2"),
+ QString("test-set-3")));
-TEST_P(DataSet, qml_project_to_json)
+TEST_P(QmlProjectConverter, qml_project_to_json)
{
// GIVEN
setDataSource(GetParam());
@@ -82,7 +84,7 @@ TEST_P(DataSet, qml_project_to_json)
ASSERT_THAT(convertedContent, Eq(targetContent));
}
-TEST_P(DataSet, json_to_qml_project)
+TEST_P(QmlProjectConverter, json_to_qml_project)
{
// GIVEN
setDataSource(GetParam());
diff --git a/tests/unit/tests/unittests/qmlprojectmanager/data/README.md b/tests/unit/tests/unittests/qmlprojectmanager/data/README.md
index 0edd94edd9..bffd46b79e 100644
--- a/tests/unit/tests/unittests/qmlprojectmanager/data/README.md
+++ b/tests/unit/tests/unittests/qmlprojectmanager/data/README.md
@@ -25,6 +25,12 @@ Test functions iterate over the "test-set-*" folders and run the tests by using
* **purpose**: testing fileselectors
* **origin**: file selectors example from playground
+### test-set-3
+
+* **purpose**: testing `QDS.` prefixes
+* **origin**: copy of test-set-1
+
+
## File Filters test data
Test data contains an example project folders that file filters will be initialized and tested.
diff --git a/tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.jsontoqml b/tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.jsontoqml
new file mode 100644
index 0000000000..dbd6e4a91a
--- /dev/null
+++ b/tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.jsontoqml
@@ -0,0 +1,98 @@
+// prop: json-converted
+// prop: auto-generated
+
+import QmlProject
+
+Project {
+ mainFile: "content/App.qml"
+ mainUiFile: "content/Screen01.ui.qml"
+ targetDirectory: "/opt/UntitledProject13"
+ widgetApp: true
+ importPaths: [ "imports","asset_imports" ]
+
+ qdsVersion: "4.0"
+ quickVersion: "6.2"
+ qt6Project: true
+ qtForMCUs: true
+
+ multilanguageSupport: true
+ primaryLanguage: "en"
+ supportedLanguages: [ "en" ]
+
+ Environment {
+ QML_COMPAT_RESOLVE_URLS_ON_ASSIGNMENT: "1"
+ QT_AUTO_SCREEN_SCALE_FACTOR: "1"
+ QT_ENABLE_HIGHDPI_SCALING: "0"
+ QT_LOGGING_RULES: "qt.qml.connections=false"
+ QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf"
+ }
+
+ ShaderTool {
+ args: "-s --glsl \"100 es,120,150\" --hlsl 50 --msl 12"
+ files: [ "content/shaders/*" ]
+ }
+
+ QmlFiles {
+ directory: "content"
+ }
+
+ QmlFiles {
+ directory: "imports"
+ }
+
+ QmlFiles {
+ directory: "asset_imports"
+ }
+
+ JavaScriptFiles {
+ directory: "content"
+ }
+
+ JavaScriptFiles {
+ directory: "imports"
+ }
+
+ ImageFiles {
+ directory: "content"
+ }
+
+ ImageFiles {
+ directory: "asset_imports"
+ }
+
+ Files {
+ directory: "."
+ filters: "*.conf"
+ files: [ "qtquickcontrols2.conf" ]
+ }
+
+ Files {
+ directory: "."
+ filters: "*.ttf;*.otf;*.ctf"
+ }
+
+ Files {
+ directory: "asset_imports"
+ filters: "*.mesh"
+ }
+
+ Files {
+ directory: "."
+ filters: "qmldir"
+ }
+
+ Files {
+ directory: "."
+ filters: "*.glsl;*.glslv;*.glslf;*.vsh;*.fsh;*.vert;*.frag;*.trag"
+ }
+
+ Files {
+ directory: "."
+ filters: "*.mp3;*.wav"
+ }
+
+ Files {
+ directory: "."
+ filters: "*.mp4"
+ }
+}
diff --git a/tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.qmlproject b/tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.qmlproject
new file mode 100644
index 0000000000..721dea3d28
--- /dev/null
+++ b/tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.qmlproject
@@ -0,0 +1,112 @@
+import QmlProject
+
+Project {
+ QDS.mainFile: "content/App.qml"
+ QDS.mainUiFile: "content/Screen01.ui.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QDS.QmlFiles {
+ directory: "content"
+ }
+
+ QDS.QmlFiles {
+ directory: "imports"
+ }
+
+ QDS.JavaScriptFiles {
+ directory: "content"
+ }
+
+ QDS.JavaScriptFiles {
+ directory: "imports"
+ }
+
+ QDS.ImageFiles {
+ directory: "content"
+ }
+
+ QDS.ImageFiles {
+ directory: "asset_imports"
+ }
+
+ QDS.Files {
+ filter: "*.conf"
+ files: ["qtquickcontrols2.conf"]
+ }
+
+ QDS.Files {
+ filter: "qmldir"
+ directory: "."
+ }
+
+ QDS.Files {
+ filter: "*.ttf;*.otf;*.ctf"
+ }
+
+ QDS.Files {
+ filter: "*.wav;*.mp3"
+ }
+
+ QDS.Files {
+ filter: "*.mp4"
+ }
+
+ QDS.Files {
+ filter: "*.glsl;*.glslv;*.glslf;*.vsh;*.fsh;*.vert;*.frag;*.trag"
+ }
+
+ QDS.Files {
+ filter: "*.mesh"
+ directory: "asset_imports"
+ }
+
+ QDS.Files {
+ filter: "*.qml"
+ directory: "asset_imports"
+ }
+
+ QDS.Environment {
+ QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf"
+ QT_AUTO_SCREEN_SCALE_FACTOR: "1"
+ QML_COMPAT_RESOLVE_URLS_ON_ASSIGNMENT: "1"
+ QT_LOGGING_RULES: "qt.qml.connections=false"
+ QT_ENABLE_HIGHDPI_SCALING: "0"
+ /* Useful for debugging
+ QSG_VISUALIZE=batches
+ QSG_VISUALIZE=clip
+ QSG_VISUALIZE=changes
+ QSG_VISUALIZE=overdraw
+ */
+ }
+
+ QDS.qt6Project: true
+
+ /* List of plugin directories passed to QML runtime */
+ QDS.importPaths: [ "imports", "asset_imports" ]
+
+ /* Required for deployment */
+ QDS.targetDirectory: "/opt/UntitledProject13"
+
+ QDS.qdsVersion: "4.0"
+
+ QDS.quickVersion: "6.2"
+
+ QDS.qtForMCUs: true
+
+ /* If any modules the project imports require widgets (e.g. QtCharts), widgetApp must be true */
+ QDS.widgetApp: true
+
+ /* args: Specifies command line arguments for qsb tool to generate shaders.
+ files: Specifies target files for qsb tool. If path is included, it must be relative to this file.
+ Wildcard '*' can be used in the file name part of the path.
+ e.g. files: [ "content/shaders/*.vert", "*.frag" ] */
+ QDS.ShaderTool {
+ args: "-s --glsl \"100 es,120,150\" --hlsl 50 --msl 12"
+ files: [ "content/shaders/*" ]
+ }
+
+ QDS.multilanguageSupport: true
+ QDS.supportedLanguages: ["en"]
+ QDS.primaryLanguage: "en"
+
+}
diff --git a/tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.qmltojson b/tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.qmltojson
new file mode 100644
index 0000000000..293b8e9652
--- /dev/null
+++ b/tests/unit/tests/unittests/qmlprojectmanager/data/converter/test-set-3/testfile.qmltojson
@@ -0,0 +1,178 @@
+{
+ "deployment": {
+ "targetDirectory": "/opt/UntitledProject13"
+ },
+ "environment": {
+ "QML_COMPAT_RESOLVE_URLS_ON_ASSIGNMENT": "1",
+ "QT_AUTO_SCREEN_SCALE_FACTOR": "1",
+ "QT_ENABLE_HIGHDPI_SCALING": "0",
+ "QT_LOGGING_RULES": "qt.qml.connections=false",
+ "QT_QUICK_CONTROLS_CONF": "qtquickcontrols2.conf"
+ },
+ "fileGroups": {
+ "config": {
+ "directories": [
+ "."
+ ],
+ "files": [
+ {
+ "name": "qtquickcontrols2.conf"
+ }
+ ],
+ "filters": [
+ "*.conf"
+ ]
+ },
+ "font": {
+ "directories": [
+ "."
+ ],
+ "files": [
+ ],
+ "filters": [
+ "*.ttf",
+ "*.otf",
+ "*.ctf"
+ ]
+ },
+ "image": {
+ "directories": [
+ "content",
+ "asset_imports"
+ ],
+ "files": [
+ ],
+ "filters": [
+ "*.jpeg",
+ "*.jpg",
+ "*.png",
+ "*.svg",
+ "*.hdr",
+ ".ktx"
+ ]
+ },
+ "javaScript": {
+ "directories": [
+ "content",
+ "imports"
+ ],
+ "files": [
+ ],
+ "filters": [
+ "*.js",
+ "*.ts"
+ ]
+ },
+ "meshes": {
+ "directories": [
+ "asset_imports"
+ ],
+ "files": [
+ ],
+ "filters": [
+ "*.mesh"
+ ]
+ },
+ "qml": {
+ "directories": [
+ "content",
+ "imports",
+ "asset_imports"
+ ],
+ "files": [
+ ],
+ "filters": [
+ "*.qml"
+ ]
+ },
+ "qmldir": {
+ "directories": [
+ "."
+ ],
+ "files": [
+ ],
+ "filters": [
+ "qmldir"
+ ]
+ },
+ "shader": {
+ "directories": [
+ "."
+ ],
+ "files": [
+ ],
+ "filters": [
+ "*.glsl",
+ "*.glslv",
+ "*.glslf",
+ "*.vsh",
+ "*.fsh",
+ "*.vert",
+ "*.frag",
+ "*.trag"
+ ]
+ },
+ "sound": {
+ "directories": [
+ "."
+ ],
+ "files": [
+ ],
+ "filters": [
+ "*.mp3",
+ "*.wav"
+ ]
+ },
+ "video": {
+ "directories": [
+ "."
+ ],
+ "files": [
+ ],
+ "filters": [
+ "*.mp4"
+ ]
+ }
+ },
+ "fileVersion": 1,
+ "importPaths": [
+ "imports",
+ "asset_imports"
+ ],
+ "language": {
+ "multiLanguageSupport": true,
+ "primaryLanguage": "en",
+ "supportedLanguages": [
+ "en"
+ ]
+ },
+ "mcuConfig": {
+ "mcuEnabled": true
+ },
+ "runConfig": {
+ "fileSelectors": [
+ ],
+ "mainFile": "content/App.qml",
+ "mainUiFile": "content/Screen01.ui.qml",
+ "widgetApp": true
+ },
+ "shaderTool": {
+ "args": [
+ "-s",
+ "--glsl",
+ "\"100 es,120,150\"",
+ "--hlsl",
+ "50",
+ "--msl",
+ "12"
+ ],
+ "files": [
+ "content/shaders/*"
+ ]
+ },
+ "versions": {
+ "designStudio": "4.0",
+ "qt": "6",
+ "qtQuick": "6.2"
+ }
+}