forked from qt-creator/qt-creator
QmlProject: Support QDS. prefix when reading
This patch also includes a small update to skip creating 'shaderTool' object in the json container if it doesn't exist in the qmlproject file. Task-number: QDS-9969 Change-Id: I1b8639c5e0a57aa77cbd417b51d57c1f4910613a Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -10,7 +10,8 @@ namespace QmlProjectManager::Converters {
|
|||||||
using PropsPair = QPair<QString, QStringList>;
|
using PropsPair = QPair<QString, QStringList>;
|
||||||
struct FileProps
|
struct FileProps
|
||||||
{
|
{
|
||||||
const PropsPair image{"image", QStringList{"*.jpeg", "*.jpg", "*.png", "*.svg", "*.hdr", ".ktx"}};
|
const PropsPair image{"image",
|
||||||
|
QStringList{"*.jpeg", "*.jpg", "*.png", "*.svg", "*.hdr", ".ktx"}};
|
||||||
const PropsPair qml{"qml", QStringList{"*.qml"}};
|
const PropsPair qml{"qml", QStringList{"*.qml"}};
|
||||||
const PropsPair qmlDir{"qmldir", QStringList{"qmldir"}};
|
const PropsPair qmlDir{"qmldir", QStringList{"qmldir"}};
|
||||||
const PropsPair javaScr{"javaScript", QStringList{"*.js", "*.ts"}};
|
const PropsPair javaScr{"javaScript", QStringList{"*.js", "*.ts"}};
|
||||||
@@ -153,10 +154,12 @@ QString jsonToQmlProject(const QJsonObject &rootObject)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{ // append ShaderTool object
|
{ // append ShaderTool object
|
||||||
startObject("ShaderTool");
|
if (!shaderConfig["args"].toVariant().toStringList().isEmpty()) {
|
||||||
appendString("args", shaderConfig["args"].toVariant().toStringList().join(" "));
|
startObject("ShaderTool");
|
||||||
appendArray("files", shaderConfig["files"].toVariant().toStringList());
|
appendString("args", shaderConfig["args"].toVariant().toStringList().join(" "));
|
||||||
endObject();
|
appendArray("files", shaderConfig["files"].toVariant().toStringList());
|
||||||
|
endObject();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // append files objects
|
{ // append files objects
|
||||||
@@ -216,18 +219,22 @@ QJsonObject qmlProjectTojson(const Utils::FilePath &projectFile)
|
|||||||
// convert the the non-object props
|
// convert the the non-object props
|
||||||
for (const QString &propName : rootNode->propertyNames()) {
|
for (const QString &propName : rootNode->propertyNames()) {
|
||||||
QJsonObject *currentObj = &rootObject;
|
QJsonObject *currentObj = &rootObject;
|
||||||
QString objKey = propName;
|
QString objKey = QString(propName).remove("QDS.", Qt::CaseInsensitive);
|
||||||
QJsonValue value = rootNode->property(propName).value.toJsonValue();
|
QJsonValue value = rootNode->property(propName).value.toJsonValue();
|
||||||
|
|
||||||
if (propName.contains("language", Qt::CaseInsensitive)) {
|
if (propName.startsWith("mcu.", Qt::CaseInsensitive)) {
|
||||||
|
currentObj = &mcuObject;
|
||||||
|
objKey = QString(propName).remove("MCU.");
|
||||||
|
} else if (propName.contains("language", Qt::CaseInsensitive)) {
|
||||||
currentObj = &languageObject;
|
currentObj = &languageObject;
|
||||||
if (propName.toLower() == "multilanguagesupport") // fixing the camelcase
|
if (propName.contains("multilanguagesupport", Qt::CaseInsensitive))
|
||||||
|
// fixing the camelcase
|
||||||
objKey = "multiLanguageSupport";
|
objKey = "multiLanguageSupport";
|
||||||
} else if (propName.contains("version", Qt::CaseInsensitive)) {
|
} else if (propName.contains("version", Qt::CaseInsensitive)) {
|
||||||
currentObj = &versionObject;
|
currentObj = &versionObject;
|
||||||
if (propName.toLower() == "qdsversion")
|
if (propName.contains("qdsversion", Qt::CaseInsensitive))
|
||||||
objKey = "designStudio";
|
objKey = "designStudio";
|
||||||
else if (propName.toLower() == "quickversion")
|
else if (propName.contains("quickversion", Qt::CaseInsensitive))
|
||||||
objKey = "qtQuick";
|
objKey = "qtQuick";
|
||||||
} else if (propName.contains("widgetapp", Qt::CaseInsensitive)
|
} else if (propName.contains("widgetapp", Qt::CaseInsensitive)
|
||||||
|| propName.contains("fileselector", Qt::CaseInsensitive)
|
|| propName.contains("fileselector", Qt::CaseInsensitive)
|
||||||
@@ -265,7 +272,8 @@ QJsonObject qmlProjectTojson(const Utils::FilePath &projectFile)
|
|||||||
FileProps fileProps;
|
FileProps fileProps;
|
||||||
const QString childNodeName = childNode->name().toLower();
|
const QString childNodeName = childNode->name().toLower();
|
||||||
const QmlJS::SimpleReaderNode::Property childNodeFilter = childNode->property("filter");
|
const QmlJS::SimpleReaderNode::Property childNodeFilter = childNode->property("filter");
|
||||||
const QmlJS::SimpleReaderNode::Property childNodeDirectory = childNode->property("directory");
|
const QmlJS::SimpleReaderNode::Property childNodeDirectory = childNode->property(
|
||||||
|
"directory");
|
||||||
const QmlJS::SimpleReaderNode::Property childNodeFiles = childNode->property("files");
|
const QmlJS::SimpleReaderNode::Property childNodeFiles = childNode->property("files");
|
||||||
const QString childNodeFilterValue = childNodeFilter.value.toString();
|
const QString childNodeFilterValue = childNodeFilter.value.toString();
|
||||||
|
|
||||||
@@ -304,12 +312,12 @@ QJsonObject qmlProjectTojson(const Utils::FilePath &projectFile)
|
|||||||
|
|
||||||
// populate & update filters
|
// populate & update filters
|
||||||
if (filters.isEmpty()) {
|
if (filters.isEmpty()) {
|
||||||
filters = QJsonArray::fromStringList(propsPair.second); // populate the filters with the predefined ones
|
filters = QJsonArray::fromStringList(
|
||||||
|
propsPair.second); // populate the filters with the predefined ones
|
||||||
}
|
}
|
||||||
|
|
||||||
if (childNodeFilter.isValid()) { // append filters from qmlproject (merge)
|
if (childNodeFilter.isValid()) { // append filters from qmlproject (merge)
|
||||||
const QStringList filtersFromProjectFile = childNodeFilterValue.split(
|
const QStringList filtersFromProjectFile = childNodeFilterValue.split(";");
|
||||||
";");
|
|
||||||
for (const QString &filter : filtersFromProjectFile) {
|
for (const QString &filter : filtersFromProjectFile) {
|
||||||
if (!filters.contains(QJsonValue(filter))) {
|
if (!filters.contains(QJsonValue(filter))) {
|
||||||
filters.append(QJsonValue(filter));
|
filters.append(QJsonValue(filter));
|
||||||
@@ -337,7 +345,8 @@ QJsonObject qmlProjectTojson(const Utils::FilePath &projectFile)
|
|||||||
targetObject.insert("files", files);
|
targetObject.insert("files", files);
|
||||||
fileGroupsObject.insert(propsPair.first, targetObject);
|
fileGroupsObject.insert(propsPair.first, targetObject);
|
||||||
} else if (childNode->name().contains("shadertool", Qt::CaseInsensitive)) {
|
} else if (childNode->name().contains("shadertool", Qt::CaseInsensitive)) {
|
||||||
QStringList quotedArgs = childNode->property("args").value.toString().split('\"', Qt::SkipEmptyParts);
|
QStringList quotedArgs
|
||||||
|
= childNode->property("args").value.toString().split('\"', Qt::SkipEmptyParts);
|
||||||
QStringList args;
|
QStringList args;
|
||||||
for (int i = 0; i < quotedArgs.size(); ++i) {
|
for (int i = 0; i < quotedArgs.size(); ++i) {
|
||||||
// Each odd arg in this list is a single quoted argument, which we should
|
// Each odd arg in this list is a single quoted argument, which we should
|
||||||
@@ -351,7 +360,8 @@ QJsonObject qmlProjectTojson(const Utils::FilePath &projectFile)
|
|||||||
shaderToolObject.insert("args", QJsonArray::fromStringList(args));
|
shaderToolObject.insert("args", QJsonArray::fromStringList(args));
|
||||||
shaderToolObject.insert("files", childNode->property("files").value.toJsonValue());
|
shaderToolObject.insert("files", childNode->property("files").value.toJsonValue());
|
||||||
} else {
|
} else {
|
||||||
rootObject.insert(toCamelCase(childNode->name()), nodeToJsonObject(childNode));
|
rootObject.insert(toCamelCase(childNode->name().remove("qds.", Qt::CaseInsensitive)),
|
||||||
|
nodeToJsonObject(childNode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +371,8 @@ QJsonObject qmlProjectTojson(const Utils::FilePath &projectFile)
|
|||||||
rootObject.insert("runConfig", runConfigObject);
|
rootObject.insert("runConfig", runConfigObject);
|
||||||
rootObject.insert("deployment", deploymentObject);
|
rootObject.insert("deployment", deploymentObject);
|
||||||
rootObject.insert("mcuConfig", mcuObject);
|
rootObject.insert("mcuConfig", mcuObject);
|
||||||
rootObject.insert("shaderTool", shaderToolObject);
|
if (!shaderToolObject.isEmpty())
|
||||||
|
rootObject.insert("shaderTool", shaderToolObject);
|
||||||
rootObject.insert("fileVersion", 1);
|
rootObject.insert("fileVersion", 1);
|
||||||
return rootObject;
|
return rootObject;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
|
|
||||||
|
#include <QJsonObject>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QStringList>
|
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QJsonObject>
|
#include <QStringList>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -30,7 +30,6 @@ public:
|
|||||||
|
|
||||||
bool isQt4McuProject() const;
|
bool isQt4McuProject() const;
|
||||||
|
|
||||||
|
|
||||||
QString versionQt() const;
|
QString versionQt() const;
|
||||||
void setVersionQt(const QString &version);
|
void setVersionQt(const QString &version);
|
||||||
|
|
||||||
@@ -102,7 +101,7 @@ private:
|
|||||||
|
|
||||||
// runtime variables
|
// runtime variables
|
||||||
Utils::FilePath m_projectFile; // design studio project file
|
Utils::FilePath m_projectFile; // design studio project file
|
||||||
QJsonObject m_project; // root project object
|
QJsonObject m_project; // root project object
|
||||||
const bool m_skipRewrite;
|
const bool m_skipRewrite;
|
||||||
|
|
||||||
// initializing functions
|
// initializing functions
|
||||||
|
|||||||
@@ -24,11 +24,6 @@ Project {
|
|||||||
QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf"
|
QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderTool {
|
|
||||||
args: ""
|
|
||||||
files: [ ]
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlFiles {
|
QmlFiles {
|
||||||
directory: "."
|
directory: "."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,8 +83,6 @@
|
|||||||
],
|
],
|
||||||
"mainFile": "fileSelectors.qml"
|
"mainFile": "fileSelectors.qml"
|
||||||
},
|
},
|
||||||
"shaderTool": {
|
|
||||||
},
|
|
||||||
"versions": {
|
"versions": {
|
||||||
"qt": "5"
|
"qt": "5"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
import QmlProject
|
||||||
|
|
||||||
|
Project {
|
||||||
|
QDS.mainFile: "content/App.qml"
|
||||||
|
QDS.mainUiFile: "Screen01.ui.qml"
|
||||||
|
|
||||||
|
QDS.qt6Project: true
|
||||||
|
QDS.widgetApp: true
|
||||||
|
QDS.qtForMCUs: true
|
||||||
|
QDS.forceFreeType: true
|
||||||
|
|
||||||
|
QDS.importPaths: [ "imports", "asset_imports" ]
|
||||||
|
QDS.targetDirectory: "/opt/targetDirectory"
|
||||||
|
QDS.fileSelectors: [ "WXGA", "darkTheme", "ShowIndicator"]
|
||||||
|
|
||||||
|
QDS.qdsVersion: "3.9"
|
||||||
|
QDS.quickVersion: "6.2"
|
||||||
|
|
||||||
|
QDS.multilanguageSupport: true
|
||||||
|
QDS.supportedLanguages: ["en" , "fr"]
|
||||||
|
QDS.primaryLanguage: "en"
|
||||||
|
|
||||||
|
QDS.QmlFiles {
|
||||||
|
directory: "content"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.QmlFiles {
|
||||||
|
directory: "imports"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.JavaScriptFiles {
|
||||||
|
directory: "content"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.JavaScriptFiles {
|
||||||
|
directory: "imports"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.ImageFiles {
|
||||||
|
directory: "content"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.Files {
|
||||||
|
filter: "*.conf"
|
||||||
|
files: ["qtquickcontrols2.conf"]
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.Files {
|
||||||
|
filter: "qmldir"
|
||||||
|
directory: "."
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.Files {
|
||||||
|
filter: "*.ttf;*.otf"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.Files {
|
||||||
|
filter: "*.wav;*.mp3"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.Files {
|
||||||
|
filter: "*.mp4"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.Files {
|
||||||
|
filter: "*.glsl;*.glslv;*.glslf;*.vsh;*.fsh;*.vert;*.frag"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.Files {
|
||||||
|
filter: "*.mesh"
|
||||||
|
directory: "asset_imports"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.Files {
|
||||||
|
filter: "*.mesh"
|
||||||
|
directory: "content"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.Files {
|
||||||
|
filter: "*.qml"
|
||||||
|
directory: "asset_imports"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.ImageFiles {
|
||||||
|
directory: "asset_imports"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.Environment {
|
||||||
|
QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf"
|
||||||
|
}
|
||||||
|
|
||||||
|
QDS.ShaderTool {
|
||||||
|
args: "-s --glsl \"100 es,120,150\" --hlsl 50 --msl 12"
|
||||||
|
files: [ "content/shaders/*" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,12 +3,12 @@ import QmlProject
|
|||||||
Project {
|
Project {
|
||||||
mainFile: "content/App.qml"
|
mainFile: "content/App.qml"
|
||||||
mainUiFile: "Screen01.ui.qml"
|
mainUiFile: "Screen01.ui.qml"
|
||||||
|
|
||||||
qt6Project: true
|
qt6Project: true
|
||||||
widgetApp: true
|
widgetApp: true
|
||||||
qtForMCUs: true
|
qtForMCUs: true
|
||||||
forceFreeType: true
|
forceFreeType: true
|
||||||
|
|
||||||
importPaths: [ "imports", "asset_imports" ]
|
importPaths: [ "imports", "asset_imports" ]
|
||||||
targetDirectory: "/opt/targetDirectory"
|
targetDirectory: "/opt/targetDirectory"
|
||||||
fileSelectors: [ "WXGA", "darkTheme", "ShowIndicator"]
|
fileSelectors: [ "WXGA", "darkTheme", "ShowIndicator"]
|
||||||
@@ -19,7 +19,7 @@ Project {
|
|||||||
multilanguageSupport: true
|
multilanguageSupport: true
|
||||||
supportedLanguages: ["en" , "fr"]
|
supportedLanguages: ["en" , "fr"]
|
||||||
primaryLanguage: "en"
|
primaryLanguage: "en"
|
||||||
|
|
||||||
QmlFiles {
|
QmlFiles {
|
||||||
directory: "content"
|
directory: "content"
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
// Copyright (C) 2023 The Qt Company Ltd.
|
// Copyright (C) 2023 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "googletest.h" // IWYU pragma: keep
|
|
||||||
#include "google-using-declarations.h"
|
#include "google-using-declarations.h"
|
||||||
|
#include "googletest.h" // IWYU pragma: keep
|
||||||
|
|
||||||
#include <qmlprojectmanager/buildsystem/projectitem/qmlprojectitem.h>
|
#include <qmlprojectmanager/buildsystem/projectitem/qmlprojectitem.h>
|
||||||
|
|
||||||
@@ -19,28 +19,39 @@ protected:
|
|||||||
projectItemEmpty = std::make_unique<const QmlProjectManager::QmlProjectItem>(
|
projectItemEmpty = std::make_unique<const QmlProjectManager::QmlProjectItem>(
|
||||||
Utils::FilePath::fromString(localTestDataDir + "/getter-setter/empty.qmlproject"), true);
|
Utils::FilePath::fromString(localTestDataDir + "/getter-setter/empty.qmlproject"), true);
|
||||||
|
|
||||||
projectItemNotEmpty = std::make_unique<const QmlProjectManager::QmlProjectItem>(
|
projectItemWithQdsPrefix = std::make_unique<const QmlProjectManager::QmlProjectItem>(
|
||||||
Utils::FilePath::fromString(localTestDataDir + "/getter-setter/notEmpty.qmlproject"),
|
Utils::FilePath::fromString(localTestDataDir
|
||||||
|
+ "/getter-setter/with_qds_prefix.qmlproject"),
|
||||||
|
true);
|
||||||
|
|
||||||
|
projectItemWithoutQdsPrefix = std::make_unique<const QmlProjectManager::QmlProjectItem>(
|
||||||
|
Utils::FilePath::fromString(localTestDataDir
|
||||||
|
+ "/getter-setter/without_qds_prefix.qmlproject"),
|
||||||
true);
|
true);
|
||||||
|
|
||||||
projectItemFileFilters = std::make_unique<const QmlProjectManager::QmlProjectItem>(
|
projectItemFileFilters = std::make_unique<const QmlProjectManager::QmlProjectItem>(
|
||||||
Utils::FilePath::fromString(localTestDataDir + "/file-filters/MaterialBundle.qmlproject"),
|
Utils::FilePath::fromString(localTestDataDir
|
||||||
|
+ "/file-filters/MaterialBundle.qmlproject"),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TearDownTestSuite()
|
static void TearDownTestSuite()
|
||||||
{
|
{
|
||||||
projectItemEmpty.reset();
|
projectItemEmpty.reset();
|
||||||
projectItemNotEmpty.reset();
|
projectItemWithQdsPrefix.reset();
|
||||||
|
projectItemWithoutQdsPrefix.reset();
|
||||||
projectItemFileFilters.reset();
|
projectItemFileFilters.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static inline std::unique_ptr<const QmlProjectManager::QmlProjectItem> projectItemEmpty;
|
static inline std::unique_ptr<const QmlProjectManager::QmlProjectItem> projectItemEmpty;
|
||||||
static inline std::unique_ptr<const QmlProjectManager::QmlProjectItem> projectItemNotEmpty;
|
static inline std::unique_ptr<const QmlProjectManager::QmlProjectItem> projectItemWithQdsPrefix;
|
||||||
std::unique_ptr<QmlProjectManager::QmlProjectItem>
|
static inline std::unique_ptr<const QmlProjectManager::QmlProjectItem>
|
||||||
projectItemSetters = std::make_unique<QmlProjectManager::QmlProjectItem>(
|
projectItemWithoutQdsPrefix;
|
||||||
Utils::FilePath::fromString(localTestDataDir + "/getter-setter/empty.qmlproject"), true);
|
std::unique_ptr<QmlProjectManager::QmlProjectItem> projectItemSetters = std::make_unique<
|
||||||
|
QmlProjectManager::QmlProjectItem>(Utils::FilePath::fromString(
|
||||||
|
localTestDataDir + "/getter-setter/empty.qmlproject"),
|
||||||
|
true);
|
||||||
static inline std::unique_ptr<const QmlProjectManager::QmlProjectItem> projectItemFileFilters;
|
static inline std::unique_ptr<const QmlProjectManager::QmlProjectItem> projectItemFileFilters;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,111 +62,111 @@ auto createAbsoluteFilePaths(const QStringList &fileList)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyMainFileProject)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixMainFileProject)
|
||||||
{
|
{
|
||||||
auto mainFile = projectItemNotEmpty->mainFile();
|
auto mainFile = projectItemWithQdsPrefix->mainFile();
|
||||||
|
|
||||||
ASSERT_THAT(mainFile, Eq("content/App.qml"));
|
ASSERT_THAT(mainFile, Eq("content/App.qml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyMainUIFileProject)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixMainUIFileProject)
|
||||||
{
|
{
|
||||||
auto mainUiFile = projectItemNotEmpty->mainUiFile();
|
auto mainUiFile = projectItemWithQdsPrefix->mainUiFile();
|
||||||
|
|
||||||
ASSERT_THAT(mainUiFile, Eq("Screen01.ui.qml"));
|
ASSERT_THAT(mainUiFile, Eq("Screen01.ui.qml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyMcuProject)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixMcuProject)
|
||||||
{
|
{
|
||||||
auto isMcuProject = projectItemNotEmpty->isQt4McuProject();
|
auto isMcuProject = projectItemWithQdsPrefix->isQt4McuProject();
|
||||||
|
|
||||||
ASSERT_TRUE(isMcuProject);
|
ASSERT_TRUE(isMcuProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyQtVersion)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixQtVersion)
|
||||||
{
|
{
|
||||||
auto qtVersion = projectItemNotEmpty->versionQt();
|
auto qtVersion = projectItemWithQdsPrefix->versionQt();
|
||||||
|
|
||||||
ASSERT_THAT(qtVersion, Eq("6"));
|
ASSERT_THAT(qtVersion, Eq("6"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyQtQuickVersion)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixQtQuickVersion)
|
||||||
{
|
{
|
||||||
auto qtQuickVersion = projectItemNotEmpty->versionQtQuick();
|
auto qtQuickVersion = projectItemWithQdsPrefix->versionQtQuick();
|
||||||
|
|
||||||
ASSERT_THAT(qtQuickVersion, Eq("6.2"));
|
ASSERT_THAT(qtQuickVersion, Eq("6.2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyDesignStudioVersion)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixDesignStudioVersion)
|
||||||
{
|
{
|
||||||
auto designStudioVersion = projectItemNotEmpty->versionDesignStudio();
|
auto designStudioVersion = projectItemWithQdsPrefix->versionDesignStudio();
|
||||||
|
|
||||||
ASSERT_THAT(designStudioVersion, Eq("3.9"));
|
ASSERT_THAT(designStudioVersion, Eq("3.9"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptySourceDirectory)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixSourceDirectory)
|
||||||
{
|
{
|
||||||
auto sourceDirectory = projectItemNotEmpty->sourceDirectory().path();
|
auto sourceDirectory = projectItemWithQdsPrefix->sourceDirectory().path();
|
||||||
|
|
||||||
auto expectedSourceDir = localTestDataDir + "/getter-setter";
|
auto expectedSourceDir = localTestDataDir + "/getter-setter";
|
||||||
|
|
||||||
ASSERT_THAT(sourceDirectory, Eq(expectedSourceDir));
|
ASSERT_THAT(sourceDirectory, Eq(expectedSourceDir));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyTarGetNotEmptyDirectory)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixTarGetWithQdsPrefixDirectory)
|
||||||
{
|
{
|
||||||
auto targetDirectory = projectItemNotEmpty->targetDirectory();
|
auto targetDirectory = projectItemWithQdsPrefix->targetDirectory();
|
||||||
|
|
||||||
ASSERT_THAT(targetDirectory, Eq("/opt/targetDirectory"));
|
ASSERT_THAT(targetDirectory, Eq("/opt/targetDirectory"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyImportPaths)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixImportPaths)
|
||||||
{
|
{
|
||||||
auto importPaths = projectItemNotEmpty->importPaths();
|
auto importPaths = projectItemWithQdsPrefix->importPaths();
|
||||||
|
|
||||||
ASSERT_THAT(importPaths, UnorderedElementsAre("imports", "asset_imports"));
|
ASSERT_THAT(importPaths, UnorderedElementsAre("imports", "asset_imports"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyFileSelectors)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixFileSelectors)
|
||||||
{
|
{
|
||||||
auto fileSelectors = projectItemNotEmpty->fileSelectors();
|
auto fileSelectors = projectItemWithQdsPrefix->fileSelectors();
|
||||||
|
|
||||||
ASSERT_THAT(fileSelectors, UnorderedElementsAre("WXGA", "darkTheme", "ShowIndicator"));
|
ASSERT_THAT(fileSelectors, UnorderedElementsAre("WXGA", "darkTheme", "ShowIndicator"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyMultiLanguageSupport)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixMultiLanguageSupport)
|
||||||
{
|
{
|
||||||
auto multilanguageSupport = projectItemNotEmpty->multilanguageSupport();
|
auto multilanguageSupport = projectItemWithQdsPrefix->multilanguageSupport();
|
||||||
|
|
||||||
ASSERT_TRUE(multilanguageSupport);
|
ASSERT_TRUE(multilanguageSupport);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptySupportedLanguages)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixSupportedLanguages)
|
||||||
{
|
{
|
||||||
auto supportedLanguages = projectItemNotEmpty->supportedLanguages();
|
auto supportedLanguages = projectItemWithQdsPrefix->supportedLanguages();
|
||||||
|
|
||||||
ASSERT_THAT(supportedLanguages, UnorderedElementsAre("en", "fr"));
|
ASSERT_THAT(supportedLanguages, UnorderedElementsAre("en", "fr"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyPrimaryLanguage)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixPrimaryLanguage)
|
||||||
{
|
{
|
||||||
auto primaryLanguage = projectItemNotEmpty->primaryLanguage();
|
auto primaryLanguage = projectItemWithQdsPrefix->primaryLanguage();
|
||||||
;
|
;
|
||||||
|
|
||||||
ASSERT_THAT(primaryLanguage, Eq("en"));
|
ASSERT_THAT(primaryLanguage, Eq("en"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyWidgetApp)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixWidgetApp)
|
||||||
{
|
{
|
||||||
auto widgetApp = projectItemNotEmpty->widgetApp();
|
auto widgetApp = projectItemWithQdsPrefix->widgetApp();
|
||||||
|
|
||||||
ASSERT_TRUE(widgetApp);
|
ASSERT_TRUE(widgetApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyFileList)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixFileList)
|
||||||
{
|
{
|
||||||
QStringList fileList;
|
QStringList fileList;
|
||||||
for (const auto &file : projectItemNotEmpty->files()) {
|
for (const auto &file : projectItemWithQdsPrefix->files()) {
|
||||||
fileList.append(file.path());
|
fileList.append(file.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,33 +175,179 @@ TEST_F(QmlProjectItem, GetNotEmptyFileList)
|
|||||||
ASSERT_THAT(fileList, UnorderedElementsAre(expectedFileList));
|
ASSERT_THAT(fileList, UnorderedElementsAre(expectedFileList));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyShaderToolArgs)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixShaderToolArgs)
|
||||||
{
|
{
|
||||||
auto shaderToolArgs = projectItemNotEmpty->shaderToolArgs();
|
auto shaderToolArgs = projectItemWithQdsPrefix->shaderToolArgs();
|
||||||
|
|
||||||
ASSERT_THAT(shaderToolArgs,
|
ASSERT_THAT(
|
||||||
UnorderedElementsAre("-s", "--glsl", "\"100 es,120,150\"", "--hlsl", "50", "--msl", "12"));
|
shaderToolArgs,
|
||||||
|
UnorderedElementsAre("-s", "--glsl", "\"100 es,120,150\"", "--hlsl", "50", "--msl", "12"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyShaderToolFiles)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixShaderToolFiles)
|
||||||
{
|
{
|
||||||
auto shaderToolFiles = projectItemNotEmpty->shaderToolFiles();
|
auto shaderToolFiles = projectItemWithQdsPrefix->shaderToolFiles();
|
||||||
|
|
||||||
ASSERT_THAT(shaderToolFiles, UnorderedElementsAre("content/shaders/*"));
|
ASSERT_THAT(shaderToolFiles, UnorderedElementsAre("content/shaders/*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyEnvironment)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixEnvironment)
|
||||||
{
|
{
|
||||||
auto env = projectItemNotEmpty->environment();
|
auto env = projectItemWithQdsPrefix->environment();
|
||||||
|
|
||||||
ASSERT_THAT(env,
|
ASSERT_THAT(env,
|
||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
Utils::EnvironmentItem("QT_QUICK_CONTROLS_CONF", "qtquickcontrols2.conf")));
|
Utils::EnvironmentItem("QT_QUICK_CONTROLS_CONF", "qtquickcontrols2.conf")));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QmlProjectItem, GetNotEmptyForceFreeType)
|
TEST_F(QmlProjectItem, GetWithQdsPrefixForceFreeType)
|
||||||
{
|
{
|
||||||
auto forceFreeType = projectItemNotEmpty->forceFreeType();
|
auto forceFreeType = projectItemWithQdsPrefix->forceFreeType();
|
||||||
|
|
||||||
|
ASSERT_TRUE(forceFreeType);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixMainFileProject)
|
||||||
|
{
|
||||||
|
auto mainFile = projectItemWithoutQdsPrefix->mainFile();
|
||||||
|
|
||||||
|
ASSERT_THAT(mainFile, Eq("content/App.qml"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixMainUIFileProject)
|
||||||
|
{
|
||||||
|
auto mainUiFile = projectItemWithoutQdsPrefix->mainUiFile();
|
||||||
|
|
||||||
|
ASSERT_THAT(mainUiFile, Eq("Screen01.ui.qml"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixMcuProject)
|
||||||
|
{
|
||||||
|
auto isMcuProject = projectItemWithoutQdsPrefix->isQt4McuProject();
|
||||||
|
|
||||||
|
ASSERT_TRUE(isMcuProject);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixQtVersion)
|
||||||
|
{
|
||||||
|
auto qtVersion = projectItemWithoutQdsPrefix->versionQt();
|
||||||
|
|
||||||
|
ASSERT_THAT(qtVersion, Eq("6"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixQtQuickVersion)
|
||||||
|
{
|
||||||
|
auto qtQuickVersion = projectItemWithoutQdsPrefix->versionQtQuick();
|
||||||
|
|
||||||
|
ASSERT_THAT(qtQuickVersion, Eq("6.2"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixDesignStudioVersion)
|
||||||
|
{
|
||||||
|
auto designStudioVersion = projectItemWithoutQdsPrefix->versionDesignStudio();
|
||||||
|
|
||||||
|
ASSERT_THAT(designStudioVersion, Eq("3.9"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixSourceDirectory)
|
||||||
|
{
|
||||||
|
auto sourceDirectory = projectItemWithoutQdsPrefix->sourceDirectory().path();
|
||||||
|
|
||||||
|
auto expectedSourceDir = localTestDataDir + "/getter-setter";
|
||||||
|
|
||||||
|
ASSERT_THAT(sourceDirectory, Eq(expectedSourceDir));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixTarGetWithoutQdsPrefixDirectory)
|
||||||
|
{
|
||||||
|
auto targetDirectory = projectItemWithoutQdsPrefix->targetDirectory();
|
||||||
|
|
||||||
|
ASSERT_THAT(targetDirectory, Eq("/opt/targetDirectory"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixImportPaths)
|
||||||
|
{
|
||||||
|
auto importPaths = projectItemWithoutQdsPrefix->importPaths();
|
||||||
|
|
||||||
|
ASSERT_THAT(importPaths, UnorderedElementsAre("imports", "asset_imports"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixFileSelectors)
|
||||||
|
{
|
||||||
|
auto fileSelectors = projectItemWithoutQdsPrefix->fileSelectors();
|
||||||
|
|
||||||
|
ASSERT_THAT(fileSelectors, UnorderedElementsAre("WXGA", "darkTheme", "ShowIndicator"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixMultiLanguageSupport)
|
||||||
|
{
|
||||||
|
auto multilanguageSupport = projectItemWithoutQdsPrefix->multilanguageSupport();
|
||||||
|
|
||||||
|
ASSERT_TRUE(multilanguageSupport);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixSupportedLanguages)
|
||||||
|
{
|
||||||
|
auto supportedLanguages = projectItemWithoutQdsPrefix->supportedLanguages();
|
||||||
|
|
||||||
|
ASSERT_THAT(supportedLanguages, UnorderedElementsAre("en", "fr"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixPrimaryLanguage)
|
||||||
|
{
|
||||||
|
auto primaryLanguage = projectItemWithoutQdsPrefix->primaryLanguage();
|
||||||
|
;
|
||||||
|
|
||||||
|
ASSERT_THAT(primaryLanguage, Eq("en"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixWidgetApp)
|
||||||
|
{
|
||||||
|
auto widgetApp = projectItemWithoutQdsPrefix->widgetApp();
|
||||||
|
|
||||||
|
ASSERT_TRUE(widgetApp);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixFileList)
|
||||||
|
{
|
||||||
|
QStringList fileList;
|
||||||
|
for (const auto &file : projectItemWithoutQdsPrefix->files()) {
|
||||||
|
fileList.append(file.path());
|
||||||
|
}
|
||||||
|
|
||||||
|
auto expectedFileList = localTestDataDir + "/getter-setter/qtquickcontrols2.conf";
|
||||||
|
|
||||||
|
ASSERT_THAT(fileList, UnorderedElementsAre(expectedFileList));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixShaderToolArgs)
|
||||||
|
{
|
||||||
|
auto shaderToolArgs = projectItemWithoutQdsPrefix->shaderToolArgs();
|
||||||
|
|
||||||
|
ASSERT_THAT(
|
||||||
|
shaderToolArgs,
|
||||||
|
UnorderedElementsAre("-s", "--glsl", "\"100 es,120,150\"", "--hlsl", "50", "--msl", "12"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixShaderToolFiles)
|
||||||
|
{
|
||||||
|
auto shaderToolFiles = projectItemWithoutQdsPrefix->shaderToolFiles();
|
||||||
|
|
||||||
|
ASSERT_THAT(shaderToolFiles, UnorderedElementsAre("content/shaders/*"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixEnvironment)
|
||||||
|
{
|
||||||
|
auto env = projectItemWithoutQdsPrefix->environment();
|
||||||
|
|
||||||
|
ASSERT_THAT(env,
|
||||||
|
UnorderedElementsAre(
|
||||||
|
Utils::EnvironmentItem("QT_QUICK_CONTROLS_CONF", "qtquickcontrols2.conf")));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlProjectItem, GetWithoutQdsPrefixForceFreeType)
|
||||||
|
{
|
||||||
|
auto forceFreeType = projectItemWithoutQdsPrefix->forceFreeType();
|
||||||
|
|
||||||
ASSERT_TRUE(forceFreeType);
|
ASSERT_TRUE(forceFreeType);
|
||||||
}
|
}
|
||||||
@@ -524,9 +681,8 @@ TEST_F(QmlProjectItem, TestFileFilters)
|
|||||||
{
|
{
|
||||||
// GIVEN
|
// GIVEN
|
||||||
auto fileListPath = Utils::FilePath::fromString(localTestDataDir + "/file-filters/filelist.txt");
|
auto fileListPath = Utils::FilePath::fromString(localTestDataDir + "/file-filters/filelist.txt");
|
||||||
QStringList fileNameList = QString::fromUtf8(fileListPath.fileContents().value())
|
QStringList fileNameList
|
||||||
.replace("\r\n", "\n")
|
= QString::fromUtf8(fileListPath.fileContents().value()).replace("\r\n", "\n").split("\n");
|
||||||
.split("\n");
|
|
||||||
auto expectedAbsoluteFilePaths = createAbsoluteFilePaths(fileNameList);
|
auto expectedAbsoluteFilePaths = createAbsoluteFilePaths(fileNameList);
|
||||||
|
|
||||||
// WHEN
|
// WHEN
|
||||||
|
|||||||
Reference in New Issue
Block a user