forked from qt-creator/qt-creator
QmlDesigner: Add kind to module id
In some cases we need to find out what kind a module is. Task-number: QTCREATORBUG-30735 Change-Id: Ibd5a70ee6fe0f619009fd645f444d3fbb2fd6e01 Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -179,7 +179,7 @@ std::optional<PropertyComponentGenerator::Entry> createEntry(QmlJS::SimpleReader
|
||||
if (moduleName.isEmpty())
|
||||
return {};
|
||||
|
||||
auto module = model->module(moduleName);
|
||||
auto module = model->module(moduleName, Storage::ModuleKind::QmlLibrary);
|
||||
|
||||
auto typeName = getProperty<QByteArray>(node, "typeNames");
|
||||
|
||||
|
@@ -369,7 +369,7 @@ void Edit3DView::handleEntriesChanged()
|
||||
.generatedComponentUtils()
|
||||
.import3dTypePrefix();
|
||||
|
||||
auto assetsModule = model()->module(import3dTypePrefix);
|
||||
auto assetsModule = model()->module(import3dTypePrefix, Storage::ModuleKind::QmlLibrary);
|
||||
|
||||
for (const auto &metaInfo : model()->metaInfosForModule(assetsModule))
|
||||
append(metaInfo, EK_importedModels);
|
||||
|
@@ -770,7 +770,8 @@ void Edit3DWidget::dropEvent(QDropEvent *dropEvent)
|
||||
->documentManager()
|
||||
.generatedComponentUtils()
|
||||
.import3dTypePrefix();
|
||||
auto metaInfo = model->metaInfo(model->module(import3dTypePrefix), fileName.toUtf8());
|
||||
auto moduleId = model->module(import3dTypePrefix, Storage::ModuleKind::QmlLibrary);
|
||||
auto metaInfo = model->metaInfo(moduleId, fileName.toUtf8());
|
||||
if (auto entries = metaInfo.itemLibrariesEntries(); entries.size()) {
|
||||
auto entry = ItemLibraryEntry{entries.front(), *model->projectStorage()};
|
||||
QmlVisualNode::createQml3DNode(view(), entry, m_canvas->activeScene(), {}, false);
|
||||
|
@@ -147,7 +147,7 @@ public:
|
||||
void setMetaInfo(const MetaInfo &metaInfo);
|
||||
#endif
|
||||
|
||||
Module module(Utils::SmallStringView moduleName);
|
||||
Module module(Utils::SmallStringView moduleName, Storage::ModuleKind moduleKind);
|
||||
NodeMetaInfo metaInfo(const TypeName &typeName, int majorVersion = -1, int minorVersion = -1) const;
|
||||
NodeMetaInfo metaInfo(Module module,
|
||||
Utils::SmallStringView typeName,
|
||||
|
@@ -1031,8 +1031,20 @@ TypeName createQualifiedTypeName(const ModelNode &node)
|
||||
auto exportedTypes = node.metaInfo().exportedTypeNamesForSourceId(model->fileUrlSourceId());
|
||||
if (exportedTypes.size()) {
|
||||
const auto &exportedType = exportedTypes.front();
|
||||
Utils::PathString typeName = model->projectStorage()->moduleName(exportedType.moduleId);
|
||||
typeName += '/';
|
||||
using Storage::ModuleKind;
|
||||
auto module = model->projectStorage()->module(exportedType.moduleId);
|
||||
Utils::PathString typeName;
|
||||
switch (module.kind) {
|
||||
case ModuleKind::QmlLibrary:
|
||||
typeName += module.name;
|
||||
typeName += '/';
|
||||
break;
|
||||
case ModuleKind::PathLibrary:
|
||||
break;
|
||||
case ModuleKind::CppLibrary:
|
||||
break;
|
||||
}
|
||||
|
||||
typeName += exportedType.name;
|
||||
|
||||
return typeName.toQByteArray();
|
||||
|
@@ -53,6 +53,8 @@ NodeMetaInfo object will result in an InvalidMetaInfoException being thrown.
|
||||
|
||||
namespace {
|
||||
|
||||
using Storage::ModuleKind;
|
||||
|
||||
auto category = MetaInfoTracing::category;
|
||||
|
||||
struct TypeDescription
|
||||
@@ -2123,13 +2125,13 @@ NodeMetaInfos NodeMetaInfo::prototypes() const
|
||||
}
|
||||
|
||||
namespace {
|
||||
template<const char *moduleName, const char *typeName>
|
||||
template<const char *moduleName, const char *typeName, ModuleKind moduleKind = ModuleKind::QmlLibrary>
|
||||
bool isBasedOnCommonType(NotNullPointer<const ProjectStorageType> projectStorage, TypeId typeId)
|
||||
{
|
||||
if (!typeId)
|
||||
return false;
|
||||
|
||||
auto base = projectStorage->commonTypeId<moduleName, typeName>();
|
||||
auto base = projectStorage->commonTypeId<moduleName, typeName, moduleKind>();
|
||||
|
||||
return projectStorage->isBasedOn(typeId, base);
|
||||
}
|
||||
@@ -3441,7 +3443,7 @@ bool NodeMetaInfo::isQtQuick3DParticlesAbstractShape() const
|
||||
keyValue("type id", m_typeId)};
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D_Particles3D_cppnative, QQuick3DParticleAbstractShape>(
|
||||
return isBasedOnCommonType<QtQuick3D_Particles3D, QQuick3DParticleAbstractShape, ModuleKind::CppLibrary>(
|
||||
m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QQuick3DParticleAbstractShape");
|
||||
@@ -3578,8 +3580,8 @@ bool NodeMetaInfo::isQtQuickStateOperation() const
|
||||
keyValue("type id", m_typeId)};
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_cppnative, QQuickStateOperation>(m_projectStorage,
|
||||
m_typeId);
|
||||
return isBasedOnCommonType<QtQuick, QQuickStateOperation, ModuleKind::CppLibrary>(m_projectStorage,
|
||||
m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("<cpp>.QQuickStateOperation");
|
||||
}
|
||||
@@ -4333,8 +4335,6 @@ PropertyName PropertyMetaInfo::name() const
|
||||
} else {
|
||||
return propertyName();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
bool PropertyMetaInfo::isWritable() const
|
||||
|
@@ -170,10 +170,10 @@ Storage::Imports createStorageImports(const Imports &imports,
|
||||
SourceId fileId)
|
||||
{
|
||||
return Utils::transform<Storage::Imports>(imports, [&](const Import &import) {
|
||||
return Storage::Import{projectStorage.moduleId(Utils::SmallString{import.url()}),
|
||||
import.majorVersion(),
|
||||
import.minorVersion(),
|
||||
fileId};
|
||||
using Storage::ModuleKind;
|
||||
auto moduleKind = import.isLibraryImport() ? ModuleKind::QmlLibrary : ModuleKind::PathLibrary;
|
||||
auto moduleId = projectStorage.moduleId(Utils::SmallString{import.url()}, moduleKind);
|
||||
return Storage::Import{moduleId, import.majorVersion(), import.minorVersion(), fileId};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -390,7 +390,11 @@ ImportedTypeNameId ModelPrivate::importedTypeNameId(Utils::SmallStringView typeN
|
||||
return import.alias() == aliasName;
|
||||
});
|
||||
if (found != m_imports.end()) {
|
||||
ModuleId moduleId = projectStorage->moduleId(Utils::PathString{found->url()});
|
||||
using Storage::ModuleKind;
|
||||
auto moduleKind = found->isLibraryImport() ? ModuleKind::QmlLibrary
|
||||
: ModuleKind::PathLibrary;
|
||||
ModuleId moduleId = projectStorage->moduleId(Utils::PathString{found->url()},
|
||||
moduleKind);
|
||||
ImportId importId = projectStorage->importId(
|
||||
Storage::Import{moduleId, found->majorVersion(), found->minorVersion(), m_sourceId});
|
||||
return projectStorage->importedTypeNameId(importId, shortTypeName);
|
||||
@@ -2623,11 +2627,10 @@ MetaInfo Model::metaInfo()
|
||||
}
|
||||
#endif
|
||||
|
||||
Module Model::module(Utils::SmallStringView moduleName)
|
||||
Module Model::module(Utils::SmallStringView moduleName, Storage::ModuleKind moduleKind)
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
return Module(d->projectStorage->moduleId(moduleName), d->projectStorage);
|
||||
}
|
||||
if constexpr (useProjectStorage())
|
||||
return Module(d->projectStorage->moduleId(moduleName, moduleKind), d->projectStorage);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@@ -1027,9 +1027,25 @@ ModuleIds generateModuleIds(const ModelNodes &nodes)
|
||||
|
||||
QStringList generateImports(ModuleIds moduleIds, const ProjectStorageType &projectStorage)
|
||||
{
|
||||
return Utils::transform<QStringList>(moduleIds, [&](auto id) {
|
||||
return "import " + projectStorage.moduleName(id).toQString();
|
||||
});
|
||||
QStringList imports;
|
||||
imports.reserve(std::ssize(moduleIds));
|
||||
|
||||
for (auto moduleId : moduleIds) {
|
||||
using Storage::ModuleKind;
|
||||
auto module = projectStorage.module(moduleId);
|
||||
switch (module.kind) {
|
||||
case ModuleKind::QmlLibrary:
|
||||
imports.push_back("import " + module.name.toQString());
|
||||
break;
|
||||
case ModuleKind::PathLibrary:
|
||||
imports.push_back("import \"" + module.name.toQString() + "\"");
|
||||
break;
|
||||
case ModuleKind::CppLibrary:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return imports;
|
||||
}
|
||||
|
||||
QStringList generateImports(const ModelNodes &nodes)
|
||||
|
@@ -84,7 +84,6 @@ inline constexpr char PrincipledMaterial[] = "PrincipledMaterial";
|
||||
inline constexpr char PropertyAnimation[] = "PropertyAnimation";
|
||||
inline constexpr char PropertyChanges[] = "PropertyChanges";
|
||||
inline constexpr char QML[] = "QML";
|
||||
inline constexpr char QML_cppnative[] = "QML-cppnative";
|
||||
inline constexpr char QQuick3DParticleAbstractShape[] = "QQuick3DParticleAbstractShape";
|
||||
inline constexpr char QQuickStateOperation[] = "QQuickStateOperation";
|
||||
inline constexpr char QtMultimedia[] = "QtMultimedia";
|
||||
@@ -94,7 +93,6 @@ inline constexpr char QtQml_Models[] = "QtQml.Models";
|
||||
inline constexpr char QtQml_XmlListModel[] = "QtQml.XmlListModel";
|
||||
inline constexpr char QtQuick3D[] = "QtQuick3D";
|
||||
inline constexpr char QtQuick3D_Particles3D[] = "QtQuick3D.Particles3D";
|
||||
inline constexpr char QtQuick3D_Particles3D_cppnative[] = "QtQuick3D.Particles3D-cppnative";
|
||||
inline constexpr char QtQuick[] = "QtQuick";
|
||||
inline constexpr char QtQuick_Controls[] = "QtQuick.Controls";
|
||||
inline constexpr char QtQuick_Dialogs[] = "QtQuick.Dialogs";
|
||||
@@ -104,7 +102,6 @@ inline constexpr char QtQuick_Studio_Components[] = "QtQuick.Studio.Components";
|
||||
inline constexpr char QtQuick_Templates[] = "QtQuick.Templates";
|
||||
inline constexpr char QtQuick_Timeline[] = "QtQuick.Timeline";
|
||||
inline constexpr char QtQuick_Window[] = "QtQuick.Window";
|
||||
inline constexpr char QtQuick_cppnative[] = "QtQuick-cppnative";
|
||||
inline constexpr char Qt_SafeRenderer[] = "Qt.SafeRenderer";
|
||||
inline constexpr char Rectangle[] = "Rectangle";
|
||||
inline constexpr char Repeater[] = "Repeater";
|
||||
@@ -149,7 +146,7 @@ struct BaseCacheType
|
||||
QmlDesigner::TypeId typeId;
|
||||
};
|
||||
|
||||
template<const char *moduleName_, const char *typeName_>
|
||||
template<const char *moduleName_, ModuleKind moduleKind, const char *typeName_>
|
||||
struct CacheType : public BaseCacheType
|
||||
{
|
||||
};
|
||||
@@ -157,106 +154,107 @@ struct CacheType : public BaseCacheType
|
||||
template<typename ProjectStorage>
|
||||
class CommonTypeCache
|
||||
{
|
||||
using CommonTypes = std::tuple<CacheType<FlowView, FlowActionArea>,
|
||||
CacheType<FlowView, FlowDecision>,
|
||||
CacheType<FlowView, FlowItem>,
|
||||
CacheType<FlowView, FlowTransition>,
|
||||
CacheType<FlowView, FlowView>,
|
||||
CacheType<FlowView, FlowWildcard>,
|
||||
CacheType<QML, BoolType>,
|
||||
CacheType<QML, Component>,
|
||||
CacheType<QML, DoubleType>,
|
||||
CacheType<QML, IntType>,
|
||||
CacheType<QML, QtObject>,
|
||||
CacheType<QML, date>,
|
||||
CacheType<QML, string>,
|
||||
CacheType<QML, url>,
|
||||
CacheType<QML, var>,
|
||||
CacheType<QML_cppnative, FloatType>,
|
||||
CacheType<QML_cppnative, UIntType>,
|
||||
CacheType<QtQml, Connections>,
|
||||
CacheType<QtMultimedia, SoundEffect>,
|
||||
CacheType<QtQml_Models, ListElement>,
|
||||
CacheType<QtQml_Models, ListModel>,
|
||||
CacheType<QtQml_XmlListModel, XmlListModelRole>,
|
||||
CacheType<QtQuick, BorderImage>,
|
||||
CacheType<QtQuick, GridView>,
|
||||
CacheType<QtQuick, Image>,
|
||||
CacheType<QtQuick, Item>,
|
||||
CacheType<QtQuick, ListView>,
|
||||
CacheType<QtQuick, Loader>,
|
||||
CacheType<QtQuick, MouseArea>,
|
||||
CacheType<QtQuick, Path>,
|
||||
CacheType<QtQuick, PathView>,
|
||||
CacheType<QtQuick, PauseAnimation>,
|
||||
CacheType<QtQuick, Positioner>,
|
||||
CacheType<QtQuick, PropertyAnimation>,
|
||||
CacheType<QtQuick, PropertyChanges>,
|
||||
CacheType<QtQuick, Rectangle>,
|
||||
CacheType<QtQuick, Repeater>,
|
||||
CacheType<QtQuick, State>,
|
||||
CacheType<QtQuick, StateGroup>,
|
||||
CacheType<QtQuick, Text>,
|
||||
CacheType<QtQuick, TextEdit>,
|
||||
CacheType<QtQuick, Transition>,
|
||||
CacheType<QtQuick, color>,
|
||||
CacheType<QtQuick, font>,
|
||||
CacheType<QtQuick, vector2d>,
|
||||
CacheType<QtQuick, vector3d>,
|
||||
CacheType<QtQuick, vector4d>,
|
||||
CacheType<QtQuick3D, BakedLightmap>,
|
||||
CacheType<QtQuick3D, Buffer>,
|
||||
CacheType<QtQuick3D, Camera>,
|
||||
CacheType<QtQuick3D, Command>,
|
||||
CacheType<QtQuick3D, CubeMapTexture>,
|
||||
CacheType<QtQuick3D, DefaultMaterial>,
|
||||
CacheType<QtQuick3D, DirectionalLight>,
|
||||
CacheType<QtQuick3D, Effect>,
|
||||
CacheType<QtQuick3D, InstanceList>,
|
||||
CacheType<QtQuick3D, InstanceListEntry>,
|
||||
CacheType<QtQuick3D, Light>,
|
||||
CacheType<QtQuick3D, Material>,
|
||||
CacheType<QtQuick3D, Model>,
|
||||
CacheType<QtQuick3D, Node>,
|
||||
CacheType<QtQuick3D, OrthographicCamera>,
|
||||
CacheType<QtQuick3D, Pass>,
|
||||
CacheType<QtQuick3D, PerspectiveCamera>,
|
||||
CacheType<QtQuick3D, PointLight>,
|
||||
CacheType<QtQuick3D, PrincipledMaterial>,
|
||||
CacheType<QtQuick3D, SceneEnvironment>,
|
||||
CacheType<QtQuick3D, Shader>,
|
||||
CacheType<QtQuick3D, SpecularGlossyMaterial>,
|
||||
CacheType<QtQuick3D, SpotLight>,
|
||||
CacheType<QtQuick3D, Texture>,
|
||||
CacheType<QtQuick3D, TextureInput>,
|
||||
CacheType<QtQuick3D, View3D>,
|
||||
CacheType<QtQuick3D_Particles3D, Affector3D>,
|
||||
CacheType<QtQuick3D_Particles3D, Attractor3D>,
|
||||
CacheType<QtQuick3D_Particles3D, Model>,
|
||||
CacheType<QtQuick3D_Particles3D, Particle3D>,
|
||||
CacheType<QtQuick3D_Particles3D, ParticleEmitter3D>,
|
||||
CacheType<QtQuick3D_Particles3D, SpriteParticle3D>,
|
||||
CacheType<QtQuick3D_Particles3D_cppnative, QQuick3DParticleAbstractShape>,
|
||||
CacheType<QtQuick_Controls, Control>,
|
||||
CacheType<QtQuick_Controls, Popup>,
|
||||
CacheType<QtQuick_Controls, SplitView>,
|
||||
CacheType<QtQuick_Controls, SwipeView>,
|
||||
CacheType<QtQuick_Controls, TabBar>,
|
||||
CacheType<QtQuick_Controls, TextArea>,
|
||||
CacheType<QtQuick_Dialogs, Dialog>,
|
||||
CacheType<QtQuick_Extras, Picture>,
|
||||
CacheType<QtQuick_Layouts, Layout>,
|
||||
CacheType<QtQuick_Studio_Components, GroupItem>,
|
||||
CacheType<QtQuick_Studio_Components, JsonListModel>,
|
||||
CacheType<QtQuick_Templates, Control>,
|
||||
CacheType<QtQuick_Timeline, Keyframe>,
|
||||
CacheType<QtQuick_Timeline, KeyframeGroup>,
|
||||
CacheType<QtQuick_Timeline, Timeline>,
|
||||
CacheType<QtQuick_Timeline, TimelineAnimation>,
|
||||
CacheType<QtQuick_cppnative, QQuickStateOperation>,
|
||||
CacheType<Qt_SafeRenderer, SafePicture>,
|
||||
CacheType<Qt_SafeRenderer, SafeRendererPicture>,
|
||||
CacheType<QtQuick_Window, Window>>;
|
||||
using CommonTypes = std::tuple<
|
||||
CacheType<FlowView, ModuleKind::QmlLibrary, FlowActionArea>,
|
||||
CacheType<FlowView, ModuleKind::QmlLibrary, FlowDecision>,
|
||||
CacheType<FlowView, ModuleKind::QmlLibrary, FlowItem>,
|
||||
CacheType<FlowView, ModuleKind::QmlLibrary, FlowTransition>,
|
||||
CacheType<FlowView, ModuleKind::QmlLibrary, FlowView>,
|
||||
CacheType<FlowView, ModuleKind::QmlLibrary, FlowWildcard>,
|
||||
CacheType<QML, ModuleKind::QmlLibrary, BoolType>,
|
||||
CacheType<QML, ModuleKind::QmlLibrary, Component>,
|
||||
CacheType<QML, ModuleKind::QmlLibrary, DoubleType>,
|
||||
CacheType<QML, ModuleKind::QmlLibrary, IntType>,
|
||||
CacheType<QML, ModuleKind::QmlLibrary, QtObject>,
|
||||
CacheType<QML, ModuleKind::QmlLibrary, date>,
|
||||
CacheType<QML, ModuleKind::QmlLibrary, string>,
|
||||
CacheType<QML, ModuleKind::QmlLibrary, url>,
|
||||
CacheType<QML, ModuleKind::QmlLibrary, var>,
|
||||
CacheType<QML, ModuleKind::CppLibrary, FloatType>,
|
||||
CacheType<QML, ModuleKind::CppLibrary, UIntType>,
|
||||
CacheType<QtQml, ModuleKind::QmlLibrary, Connections>,
|
||||
CacheType<QtMultimedia, ModuleKind::QmlLibrary, SoundEffect>,
|
||||
CacheType<QtQml_Models, ModuleKind::QmlLibrary, ListElement>,
|
||||
CacheType<QtQml_Models, ModuleKind::QmlLibrary, ListModel>,
|
||||
CacheType<QtQml_XmlListModel, ModuleKind::QmlLibrary, XmlListModelRole>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, BorderImage>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, GridView>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, Image>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, Item>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, ListView>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, Loader>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, MouseArea>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, Path>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, PathView>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, PauseAnimation>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, Positioner>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, PropertyAnimation>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, PropertyChanges>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, Rectangle>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, Repeater>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, State>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, StateGroup>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, Text>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, TextEdit>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, Transition>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, color>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, font>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, vector2d>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, vector3d>,
|
||||
CacheType<QtQuick, ModuleKind::QmlLibrary, vector4d>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, BakedLightmap>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, Buffer>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, Camera>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, Command>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, CubeMapTexture>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, DefaultMaterial>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, DirectionalLight>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, Effect>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, InstanceList>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, InstanceListEntry>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, Light>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, Material>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, Model>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, Node>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, OrthographicCamera>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, Pass>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, PerspectiveCamera>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, PointLight>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, PrincipledMaterial>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, SceneEnvironment>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, Shader>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, SpecularGlossyMaterial>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, SpotLight>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, Texture>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, TextureInput>,
|
||||
CacheType<QtQuick3D, ModuleKind::QmlLibrary, View3D>,
|
||||
CacheType<QtQuick3D_Particles3D, ModuleKind::QmlLibrary, Affector3D>,
|
||||
CacheType<QtQuick3D_Particles3D, ModuleKind::QmlLibrary, Attractor3D>,
|
||||
CacheType<QtQuick3D_Particles3D, ModuleKind::QmlLibrary, Model>,
|
||||
CacheType<QtQuick3D_Particles3D, ModuleKind::QmlLibrary, Particle3D>,
|
||||
CacheType<QtQuick3D_Particles3D, ModuleKind::QmlLibrary, ParticleEmitter3D>,
|
||||
CacheType<QtQuick3D_Particles3D, ModuleKind::QmlLibrary, SpriteParticle3D>,
|
||||
CacheType<QtQuick3D_Particles3D, ModuleKind::CppLibrary, QQuick3DParticleAbstractShape>,
|
||||
CacheType<QtQuick_Controls, ModuleKind::QmlLibrary, Control>,
|
||||
CacheType<QtQuick_Controls, ModuleKind::QmlLibrary, Popup>,
|
||||
CacheType<QtQuick_Controls, ModuleKind::QmlLibrary, SplitView>,
|
||||
CacheType<QtQuick_Controls, ModuleKind::QmlLibrary, SwipeView>,
|
||||
CacheType<QtQuick_Controls, ModuleKind::QmlLibrary, TabBar>,
|
||||
CacheType<QtQuick_Controls, ModuleKind::QmlLibrary, TextArea>,
|
||||
CacheType<QtQuick_Dialogs, ModuleKind::QmlLibrary, Dialog>,
|
||||
CacheType<QtQuick_Extras, ModuleKind::QmlLibrary, Picture>,
|
||||
CacheType<QtQuick_Layouts, ModuleKind::QmlLibrary, Layout>,
|
||||
CacheType<QtQuick_Studio_Components, ModuleKind::QmlLibrary, GroupItem>,
|
||||
CacheType<QtQuick_Studio_Components, ModuleKind::QmlLibrary, JsonListModel>,
|
||||
CacheType<QtQuick_Templates, ModuleKind::QmlLibrary, Control>,
|
||||
CacheType<QtQuick_Timeline, ModuleKind::QmlLibrary, Keyframe>,
|
||||
CacheType<QtQuick_Timeline, ModuleKind::QmlLibrary, KeyframeGroup>,
|
||||
CacheType<QtQuick_Timeline, ModuleKind::QmlLibrary, Timeline>,
|
||||
CacheType<QtQuick_Timeline, ModuleKind::QmlLibrary, TimelineAnimation>,
|
||||
CacheType<QtQuick, ModuleKind::CppLibrary, QQuickStateOperation>,
|
||||
CacheType<Qt_SafeRenderer, ModuleKind::QmlLibrary, SafePicture>,
|
||||
CacheType<Qt_SafeRenderer, ModuleKind::QmlLibrary, SafeRendererPicture>,
|
||||
CacheType<QtQuick_Window, ModuleKind::QmlLibrary, Window>>;
|
||||
|
||||
public:
|
||||
CommonTypeCache(const ProjectStorage &projectStorage)
|
||||
@@ -283,14 +281,14 @@ public:
|
||||
std::fill(std::begin(m_typesWithoutProperties), std ::end(m_typesWithoutProperties), TypeId{});
|
||||
}
|
||||
|
||||
template<const char *moduleName, const char *typeName>
|
||||
template<const char *moduleName, const char *typeName, ModuleKind moduleKind = ModuleKind::QmlLibrary>
|
||||
TypeId typeId() const
|
||||
{
|
||||
auto &type = std::get<CacheType<moduleName, typeName>>(m_types);
|
||||
auto &type = std::get<CacheType<moduleName, moduleKind, typeName>>(m_types);
|
||||
if (type.typeId)
|
||||
return type.typeId;
|
||||
|
||||
return refreshTypedId(type, moduleName, typeName);
|
||||
return refreshTypedId(type, moduleName, moduleKind, typeName);
|
||||
}
|
||||
|
||||
template<const char *typeName>
|
||||
@@ -307,11 +305,11 @@ public:
|
||||
else if constexpr (std::is_same_v<Type, int>)
|
||||
return typeId<QML, IntType>();
|
||||
else if constexpr (std::is_same_v<Type, uint>)
|
||||
return typeId<QML_cppnative, UIntType>();
|
||||
return typeId<QML, UIntType, ModuleKind::CppLibrary>();
|
||||
else if constexpr (std::is_same_v<Type, bool>)
|
||||
return typeId<QML, BoolType>();
|
||||
else if constexpr (std::is_same_v<Type, float>)
|
||||
return typeId<QML_cppnative, FloatType>();
|
||||
return typeId<QML, FloatType, ModuleKind::CppLibrary>();
|
||||
else if constexpr (std::is_same_v<Type, QString>)
|
||||
return typeId<QML, string>();
|
||||
else if constexpr (std::is_same_v<Type, QDateTime>)
|
||||
@@ -341,10 +339,11 @@ public:
|
||||
private:
|
||||
TypeId refreshTypedId(BaseCacheType &type,
|
||||
::Utils::SmallStringView moduleName,
|
||||
ModuleKind moduleKind,
|
||||
::Utils::SmallStringView typeName) const
|
||||
{
|
||||
if (!type.moduleId)
|
||||
type.moduleId = m_projectStorage.moduleId(moduleName);
|
||||
type.moduleId = m_projectStorage.moduleId(moduleName, moduleKind);
|
||||
|
||||
type.typeId = m_projectStorage.typeId(type.moduleId, typeName, Storage::Version{});
|
||||
|
||||
@@ -353,10 +352,11 @@ private:
|
||||
|
||||
TypeId refreshTypedIdWithoutTransaction(BaseCacheType &type,
|
||||
::Utils::SmallStringView moduleName,
|
||||
::Utils::SmallStringView typeName) const
|
||||
::Utils::SmallStringView typeName,
|
||||
ModuleKind moduleKind) const
|
||||
{
|
||||
if (!type.moduleId)
|
||||
type.moduleId = m_projectStorage.fetchModuleIdUnguarded(moduleName);
|
||||
type.moduleId = m_projectStorage.fetchModuleIdUnguarded(moduleName, moduleKind);
|
||||
|
||||
type.typeId = m_projectStorage.fetchTypeIdByModuleIdAndExportedName(type.moduleId, typeName);
|
||||
|
||||
@@ -371,26 +371,27 @@ private:
|
||||
std::copy(std::begin(typeIds), std::end(typeIds), std::begin(m_typesWithoutProperties));
|
||||
}
|
||||
|
||||
template<const char *moduleName, const char *typeName>
|
||||
template<const char *moduleName, const char *typeName, ModuleKind moduleKind = ModuleKind::QmlLibrary>
|
||||
TypeId typeIdWithoutTransaction() const
|
||||
{
|
||||
auto &type = std::get<CacheType<moduleName, typeName>>(m_types);
|
||||
auto &type = std::get<CacheType<moduleName, moduleKind, typeName>>(m_types);
|
||||
if (type.typeId)
|
||||
return type.typeId;
|
||||
|
||||
return refreshTypedIdWithoutTransaction(type, moduleName, typeName);
|
||||
return refreshTypedIdWithoutTransaction(type, moduleName, typeName, moduleKind);
|
||||
}
|
||||
|
||||
void updateTypeIdsWithoutProperties()
|
||||
{
|
||||
setupTypeIdsWithoutProperties({typeIdWithoutTransaction<QML, BoolType>(),
|
||||
typeIdWithoutTransaction<QML, IntType>(),
|
||||
typeIdWithoutTransaction<QML_cppnative, UIntType>(),
|
||||
typeIdWithoutTransaction<QML, DoubleType>(),
|
||||
typeIdWithoutTransaction<QML_cppnative, FloatType>(),
|
||||
typeIdWithoutTransaction<QML, date>(),
|
||||
typeIdWithoutTransaction<QML, string>(),
|
||||
typeIdWithoutTransaction<QML, url>()});
|
||||
setupTypeIdsWithoutProperties(
|
||||
{typeIdWithoutTransaction<QML, BoolType>(),
|
||||
typeIdWithoutTransaction<QML, IntType>(),
|
||||
typeIdWithoutTransaction<QML, UIntType, ModuleKind::CppLibrary>(),
|
||||
typeIdWithoutTransaction<QML, DoubleType>(),
|
||||
typeIdWithoutTransaction<QML, FloatType, ModuleKind::CppLibrary>(),
|
||||
typeIdWithoutTransaction<QML, date>(),
|
||||
typeIdWithoutTransaction<QML, string>(),
|
||||
typeIdWithoutTransaction<QML, url>()});
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -235,14 +235,14 @@ struct ProjectStorage::Statements
|
||||
database};
|
||||
Sqlite::WriteStatement<1> deleteEnumerationDeclarationStatement{
|
||||
"DELETE FROM enumerationDeclarations WHERE enumerationDeclarationId=?", database};
|
||||
mutable Sqlite::ReadStatement<1, 1> selectModuleIdByNameStatement{
|
||||
"SELECT moduleId FROM modules WHERE name=? LIMIT 1", database};
|
||||
mutable Sqlite::ReadWriteStatement<1, 1> insertModuleNameStatement{
|
||||
"INSERT INTO modules(name) VALUES(?1) RETURNING moduleId", database};
|
||||
mutable Sqlite::ReadStatement<1, 1> selectModuleNameStatement{
|
||||
"SELECT name FROM modules WHERE moduleId =?1", database};
|
||||
mutable Sqlite::ReadStatement<2> selectAllModulesStatement{"SELECT name, moduleId FROM modules",
|
||||
database};
|
||||
mutable Sqlite::ReadStatement<1, 2> selectModuleIdByNameStatement{
|
||||
"SELECT moduleId FROM modules WHERE kind=?1 AND name=?2 LIMIT 1", database};
|
||||
mutable Sqlite::ReadWriteStatement<1, 2> insertModuleNameStatement{
|
||||
"INSERT INTO modules(kind, name) VALUES(?1, ?2) RETURNING moduleId", database};
|
||||
mutable Sqlite::ReadStatement<2, 1> selectModuleStatement{
|
||||
"SELECT name, kind FROM modules WHERE moduleId =?1", database};
|
||||
mutable Sqlite::ReadStatement<3> selectAllModulesStatement{
|
||||
"SELECT name, kind, moduleId FROM modules", database};
|
||||
mutable Sqlite::ReadStatement<1, 2> selectTypeIdBySourceIdAndNameStatement{
|
||||
"SELECT typeId FROM types WHERE sourceId=?1 and name=?2", database};
|
||||
mutable Sqlite::ReadStatement<1, 3> selectTypeIdByModuleIdsAndExportedNameStatement{
|
||||
@@ -942,9 +942,10 @@ public:
|
||||
auto &modelIdColumn = table.addColumn("moduleId",
|
||||
Sqlite::StrictColumnType::Integer,
|
||||
{Sqlite::PrimaryKey{}});
|
||||
auto &kindColumn = table.addColumn("kind", Sqlite::StrictColumnType::Integer);
|
||||
auto &nameColumn = table.addColumn("name", Sqlite::StrictColumnType::Text);
|
||||
|
||||
table.addUniqueIndex({nameColumn});
|
||||
table.addUniqueIndex({kindColumn, nameColumn});
|
||||
|
||||
table.initialize(database);
|
||||
|
||||
@@ -1207,21 +1208,21 @@ void ProjectStorage::removeObserver(ProjectStorageObserver *observer)
|
||||
observers.removeOne(observer);
|
||||
}
|
||||
|
||||
ModuleId ProjectStorage::moduleId(Utils::SmallStringView moduleName) const
|
||||
ModuleId ProjectStorage::moduleId(Utils::SmallStringView moduleName, Storage::ModuleKind kind) const
|
||||
{
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"get module id"_t,
|
||||
projectStorageCategory(),
|
||||
keyValue("module name", moduleName)};
|
||||
|
||||
auto moduleId = moduleCache.id(moduleName);
|
||||
auto moduleId = moduleCache.id({moduleName, kind});
|
||||
|
||||
tracer.end(keyValue("module id", moduleId));
|
||||
|
||||
return moduleId;
|
||||
}
|
||||
|
||||
Utils::SmallString ProjectStorage::moduleName(ModuleId moduleId) const
|
||||
Storage::Module ProjectStorage::module(ModuleId moduleId) const
|
||||
{
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"get module name"_t,
|
||||
@@ -1231,11 +1232,12 @@ Utils::SmallString ProjectStorage::moduleName(ModuleId moduleId) const
|
||||
if (!moduleId)
|
||||
throw ModuleDoesNotExists{};
|
||||
|
||||
auto moduleName = moduleCache.value(moduleId);
|
||||
auto module = moduleCache.value(moduleId);
|
||||
|
||||
tracer.end(keyValue("module name", moduleName));
|
||||
tracer.end(keyValue("module name", module.name));
|
||||
tracer.end(keyValue("module kind", module.kind));
|
||||
|
||||
return moduleName;
|
||||
return {module.name, module.kind};
|
||||
}
|
||||
|
||||
TypeId ProjectStorage::typeId(ModuleId moduleId,
|
||||
@@ -2168,20 +2170,17 @@ void ProjectStorage::resetForTestsOnly()
|
||||
moduleCache.clearForTestOnly();
|
||||
}
|
||||
|
||||
bool ProjectStorage::moduleNameLess(Utils::SmallStringView first, Utils::SmallStringView second) noexcept
|
||||
{
|
||||
return first < second;
|
||||
}
|
||||
|
||||
ModuleId ProjectStorage::fetchModuleId(Utils::SmallStringView moduleName)
|
||||
ModuleId ProjectStorage::fetchModuleId(Utils::SmallStringView moduleName,
|
||||
Storage::ModuleKind moduleKind)
|
||||
{
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"fetch module id"_t,
|
||||
projectStorageCategory(),
|
||||
keyValue("module name", moduleName)};
|
||||
keyValue("module name", moduleName),
|
||||
keyValue("module kind", moduleKind)};
|
||||
|
||||
auto moduleId = Sqlite::withDeferredTransaction(database, [&] {
|
||||
return fetchModuleIdUnguarded(moduleName);
|
||||
return fetchModuleIdUnguarded(moduleName, moduleKind);
|
||||
});
|
||||
|
||||
tracer.end(keyValue("module id", moduleId));
|
||||
@@ -2189,26 +2188,26 @@ ModuleId ProjectStorage::fetchModuleId(Utils::SmallStringView moduleName)
|
||||
return moduleId;
|
||||
}
|
||||
|
||||
Utils::PathString ProjectStorage::fetchModuleName(ModuleId id)
|
||||
Storage::Module ProjectStorage::fetchModule(ModuleId id)
|
||||
{
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"fetch module name"_t,
|
||||
projectStorageCategory(),
|
||||
keyValue("module id", id)};
|
||||
|
||||
auto moduleName = Sqlite::withDeferredTransaction(database,
|
||||
[&] { return fetchModuleNameUnguarded(id); });
|
||||
auto module = Sqlite::withDeferredTransaction(database, [&] { return fetchModuleUnguarded(id); });
|
||||
|
||||
tracer.end(keyValue("module name", moduleName));
|
||||
tracer.end(keyValue("module name", module.name));
|
||||
tracer.end(keyValue("module name", module.kind));
|
||||
|
||||
return moduleName;
|
||||
return module;
|
||||
}
|
||||
|
||||
ProjectStorage::Modules ProjectStorage::fetchAllModules() const
|
||||
ProjectStorage::ModuleCacheEntries ProjectStorage::fetchAllModules() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"fetch all modules"_t, projectStorageCategory()};
|
||||
|
||||
return s->selectAllModulesStatement.valuesWithTransaction<Module, 128>();
|
||||
return s->selectAllModulesStatement.valuesWithTransaction<ModuleCacheEntry, 128>();
|
||||
}
|
||||
|
||||
void ProjectStorage::callRefreshMetaInfoCallback(const TypeIds &deletedTypeIds)
|
||||
@@ -2644,38 +2643,41 @@ void ProjectStorage::synchromizeModuleExportedImports(
|
||||
Sqlite::insertUpdateDelete(range, moduleExportedImports, compareKey, insert, update, remove);
|
||||
}
|
||||
|
||||
ModuleId ProjectStorage::fetchModuleIdUnguarded(Utils::SmallStringView name) const
|
||||
ModuleId ProjectStorage::fetchModuleIdUnguarded(Utils::SmallStringView name,
|
||||
Storage::ModuleKind kind) const
|
||||
{
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"fetch module id ungarded"_t,
|
||||
projectStorageCategory(),
|
||||
keyValue("module name", name)};
|
||||
keyValue("module name", name),
|
||||
keyValue("module kind", kind)};
|
||||
|
||||
auto moduleId = s->selectModuleIdByNameStatement.value<ModuleId>(name);
|
||||
auto moduleId = s->selectModuleIdByNameStatement.value<ModuleId>(kind, name);
|
||||
|
||||
if (!moduleId)
|
||||
moduleId = s->insertModuleNameStatement.value<ModuleId>(name);
|
||||
moduleId = s->insertModuleNameStatement.value<ModuleId>(kind, name);
|
||||
|
||||
tracer.end(keyValue("module id", moduleId));
|
||||
|
||||
return moduleId;
|
||||
}
|
||||
|
||||
Utils::PathString ProjectStorage::fetchModuleNameUnguarded(ModuleId id) const
|
||||
Storage::Module ProjectStorage::fetchModuleUnguarded(ModuleId id) const
|
||||
{
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"fetch module name ungarded"_t,
|
||||
NanotraceHR::Tracer tracer{"fetch module ungarded"_t,
|
||||
projectStorageCategory(),
|
||||
keyValue("module id", id)};
|
||||
|
||||
auto moduleName = s->selectModuleNameStatement.value<Utils::PathString>(id);
|
||||
auto module = s->selectModuleStatement.value<Storage::Module>(id);
|
||||
|
||||
if (moduleName.empty())
|
||||
if (!module)
|
||||
throw ModuleDoesNotExists{};
|
||||
|
||||
tracer.end(keyValue("module name", moduleName));
|
||||
tracer.end(keyValue("module name", module.name));
|
||||
tracer.end(keyValue("module name", module.kind));
|
||||
|
||||
return moduleName;
|
||||
return module;
|
||||
}
|
||||
|
||||
void ProjectStorage::handleAliasPropertyDeclarationsWithPropertyType(
|
||||
|
@@ -50,9 +50,9 @@ public:
|
||||
|
||||
void removeObserver(ProjectStorageObserver *observer) override;
|
||||
|
||||
ModuleId moduleId(Utils::SmallStringView moduleName) const override;
|
||||
ModuleId moduleId(Utils::SmallStringView moduleName, Storage::ModuleKind kind) const override;
|
||||
|
||||
Utils::SmallString moduleName(ModuleId moduleId) const override;
|
||||
Storage::Module module(ModuleId moduleId) const override;
|
||||
|
||||
TypeId typeId(ModuleId moduleId,
|
||||
Utils::SmallStringView exportedTypeName,
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
return commonTypeCache_;
|
||||
}
|
||||
|
||||
template<const char *moduleName, const char *typeName>
|
||||
template<const char *moduleName, const char *typeName, Storage::ModuleKind moduleKind = Storage::ModuleKind::QmlLibrary>
|
||||
TypeId commonTypeId() const
|
||||
{
|
||||
using NanotraceHR::keyValue;
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
keyValue("module name", std::string_view{moduleName}),
|
||||
keyValue("type name", std::string_view{typeName})};
|
||||
|
||||
auto typeId = commonTypeCache_.typeId<moduleName, typeName>();
|
||||
auto typeId = commonTypeCache_.typeId<moduleName, typeName, moduleKind>();
|
||||
|
||||
tracer.end(keyValue("type id", typeId));
|
||||
|
||||
@@ -244,50 +244,90 @@ public:
|
||||
void resetForTestsOnly();
|
||||
|
||||
private:
|
||||
struct ModuleView
|
||||
{
|
||||
ModuleView() = default;
|
||||
|
||||
ModuleView(Utils::SmallStringView name, Storage::ModuleKind kind)
|
||||
: name{name}
|
||||
, kind{kind}
|
||||
{}
|
||||
|
||||
ModuleView(const Storage::Module &module)
|
||||
: name{module.name}
|
||||
, kind{module.kind}
|
||||
{}
|
||||
|
||||
Utils::SmallStringView name;
|
||||
Storage::ModuleKind kind;
|
||||
|
||||
friend bool operator<(ModuleView first, ModuleView second)
|
||||
{
|
||||
return std::tie(first.kind, first.name) < std::tie(second.kind, second.name);
|
||||
}
|
||||
|
||||
friend bool operator==(const Storage::Module &first, ModuleView second)
|
||||
{
|
||||
return first.name == second.name && first.kind == second.kind;
|
||||
}
|
||||
|
||||
friend bool operator==(ModuleView first, const Storage::Module &second)
|
||||
{
|
||||
return second == first;
|
||||
}
|
||||
};
|
||||
|
||||
class ModuleStorageAdapter
|
||||
{
|
||||
public:
|
||||
auto fetchId(const Utils::SmallStringView name) { return storage.fetchModuleId(name); }
|
||||
auto fetchId(ModuleView module) { return storage.fetchModuleId(module.name, module.kind); }
|
||||
|
||||
auto fetchValue(ModuleId id) { return storage.fetchModuleName(id); }
|
||||
auto fetchValue(ModuleId id) { return storage.fetchModule(id); }
|
||||
|
||||
auto fetchAll() { return storage.fetchAllModules(); }
|
||||
|
||||
ProjectStorage &storage;
|
||||
};
|
||||
|
||||
class Module : public StorageCacheEntry<Utils::PathString, Utils::SmallStringView, ModuleId>
|
||||
friend ModuleStorageAdapter;
|
||||
|
||||
static bool moduleNameLess(ModuleView first, ModuleView second) noexcept
|
||||
{
|
||||
using Base = StorageCacheEntry<Utils::PathString, Utils::SmallStringView, ModuleId>;
|
||||
return first < second;
|
||||
}
|
||||
|
||||
class ModuleCacheEntry : public StorageCacheEntry<Storage::Module, ModuleView, ModuleId>
|
||||
{
|
||||
using Base = StorageCacheEntry<Storage::Module, ModuleView, ModuleId>;
|
||||
|
||||
public:
|
||||
using Base::Base;
|
||||
|
||||
friend bool operator==(const Module &first, const Module &second)
|
||||
ModuleCacheEntry(Utils::SmallStringView name, Storage::ModuleKind kind, ModuleId moduleId)
|
||||
: Base{{name, kind}, moduleId}
|
||||
{}
|
||||
|
||||
friend bool operator==(const ModuleCacheEntry &first, const ModuleCacheEntry &second)
|
||||
{
|
||||
return &first == &second && first.value == second.value;
|
||||
}
|
||||
|
||||
friend bool operator==(const ModuleCacheEntry &first, ModuleView second)
|
||||
{
|
||||
return first.value.name == second.name && first.value.kind == second.kind;
|
||||
}
|
||||
};
|
||||
|
||||
using Modules = std::vector<Module>;
|
||||
using ModuleCacheEntries = std::vector<ModuleCacheEntry>;
|
||||
|
||||
friend ModuleStorageAdapter;
|
||||
using ModuleCache
|
||||
= StorageCache<Storage::Module, ModuleView, ModuleId, ModuleStorageAdapter, NonLockingMutex, moduleNameLess, ModuleCacheEntry>;
|
||||
|
||||
static bool moduleNameLess(Utils::SmallStringView first, Utils::SmallStringView second) noexcept;
|
||||
ModuleId fetchModuleId(Utils::SmallStringView moduleName, Storage::ModuleKind moduleKind);
|
||||
|
||||
using ModuleCache = StorageCache<Utils::PathString,
|
||||
Utils::SmallStringView,
|
||||
ModuleId,
|
||||
ModuleStorageAdapter,
|
||||
NonLockingMutex,
|
||||
moduleNameLess,
|
||||
Module>;
|
||||
Storage::Module fetchModule(ModuleId id);
|
||||
|
||||
ModuleId fetchModuleId(Utils::SmallStringView moduleName);
|
||||
|
||||
Utils::PathString fetchModuleName(ModuleId id);
|
||||
|
||||
Modules fetchAllModules() const;
|
||||
ModuleCacheEntries fetchAllModules() const;
|
||||
|
||||
void callRefreshMetaInfoCallback(const TypeIds &deletedTypeIds);
|
||||
|
||||
@@ -532,9 +572,10 @@ private:
|
||||
Storage::Synchronization::ModuleExportedImports &moduleExportedImports,
|
||||
const ModuleIds &updatedModuleIds);
|
||||
|
||||
ModuleId fetchModuleIdUnguarded(Utils::SmallStringView name) const override;
|
||||
ModuleId fetchModuleIdUnguarded(Utils::SmallStringView name,
|
||||
Storage::ModuleKind moduleKind) const override;
|
||||
|
||||
Utils::PathString fetchModuleNameUnguarded(ModuleId id) const;
|
||||
Storage::Module fetchModuleUnguarded(ModuleId id) const;
|
||||
|
||||
void handleAliasPropertyDeclarationsWithPropertyType(
|
||||
TypeId typeId, AliasPropertyDeclarations &relinkableAliasPropertyDeclarations);
|
||||
|
@@ -42,6 +42,34 @@ void convertToString(String &string, const FlagIs &flagIs)
|
||||
|
||||
namespace QmlDesigner::Storage {
|
||||
|
||||
enum class ModuleKind { QmlLibrary, CppLibrary, PathLibrary };
|
||||
|
||||
struct Module
|
||||
{
|
||||
Module() = default;
|
||||
|
||||
Module(Utils::SmallStringView name, Storage::ModuleKind kind)
|
||||
: name{name}
|
||||
, kind{kind}
|
||||
{}
|
||||
|
||||
template<typename ModuleType>
|
||||
Module(const ModuleType &module)
|
||||
: name{module.name}
|
||||
, kind{module.kind}
|
||||
{}
|
||||
|
||||
Utils::PathString name;
|
||||
Storage::ModuleKind kind = Storage::ModuleKind::QmlLibrary;
|
||||
|
||||
friend bool operator==(const Module &first, const Module &second)
|
||||
{
|
||||
return first.name == second.name && first.kind == second.kind;
|
||||
}
|
||||
|
||||
explicit operator bool() const { return name.size(); }
|
||||
};
|
||||
|
||||
enum class PropertyDeclarationTraits : int {
|
||||
None = 0,
|
||||
IsReadOnly = 1 << 0,
|
||||
|
@@ -31,8 +31,8 @@ public:
|
||||
virtual void addObserver(ProjectStorageObserver *observer) = 0;
|
||||
virtual void removeObserver(ProjectStorageObserver *observer) = 0;
|
||||
|
||||
virtual ModuleId moduleId(::Utils::SmallStringView name) const = 0;
|
||||
virtual Utils::SmallString moduleName(ModuleId moduleId) const = 0;
|
||||
virtual ModuleId moduleId(::Utils::SmallStringView name, Storage::ModuleKind kind) const = 0;
|
||||
virtual QmlDesigner::Storage::Module module(ModuleId moduleId) const = 0;
|
||||
virtual std::optional<Storage::Info::PropertyDeclaration>
|
||||
propertyDeclaration(PropertyDeclarationId propertyDeclarationId) const = 0;
|
||||
virtual TypeId typeId(ModuleId moduleId,
|
||||
@@ -86,10 +86,10 @@ public:
|
||||
virtual SourceId propertyEditorPathId(TypeId typeId) const = 0;
|
||||
virtual const Storage::Info::CommonTypeCache<ProjectStorageType> &commonTypeCache() const = 0;
|
||||
|
||||
template<const char *moduleName, const char *typeName>
|
||||
template<const char *moduleName, const char *typeName, Storage::ModuleKind moduleKind = Storage::ModuleKind::QmlLibrary>
|
||||
TypeId commonTypeId() const
|
||||
{
|
||||
return commonTypeCache().template typeId<moduleName, typeName>();
|
||||
return commonTypeCache().template typeId<moduleName, typeName, moduleKind>();
|
||||
}
|
||||
|
||||
template<typename BuiltinType>
|
||||
@@ -108,7 +108,7 @@ protected:
|
||||
ProjectStorageInterface() = default;
|
||||
~ProjectStorageInterface() = default;
|
||||
|
||||
virtual ModuleId fetchModuleIdUnguarded(Utils::SmallStringView name) const = 0;
|
||||
virtual ModuleId fetchModuleIdUnguarded(Utils::SmallStringView name, Storage::ModuleKind moduleKind) const = 0;
|
||||
virtual TypeId fetchTypeIdByModuleIdAndExportedName(ModuleId moduleId, Utils::SmallStringView name) const = 0;
|
||||
};
|
||||
|
||||
|
@@ -164,8 +164,8 @@ void addDependencies(Storage::Imports &dependencies,
|
||||
Tracer &tracer)
|
||||
{
|
||||
for (const QmlDirParser::Import &qmldirDependency : qmldirDependencies) {
|
||||
ModuleId moduleId = projectStorage.moduleId(Utils::PathString{qmldirDependency.module}
|
||||
+ "-cppnative");
|
||||
ModuleId moduleId = projectStorage.moduleId(Utils::PathString{qmldirDependency.module},
|
||||
Storage::ModuleKind::CppLibrary);
|
||||
auto &import = dependencies.emplace_back(moduleId, Storage::Version{}, sourceId);
|
||||
tracer.tick(message, keyValue("import", import));
|
||||
}
|
||||
@@ -177,6 +177,7 @@ void addModuleExportedImport(Storage::Synchronization::ModuleExportedImports &im
|
||||
Storage::Version version,
|
||||
Storage::Synchronization::IsAutoVersion isAutoVersion,
|
||||
std::string_view moduleName,
|
||||
Storage::ModuleKind moduleKind,
|
||||
std::string_view exportedModuleName)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"add module exported imports"_t,
|
||||
@@ -186,6 +187,7 @@ void addModuleExportedImport(Storage::Synchronization::ModuleExportedImports &im
|
||||
keyValue("version", version),
|
||||
keyValue("is auto version", isAutoVersion),
|
||||
keyValue("module name", moduleName),
|
||||
keyValue("module kind", moduleKind),
|
||||
keyValue("exported module name", exportedModuleName)};
|
||||
|
||||
imports.emplace_back(moduleId, exportedModuleId, version, isAutoVersion);
|
||||
@@ -200,7 +202,6 @@ void addModuleExportedImports(Storage::Synchronization::ModuleExportedImports &i
|
||||
ModuleId moduleId,
|
||||
ModuleId cppModuleId,
|
||||
std::string_view moduleName,
|
||||
std::string_view cppModuleName,
|
||||
const QList<QmlDirParser::Import> &qmldirImports,
|
||||
ProjectStorageInterface &projectStorage)
|
||||
{
|
||||
@@ -214,23 +215,27 @@ void addModuleExportedImports(Storage::Synchronization::ModuleExportedImports &i
|
||||
continue;
|
||||
|
||||
Utils::PathString exportedModuleName{qmldirImport.module};
|
||||
ModuleId exportedModuleId = projectStorage.moduleId(exportedModuleName);
|
||||
using Storage::ModuleKind;
|
||||
ModuleId exportedModuleId = projectStorage.moduleId(exportedModuleName,
|
||||
ModuleKind::QmlLibrary);
|
||||
addModuleExportedImport(imports,
|
||||
moduleId,
|
||||
exportedModuleId,
|
||||
convertVersion(qmldirImport.version),
|
||||
convertToIsAutoVersion(qmldirImport.flags),
|
||||
moduleName,
|
||||
ModuleKind::QmlLibrary,
|
||||
exportedModuleName);
|
||||
|
||||
exportedModuleName += "-cppnative";
|
||||
ModuleId exportedCppModuleId = projectStorage.moduleId(exportedModuleName);
|
||||
ModuleId exportedCppModuleId = projectStorage.moduleId(exportedModuleName,
|
||||
ModuleKind::CppLibrary);
|
||||
addModuleExportedImport(imports,
|
||||
cppModuleId,
|
||||
exportedCppModuleId,
|
||||
Storage::Version{},
|
||||
Storage::Synchronization::IsAutoVersion::No,
|
||||
cppModuleName,
|
||||
moduleName,
|
||||
ModuleKind::CppLibrary,
|
||||
exportedModuleName);
|
||||
}
|
||||
}
|
||||
@@ -297,7 +302,7 @@ void ProjectStorageUpdater::updateQmlTypes(const QStringList &qmlTypesPaths,
|
||||
|
||||
NanotraceHR::Tracer tracer{"update qmltypes file"_t, category()};
|
||||
|
||||
ModuleId moduleId = m_projectStorage.moduleId("QML-cppnative");
|
||||
ModuleId moduleId = m_projectStorage.moduleId("QML", Storage::ModuleKind::CppLibrary);
|
||||
|
||||
for (const QString &qmlTypesPath : qmlTypesPaths) {
|
||||
SourceId sourceId = m_pathCache.sourceId(SourcePath{qmlTypesPath});
|
||||
@@ -360,11 +365,11 @@ void ProjectStorageUpdater::updateDirectoryChanged(std::string_view directoryPat
|
||||
package.updatedSourceIds.push_back(qmldirSourceId);
|
||||
}
|
||||
|
||||
using Storage::ModuleKind;
|
||||
Utils::PathString moduleName{parser.typeNamespace()};
|
||||
ModuleId moduleId = m_projectStorage.moduleId(moduleName);
|
||||
Utils::PathString cppModuleName = moduleName + "-cppnative";
|
||||
ModuleId cppModuleId = m_projectStorage.moduleId(cppModuleName);
|
||||
ModuleId pathModuleId = m_projectStorage.moduleId(directoryPath);
|
||||
ModuleId moduleId = m_projectStorage.moduleId(moduleName, ModuleKind::QmlLibrary);
|
||||
ModuleId cppModuleId = m_projectStorage.moduleId(moduleName, ModuleKind::CppLibrary);
|
||||
ModuleId pathModuleId = m_projectStorage.moduleId(directoryPath, ModuleKind::PathLibrary);
|
||||
|
||||
auto imports = filterMultipleEntries(parser.imports());
|
||||
|
||||
@@ -372,7 +377,6 @@ void ProjectStorageUpdater::updateDirectoryChanged(std::string_view directoryPat
|
||||
moduleId,
|
||||
cppModuleId,
|
||||
moduleName,
|
||||
cppModuleName,
|
||||
imports,
|
||||
m_projectStorage);
|
||||
tracer.tick("append updated module id"_t, keyValue("module id", moduleId));
|
||||
@@ -696,7 +700,8 @@ void ProjectStorageUpdater::updatePropertyEditorFilePath(
|
||||
moduleName.replace('/', '.');
|
||||
if (oldModuleName != moduleName) {
|
||||
oldModuleName = moduleName;
|
||||
moduleId = m_projectStorage.moduleId(Utils::SmallString{moduleName});
|
||||
moduleId = m_projectStorage.moduleId(Utils::SmallString{moduleName},
|
||||
Storage::ModuleKind::QmlLibrary);
|
||||
}
|
||||
Storage::TypeNameString typeName{match.capturedView(2)};
|
||||
SourceId pathId = m_pathCache.sourceId(SourcePath{path});
|
||||
|
@@ -66,23 +66,32 @@ Storage::Import createImport(const QmlDom::Import &qmlImport,
|
||||
Utils::SmallStringView directoryPath,
|
||||
QmlDocumentParser::ProjectStorage &storage)
|
||||
{
|
||||
using Storage::ModuleKind;
|
||||
using QmlUriKind = QQmlJS::Dom::QmlUri::Kind;
|
||||
|
||||
auto &&uri = qmlImport.uri;
|
||||
|
||||
if (uri.kind() == QmlUriKind::RelativePath) {
|
||||
auto path = createNormalizedPath(directoryPath, uri.localPath());
|
||||
auto moduleId = storage.moduleId(createNormalizedPath(directoryPath, uri.localPath()));
|
||||
return Storage::Import(moduleId, Storage::Version{}, sourceId);
|
||||
}
|
||||
|
||||
if (uri.kind() == QmlUriKind::ModuleUri) {
|
||||
auto moduleId = storage.moduleId(Utils::PathString{uri.moduleUri()});
|
||||
switch (uri.kind()) {
|
||||
case QmlUriKind::AbsolutePath:
|
||||
case QmlUriKind::DirectoryUrl: {
|
||||
auto moduleId = storage.moduleId(Utils::PathString{uri.toString()}, ModuleKind::PathLibrary);
|
||||
return Storage::Import(moduleId, convertVersion(qmlImport.version), sourceId);
|
||||
}
|
||||
case QmlUriKind::RelativePath: {
|
||||
auto path = createNormalizedPath(directoryPath, uri.localPath());
|
||||
auto moduleId = storage.moduleId(createNormalizedPath(directoryPath, uri.localPath()),
|
||||
ModuleKind::PathLibrary);
|
||||
return Storage::Import(moduleId, Storage::Version{}, sourceId);
|
||||
}
|
||||
case QmlUriKind::ModuleUri: {
|
||||
auto moduleId = storage.moduleId(Utils::PathString{uri.moduleUri()}, ModuleKind::QmlLibrary);
|
||||
return Storage::Import(moduleId, convertVersion(qmlImport.version), sourceId);
|
||||
}
|
||||
case QmlUriKind::Invalid:
|
||||
return Storage::Import{};
|
||||
}
|
||||
|
||||
auto moduleId = storage.moduleId(Utils::PathString{uri.toString()});
|
||||
return Storage::Import(moduleId, convertVersion(qmlImport.version), sourceId);
|
||||
return Storage::Import{};
|
||||
}
|
||||
|
||||
QualifiedImports createQualifiedImports(const QList<QmlDom::Import> &qmlImports,
|
||||
@@ -122,11 +131,13 @@ void addImports(Storage::Imports &imports,
|
||||
}
|
||||
}
|
||||
|
||||
auto localDirectoryModuleId = storage.moduleId(directoryPath);
|
||||
using Storage::ModuleKind;
|
||||
|
||||
auto localDirectoryModuleId = storage.moduleId(directoryPath, ModuleKind::PathLibrary);
|
||||
imports.emplace_back(localDirectoryModuleId, Storage::Version{}, sourceId);
|
||||
++importCount;
|
||||
|
||||
auto qmlModuleId = storage.moduleId("QML");
|
||||
auto qmlModuleId = storage.moduleId("QML", ModuleKind::QmlLibrary);
|
||||
imports.emplace_back(qmlModuleId, Storage::Version{}, sourceId);
|
||||
++importCount;
|
||||
|
||||
|
@@ -28,7 +28,7 @@ namespace QmlDesigner {
|
||||
constexpr auto category = ProjectStorageTracing::projectStorageUpdaterCategory;
|
||||
using NanotraceHR::keyValue;
|
||||
using Tracer = ProjectStorageTracing::Category::TracerType;
|
||||
|
||||
using Storage::ModuleKind;
|
||||
namespace QmlDom = QQmlJS::Dom;
|
||||
|
||||
namespace {
|
||||
@@ -71,8 +71,7 @@ const Storage::Import &appendImports(Storage::Imports &imports,
|
||||
});
|
||||
|
||||
Utils::PathString moduleName{QStringView(dependency.begin(), spaceFound)};
|
||||
moduleName.append("-cppnative");
|
||||
ModuleId cppModuleId = storage.moduleId(moduleName);
|
||||
ModuleId cppModuleId = storage.moduleId(moduleName, ModuleKind::CppLibrary);
|
||||
|
||||
return imports.emplace_back(cppModuleId, Storage::Version{}, sourceId);
|
||||
}
|
||||
@@ -98,7 +97,8 @@ void addImports(Storage::Imports &imports,
|
||||
const auto &import = imports.emplace_back(cppModuleId, Storage::Version{}, sourceId);
|
||||
tracer.tick("append import"_t, keyValue("import", import));
|
||||
|
||||
if (ModuleId qmlCppModuleId = storage.moduleId("QML-cppnative"); cppModuleId != qmlCppModuleId) {
|
||||
if (ModuleId qmlCppModuleId = storage.moduleId("QML", ModuleKind::CppLibrary);
|
||||
cppModuleId != qmlCppModuleId) {
|
||||
const auto &import = imports.emplace_back(qmlCppModuleId, Storage::Version{}, sourceId);
|
||||
tracer.tick("append import"_t, keyValue("import", import));
|
||||
}
|
||||
@@ -145,7 +145,8 @@ Storage::Synchronization::ExportedTypes createExports(const QList<QQmlJSScope::E
|
||||
|
||||
for (const QQmlJSScope::Export &qmlExport : qmlExports) {
|
||||
TypeNameString exportedTypeName{qmlExport.type()};
|
||||
exportedTypes.emplace_back(storage.moduleId(Utils::SmallString{qmlExport.package()}),
|
||||
exportedTypes.emplace_back(storage.moduleId(Utils::SmallString{qmlExport.package()},
|
||||
ModuleKind::QmlLibrary),
|
||||
std::move(exportedTypeName),
|
||||
createVersion(qmlExport.version()));
|
||||
}
|
||||
@@ -469,16 +470,16 @@ void addType(Storage::Synchronization::Types &types,
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
constexpr auto skipLists = std::make_tuple(
|
||||
std::pair{"QtQuick.Templates-cppnative"sv, std::array{"QQuickItem"_L1}});
|
||||
std::pair{std::pair{"QtQuick.Templates"_sv, ModuleKind::CppLibrary}, std::array{"QQuickItem"_L1}});
|
||||
|
||||
Utils::span<const QLatin1StringView> getSkipList(std::string_view moduleName)
|
||||
Utils::span<const QLatin1StringView> getSkipList(const Storage::Module &module)
|
||||
{
|
||||
static constexpr Utils::span<const QLatin1StringView> emptySkipList;
|
||||
auto currentSkipList = emptySkipList;
|
||||
|
||||
std::apply(
|
||||
[&](const auto &entry) {
|
||||
if (entry.first == moduleName)
|
||||
if (entry.first.first == module.name && entry.first.second == module.kind)
|
||||
currentSkipList = entry.second;
|
||||
},
|
||||
skipLists);
|
||||
@@ -502,7 +503,7 @@ void addTypes(Storage::Synchronization::Types &types,
|
||||
NanotraceHR::Tracer tracer{"add types"_t, category()};
|
||||
types.reserve(Utils::usize(objects) + types.size());
|
||||
|
||||
const auto skipList = getSkipList(storage.moduleName(projectData.moduleId));
|
||||
const auto skipList = getSkipList(storage.module(projectData.moduleId));
|
||||
|
||||
for (const auto &object : objects) {
|
||||
if (skipType(object, skipList))
|
||||
|
@@ -313,7 +313,7 @@ private:
|
||||
return entries.end();
|
||||
}
|
||||
|
||||
auto value = *found;
|
||||
const auto &value = *found;
|
||||
|
||||
if (value == view) {
|
||||
return found;
|
||||
|
@@ -258,7 +258,8 @@ void TypeAnnotationReader::readTypeProperty(QStringView name, const QVariant &va
|
||||
auto [moduleName, typeName] = decomposeTypePath(fullTypeName);
|
||||
|
||||
m_typeAnnotations.back().typeName = typeName;
|
||||
m_typeAnnotations.back().moduleId = m_projectStorage.moduleId(moduleName);
|
||||
m_typeAnnotations.back().moduleId = m_projectStorage.moduleId(moduleName,
|
||||
ModuleKind::QmlLibrary);
|
||||
|
||||
} else if (name == "icon"_L1) {
|
||||
m_typeAnnotations.back().iconPath = absoluteFilePathForDocument(value.toString());
|
||||
|
@@ -12,9 +12,10 @@ using QmlDesigner::ImportId;
|
||||
using QmlDesigner::ModuleId;
|
||||
using QmlDesigner::PropertyDeclarationId;
|
||||
using QmlDesigner::SourceId;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
using QmlDesigner::Storage::PropertyDeclarationTraits;
|
||||
using QmlDesigner::TypeId;
|
||||
using QmlDesigner::TypeIds;
|
||||
using QmlDesigner::Storage::PropertyDeclarationTraits;
|
||||
|
||||
namespace Storage = QmlDesigner::Storage;
|
||||
|
||||
@@ -41,18 +42,20 @@ void setupIsBasedOn(ProjectStorageMock &mock)
|
||||
|
||||
} // namespace
|
||||
|
||||
ModuleId ProjectStorageMock::createModule(Utils::SmallStringView moduleName)
|
||||
ModuleId ProjectStorageMock::createModule(Utils::SmallStringView moduleName,
|
||||
QmlDesigner::Storage::ModuleKind moduleKind)
|
||||
{
|
||||
if (auto id = moduleId(moduleName)) {
|
||||
if (auto id = moduleId(moduleName, moduleKind)) {
|
||||
return id;
|
||||
}
|
||||
|
||||
static ModuleId moduleId;
|
||||
incrementBasicId(moduleId);
|
||||
|
||||
ON_CALL(*this, moduleId(Eq(moduleName))).WillByDefault(Return(moduleId));
|
||||
ON_CALL(*this, moduleName(Eq(moduleId))).WillByDefault(Return(moduleName));
|
||||
ON_CALL(*this, fetchModuleIdUnguarded(Eq(moduleName))).WillByDefault(Return(moduleId));
|
||||
ON_CALL(*this, moduleId(Eq(moduleName), Eq(moduleKind))).WillByDefault(Return(moduleId));
|
||||
ON_CALL(*this, module(Eq(moduleId)))
|
||||
.WillByDefault(Return(QmlDesigner::Storage::Module{moduleName, moduleKind}));
|
||||
ON_CALL(*this, fetchModuleIdUnguarded(Eq(moduleName), Eq(moduleKind))).WillByDefault(Return(moduleId));
|
||||
|
||||
return moduleId;
|
||||
}
|
||||
@@ -385,11 +388,11 @@ void ProjectStorageMock::setupQtQuick()
|
||||
{
|
||||
setupIsBasedOn(*this);
|
||||
|
||||
auto qmlModuleId = createModule("QML");
|
||||
auto qmlNativeModuleId = createModule("QML-cppnative");
|
||||
auto qtQmlModelsModuleId = createModule("QtQml.Models");
|
||||
auto qtQuickModuleId = createModule("QtQuick");
|
||||
auto qtQuickNativeModuleId = createModule("QtQuick-cppnative");
|
||||
auto qmlModuleId = createModule("QML", ModuleKind::QmlLibrary);
|
||||
auto qmlNativeModuleId = createModule("QML", ModuleKind::CppLibrary);
|
||||
auto qtQmlModelsModuleId = createModule("QtQml.Models", ModuleKind::QmlLibrary);
|
||||
auto qtQuickModuleId = createModule("QtQuick", ModuleKind::QmlLibrary);
|
||||
auto qtQuickNativeModuleId = createModule("QtQuick", ModuleKind::CppLibrary);
|
||||
|
||||
auto boolId = createValue(qmlModuleId, "bool");
|
||||
auto intId = createValue(qmlModuleId, "int");
|
||||
@@ -463,11 +466,11 @@ void ProjectStorageMock::setupQtQuick()
|
||||
{qtObjectId});
|
||||
createObject(qtQuickModuleId, "PropertyChanges", {qtObjectId, stateOperationsId});
|
||||
|
||||
auto qtQuickTimelineModuleId = createModule("QtQuick.Timeline");
|
||||
auto qtQuickTimelineModuleId = createModule("QtQuick.Timeline", ModuleKind::QmlLibrary);
|
||||
createObject(qtQuickTimelineModuleId, "KeyframeGroup", {qtObjectId});
|
||||
createObject(qtQuickTimelineModuleId, "Keyframe", {qtObjectId});
|
||||
|
||||
auto flowViewModuleId = createModule("FlowView");
|
||||
auto flowViewModuleId = createModule("FlowView", ModuleKind::QmlLibrary);
|
||||
createObject(flowViewModuleId,
|
||||
"FlowActionArea",
|
||||
"data",
|
||||
@@ -492,12 +495,12 @@ void ProjectStorageMock::setupQtQuick()
|
||||
|
||||
void ProjectStorageMock::setupQtQuickImportedTypeNameIds(QmlDesigner::SourceId sourceId)
|
||||
{
|
||||
auto qmlModuleId = moduleId("QML");
|
||||
auto qtQmlModelsModuleId = moduleId("QtQml.Models");
|
||||
auto qtQuickModuleId = moduleId("QtQuick");
|
||||
auto qtQuickNativeModuleId = moduleId("QtQuick-cppnative");
|
||||
auto qtQuickTimelineModuleId = moduleId("QtQuick.Timeline");
|
||||
auto flowViewModuleId = moduleId("FlowView");
|
||||
auto qmlModuleId = moduleId("QML", ModuleKind::QmlLibrary);
|
||||
auto qtQmlModelsModuleId = moduleId("QtQml.Models", ModuleKind::QmlLibrary);
|
||||
auto qtQuickModuleId = moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
auto qtQuickNativeModuleId = moduleId("QtQuick", ModuleKind::CppLibrary);
|
||||
auto qtQuickTimelineModuleId = moduleId("QtQuick.Timeline", ModuleKind::QmlLibrary);
|
||||
auto flowViewModuleId = moduleId("FlowView", ModuleKind::QmlLibrary);
|
||||
|
||||
createImportedTypeNameId(sourceId, "int", qmlModuleId);
|
||||
createImportedTypeNameId(sourceId, "QtObject", qmlModuleId);
|
||||
|
@@ -23,7 +23,8 @@ public:
|
||||
void setupQtQuickImportedTypeNameIds(QmlDesigner::SourceId sourceId);
|
||||
void setupCommonTypeCache();
|
||||
|
||||
QmlDesigner::ModuleId createModule(Utils::SmallStringView moduleName);
|
||||
QmlDesigner::ModuleId createModule(Utils::SmallStringView moduleName,
|
||||
QmlDesigner::Storage::ModuleKind moduleKind);
|
||||
|
||||
QmlDesigner::ImportedTypeNameId createImportedTypeNameId(QmlDesigner::SourceId sourceId,
|
||||
Utils::SmallStringView typeName,
|
||||
@@ -126,8 +127,11 @@ public:
|
||||
MOCK_METHOD(void, addObserver, (QmlDesigner::ProjectStorageObserver *), (override));
|
||||
MOCK_METHOD(void, removeObserver, (QmlDesigner::ProjectStorageObserver *), (override));
|
||||
|
||||
MOCK_METHOD(QmlDesigner::ModuleId, moduleId, (::Utils::SmallStringView), (const, override));
|
||||
MOCK_METHOD(Utils::SmallString, moduleName, (QmlDesigner::ModuleId), (const, override));
|
||||
MOCK_METHOD(QmlDesigner::ModuleId,
|
||||
moduleId,
|
||||
(::Utils::SmallStringView, QmlDesigner::Storage::ModuleKind moduleKind),
|
||||
(const, override));
|
||||
MOCK_METHOD(QmlDesigner::Storage::Module, module, (QmlDesigner::ModuleId), (const, override));
|
||||
|
||||
MOCK_METHOD(std::optional<QmlDesigner::Storage::Info::PropertyDeclaration>,
|
||||
propertyDeclaration,
|
||||
@@ -337,7 +341,7 @@ public:
|
||||
(const, override));
|
||||
MOCK_METHOD(QmlDesigner::ModuleId,
|
||||
fetchModuleIdUnguarded,
|
||||
(Utils::SmallStringView name),
|
||||
(Utils::SmallStringView name, QmlDesigner::Storage::ModuleKind),
|
||||
(const, override));
|
||||
MOCK_METHOD(QmlDesigner::TypeId,
|
||||
fetchTypeIdByModuleIdAndExportedName,
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include <propertycomponentgenerator.h>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
@@ -182,7 +183,7 @@ protected:
|
||||
resourceManagementMock)};
|
||||
QmlDesigner::PropertyComponentGenerator generator{QString{sourcesPath}, &model};
|
||||
QmlDesigner::NodeMetaInfo itemMetaInfo = model.qtQuickItemMetaInfo();
|
||||
QmlDesigner::ModuleId qmlModuleId = projectStorageMock.createModule("QML");
|
||||
QmlDesigner::ModuleId qmlModuleId = projectStorageMock.createModule("QML", ModuleKind::QmlLibrary);
|
||||
};
|
||||
|
||||
TEST_F(PropertyComponentGenerator,
|
||||
@@ -345,7 +346,8 @@ TEST_F(PropertyComponentGenerator, after_refresh_meta_infos_type_was_deleted)
|
||||
auto xProperty = itemMetaInfo.property("x");
|
||||
auto doubleMetaInfo = model.doubleMetaInfo();
|
||||
projectStorageMock.removeExportedTypeName(doubleMetaInfo.id(),
|
||||
projectStorageMock.createModule("QML"),
|
||||
projectStorageMock.createModule("QML",
|
||||
ModuleKind::QmlLibrary),
|
||||
"real");
|
||||
|
||||
generator.refreshMetaInfos({doubleMetaInfo.id()});
|
||||
@@ -359,11 +361,13 @@ TEST_F(PropertyComponentGenerator, after_refresh_meta_infos_type_was_added)
|
||||
auto xProperty = itemMetaInfo.property("x");
|
||||
auto doubleMetaInfo = model.doubleMetaInfo();
|
||||
projectStorageMock.removeExportedTypeName(doubleMetaInfo.id(),
|
||||
projectStorageMock.createModule("QML"),
|
||||
projectStorageMock.createModule("QML",
|
||||
ModuleKind::QmlLibrary),
|
||||
"real");
|
||||
generator.refreshMetaInfos({doubleMetaInfo.id()});
|
||||
projectStorageMock.addExportedTypeName(doubleMetaInfo.id(),
|
||||
projectStorageMock.createModule("QML"),
|
||||
projectStorageMock.createModule("QML",
|
||||
ModuleKind::QmlLibrary),
|
||||
"real");
|
||||
|
||||
generator.refreshMetaInfos({});
|
||||
|
@@ -13,6 +13,7 @@ namespace {
|
||||
using BasicProperty = QmlDesigner::PropertyComponentGenerator::BasicProperty;
|
||||
using ComplexProperty = QmlDesigner::PropertyComponentGenerator::ComplexProperty;
|
||||
using QmlDesigner::PropertyMetaInfo;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
|
||||
class PropertyEditorComponentGenerator : public ::testing::Test
|
||||
{
|
||||
@@ -86,7 +87,8 @@ protected:
|
||||
NiceMock<ProjectStorageMockWithQtQtuick> projectStorageMock{sourceId};
|
||||
NiceMock<PropertyComponentGeneratorMock> propertyGeneratorMock;
|
||||
QmlDesigner::PropertyEditorComponentGenerator generator{propertyGeneratorMock};
|
||||
QmlDesigner::ModuleId qtQuickModuleId = projectStorageMock.createModule("QtQuick");
|
||||
QmlDesigner::ModuleId qtQuickModuleId = projectStorageMock.createModule("QtQuick",
|
||||
ModuleKind::QmlLibrary);
|
||||
QmlDesigner::NodeMetaInfo fooTypeInfo = createType("Foo");
|
||||
QmlDesigner::TypeId dummyTypeId = projectStorageMock.commonTypeCache().builtinTypeId<double>();
|
||||
};
|
||||
|
@@ -17,6 +17,7 @@ namespace {
|
||||
using QmlDesigner::FlagIs;
|
||||
using QmlDesigner::ModelNode;
|
||||
using QmlDesigner::ModelNodes;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
using QmlDesigner::Storage::TypeTraits;
|
||||
using QmlDesigner::Storage::TypeTraitsKind;
|
||||
|
||||
@@ -68,9 +69,10 @@ protected:
|
||||
}
|
||||
|
||||
QmlDesigner::NodeMetaInfo createDerivedDummyMetaInfo(Utils::SmallStringView moduleName,
|
||||
ModuleKind moduleKind,
|
||||
Utils::SmallStringView typeName)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule(moduleName);
|
||||
auto moduleId = projectStorageMock.createModule(moduleName, moduleKind);
|
||||
auto typeId = projectStorageMock.createType(moduleId, typeName, {});
|
||||
|
||||
return createDerivedDummyMetaInfo(typeId);
|
||||
@@ -86,10 +88,11 @@ protected:
|
||||
}
|
||||
|
||||
QmlDesigner::NodeMetaInfo createMetaInfo(Utils::SmallStringView moduleName,
|
||||
ModuleKind moduleKind,
|
||||
Utils::SmallStringView typeName,
|
||||
QmlDesigner::Storage::TypeTraits typeTraits = {})
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule(moduleName);
|
||||
auto moduleId = projectStorageMock.createModule(moduleName, moduleKind);
|
||||
auto typeId = projectStorageMock.createType(moduleId, typeName, typeTraits);
|
||||
|
||||
return QmlDesigner::NodeMetaInfo{typeId, &projectStorageMock};
|
||||
@@ -109,8 +112,9 @@ protected:
|
||||
ModelNode object = model.createModelNode("QtObject");
|
||||
QmlDesigner::NodeMetaInfo itemMetaInfo = item.metaInfo();
|
||||
QmlDesigner::NodeMetaInfo objectMetaInfo = object.metaInfo();
|
||||
QmlDesigner::ModuleId qmlModuleId = projectStorageMock.createModule("QML");
|
||||
QmlDesigner::ModuleId qtQuickModuleId = projectStorageMock.createModule("QtQuick");
|
||||
QmlDesigner::ModuleId qmlModuleId = projectStorageMock.createModule("QML", ModuleKind::QmlLibrary);
|
||||
QmlDesigner::ModuleId qtQuickModuleId = projectStorageMock.createModule("QtQuick",
|
||||
ModuleKind::QmlLibrary);
|
||||
QmlDesigner::TypeId intTypeId = projectStorageMock.typeId(qmlModuleId,
|
||||
"int",
|
||||
QmlDesigner::Storage::Version{});
|
||||
@@ -215,7 +219,7 @@ TEST_F(NodeMetaInfo, invalid_is_not_file_component)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_is_file_component)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.isFileComponent = true;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -228,7 +232,7 @@ TEST_F(NodeMetaInfo, component_is_file_component)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_project_component)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.isProjectComponent = true;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -242,7 +246,7 @@ TEST_F(NodeMetaInfo, is_project_component)
|
||||
TEST_F(NodeMetaInfo, is_not_project_component)
|
||||
{
|
||||
using QmlDesigner::Storage::TypeTraits;
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", {});
|
||||
QmlDesigner::NodeMetaInfo metaInfo{typeId, &projectStorageMock};
|
||||
|
||||
@@ -262,7 +266,7 @@ TEST_F(NodeMetaInfo, invalid_is_not_project_component)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_in_project_module)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.isInProjectModule = true;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -276,7 +280,7 @@ TEST_F(NodeMetaInfo, is_in_project_module)
|
||||
TEST_F(NodeMetaInfo, is_not_in_project_module)
|
||||
{
|
||||
using QmlDesigner::Storage::TypeTraits;
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", {});
|
||||
QmlDesigner::NodeMetaInfo metaInfo{typeId, &projectStorageMock};
|
||||
|
||||
@@ -873,7 +877,7 @@ TEST_F(NodeMetaInfo, second_input_is_invalid_for_common_base_returns_invalid)
|
||||
|
||||
TEST_F(NodeMetaInfo, source_id)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
auto typeSourceId = QmlDesigner::SourceId::create(999);
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", {}, {}, typeSourceId);
|
||||
QmlDesigner::NodeMetaInfo metaInfo{typeId, &projectStorageMock};
|
||||
@@ -930,7 +934,7 @@ TEST_F(NodeMetaInfo, default_is_not_color)
|
||||
|
||||
TEST_F(NodeMetaInfo, float_is_a_floating_type)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QML-cppnative", "float");
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::CppLibrary, "float");
|
||||
|
||||
bool isType = metaInfo.isFloat();
|
||||
|
||||
@@ -957,7 +961,7 @@ TEST_F(NodeMetaInfo, default_is_not_float)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_FlowView_FlowActionArea)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", "FlowActionArea");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", ModuleKind::QmlLibrary, "FlowActionArea");
|
||||
|
||||
bool isType = metaInfo.isFlowViewFlowActionArea();
|
||||
|
||||
@@ -975,7 +979,7 @@ TEST_F(NodeMetaInfo, default_is_not_FlowView_FlowActionArea)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_FlowView_FlowDecision)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", "FlowDecision");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", ModuleKind::QmlLibrary, "FlowDecision");
|
||||
|
||||
bool isType = metaInfo.isFlowViewFlowDecision();
|
||||
|
||||
@@ -993,7 +997,7 @@ TEST_F(NodeMetaInfo, default_is_not_FlowView_FlowDecision)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_FlowView_FlowItem)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", "FlowItem");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", ModuleKind::QmlLibrary, "FlowItem");
|
||||
|
||||
bool isType = metaInfo.isFlowViewFlowItem();
|
||||
|
||||
@@ -1011,7 +1015,7 @@ TEST_F(NodeMetaInfo, default_is_not_FlowView_FlowItem)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_FlowView_FlowTransition)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", "FlowTransition");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", ModuleKind::QmlLibrary, "FlowTransition");
|
||||
|
||||
bool isType = metaInfo.isFlowViewFlowTransition();
|
||||
|
||||
@@ -1029,7 +1033,7 @@ TEST_F(NodeMetaInfo, default_is_not_FlowView_FlowTransition)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_FlowView_FlowView)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", "FlowView");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", ModuleKind::QmlLibrary, "FlowView");
|
||||
|
||||
bool isType = metaInfo.isFlowViewFlowView();
|
||||
|
||||
@@ -1047,7 +1051,7 @@ TEST_F(NodeMetaInfo, default_is_not_FlowView_FlowView)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_FlowView_FlowWildcard)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", "FlowWildcard");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", ModuleKind::QmlLibrary, "FlowWildcard");
|
||||
|
||||
bool isType = metaInfo.isFlowViewFlowWildcard();
|
||||
|
||||
@@ -1065,7 +1069,7 @@ TEST_F(NodeMetaInfo, default_is_not_FlowView_FlowWildcard)
|
||||
|
||||
TEST_F(NodeMetaInfo, FlowItem_is_FlowView_item)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", "FlowItem");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", ModuleKind::QmlLibrary, "FlowItem");
|
||||
|
||||
bool isType = metaInfo.isFlowViewItem();
|
||||
|
||||
@@ -1074,7 +1078,7 @@ TEST_F(NodeMetaInfo, FlowItem_is_FlowView_item)
|
||||
|
||||
TEST_F(NodeMetaInfo, FlowWildcard_is_FlowView_item)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", "FlowWildcard");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", ModuleKind::QmlLibrary, "FlowWildcard");
|
||||
|
||||
bool isType = metaInfo.isFlowViewItem();
|
||||
|
||||
@@ -1083,7 +1087,7 @@ TEST_F(NodeMetaInfo, FlowWildcard_is_FlowView_item)
|
||||
|
||||
TEST_F(NodeMetaInfo, FlowDecision_is_FlowView_item)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", "FlowDecision");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("FlowView", ModuleKind::QmlLibrary, "FlowDecision");
|
||||
|
||||
bool isType = metaInfo.isFlowViewItem();
|
||||
|
||||
@@ -1128,7 +1132,7 @@ TEST_F(NodeMetaInfo, QtQuick_Item_is_graphical_item)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuickWindow_Window_is_graphical_item)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Window", "Window");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Window", ModuleKind::QmlLibrary, "Window");
|
||||
|
||||
bool isType = metaInfo.isGraphicalItem();
|
||||
|
||||
@@ -1137,7 +1141,7 @@ TEST_F(NodeMetaInfo, QtQuickWindow_Window_is_graphical_item)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuickDialogs_Dialogs_is_graphical_item)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Dialogs", "Dialog");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Dialogs", ModuleKind::QmlLibrary, "Dialog");
|
||||
|
||||
bool isType = metaInfo.isGraphicalItem();
|
||||
|
||||
@@ -1146,7 +1150,7 @@ TEST_F(NodeMetaInfo, QtQuickDialogs_Dialogs_is_graphical_item)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuickControls_Popup_is_graphical_item)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QtQuick.Controls", "Popup");
|
||||
auto metaInfo = createMetaInfo("QtQuick.Controls", ModuleKind::QmlLibrary, "Popup");
|
||||
|
||||
bool isType = metaInfo.isGraphicalItem();
|
||||
|
||||
@@ -1191,7 +1195,7 @@ TEST_F(NodeMetaInfo, QtQuick_Positioner_is_layoutable)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuick_Layouts_Layout_is_layoutable)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Layouts", "Layout");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Layouts", ModuleKind::QmlLibrary, "Layout");
|
||||
|
||||
bool isType = metaInfo.isLayoutable();
|
||||
|
||||
@@ -1200,7 +1204,7 @@ TEST_F(NodeMetaInfo, QtQuick_Layouts_Layout_is_layoutable)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuick_Controls_SplitView_is_layoutable)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Controls", "SplitView");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Controls", ModuleKind::QmlLibrary, "SplitView");
|
||||
|
||||
bool isType = metaInfo.isLayoutable();
|
||||
|
||||
@@ -1263,7 +1267,8 @@ TEST_F(NodeMetaInfo, default_is_not_qml_component)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtMultimedia_SoundEffect)
|
||||
{
|
||||
auto qtMultimediaModuleId = projectStorageMock.createModule("QtMultimedia");
|
||||
auto qtMultimediaModuleId = projectStorageMock.createModule("QtMultimedia",
|
||||
ModuleKind::QmlLibrary);
|
||||
auto metaInfo = createDerivedDummyMetaInfo(qtMultimediaModuleId, "SoundEffect");
|
||||
|
||||
bool isType = metaInfo.isQtMultimediaSoundEffect();
|
||||
@@ -1300,7 +1305,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtObject)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_BakedLightmap)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "BakedLightmap");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "BakedLightmap");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DBakedLightmap();
|
||||
|
||||
@@ -1318,7 +1323,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_BakedLightmap)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Camera)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "Camera");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "Camera");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DCamera();
|
||||
|
||||
@@ -1336,7 +1341,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_Camera)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Command)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "Command");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "Command");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DCommand();
|
||||
|
||||
@@ -1354,7 +1359,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_Command)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_DefaultMaterial)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "DefaultMaterial");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "DefaultMaterial");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DDefaultMaterial();
|
||||
|
||||
@@ -1372,7 +1377,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_DefaultMaterial)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Effect)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "Effect");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "Effect");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DEffect();
|
||||
|
||||
@@ -1390,7 +1395,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_Effect)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_InstanceList)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "InstanceList");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "InstanceList");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DInstanceList();
|
||||
|
||||
@@ -1408,7 +1413,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_InstanceList)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_InstanceListEntry)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "InstanceListEntry");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "InstanceListEntry");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DInstanceListEntry();
|
||||
|
||||
@@ -1426,7 +1431,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_InstanceListEntry)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Light)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "Light");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "Light");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DLight();
|
||||
|
||||
@@ -1444,7 +1449,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_Light)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Material)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "Material");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "Material");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DMaterial();
|
||||
|
||||
@@ -1462,7 +1467,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_Material)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Model)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "Model");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "Model");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DModel();
|
||||
|
||||
@@ -1480,7 +1485,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_Model)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Node)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "Node");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "Node");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DNode();
|
||||
|
||||
@@ -1498,7 +1503,8 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_Node)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Particles3D_cppnative_QQuick3DParticleAbstractShape)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D-cppnative",
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D",
|
||||
ModuleKind::CppLibrary,
|
||||
"QQuick3DParticleAbstractShape");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DParticlesAbstractShape();
|
||||
@@ -1517,7 +1523,9 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_Particles3D_cppnative_QQuick3DPart
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Particles3D_Affector3D)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D", "Affector3D");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D",
|
||||
ModuleKind::QmlLibrary,
|
||||
"Affector3D");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DParticles3DAffector3D();
|
||||
|
||||
@@ -1535,7 +1543,9 @@ TEST_F(NodeMetaInfo, QtQuick3D_Particles3D_Affector3D)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Particles3D_Attractor3D)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D", "Attractor3D");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D",
|
||||
ModuleKind::QmlLibrary,
|
||||
"Attractor3D");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DParticles3DAttractor3D();
|
||||
|
||||
@@ -1553,7 +1563,9 @@ TEST_F(NodeMetaInfo, QtQuick3D_Particles3D_Attractor3D)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Particles3D_Particle3D)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D", "Particle3D");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D",
|
||||
ModuleKind::QmlLibrary,
|
||||
"Particle3D");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DParticles3DParticle3D();
|
||||
|
||||
@@ -1571,7 +1583,9 @@ TEST_F(NodeMetaInfo, QtQuick3D_Particles3D_Particle3D)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Particles3D_ParticleEmitter3D)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D", "ParticleEmitter3D");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D",
|
||||
ModuleKind::QmlLibrary,
|
||||
"ParticleEmitter3D");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DParticles3DParticleEmitter3D();
|
||||
|
||||
@@ -1589,7 +1603,9 @@ TEST_F(NodeMetaInfo, QtQuick3D_Particles3D_ParticleEmitter3D)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Particles3D_SpriteParticle3D)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D", "SpriteParticle3D");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D.Particles3D",
|
||||
ModuleKind::QmlLibrary,
|
||||
"SpriteParticle3D");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DParticles3DSpriteParticle3D();
|
||||
|
||||
@@ -1607,7 +1623,7 @@ TEST_F(NodeMetaInfo, QtQuick3D_Particles3D_SpriteParticle3D)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Pass)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "Pass");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "Pass");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DPass();
|
||||
|
||||
@@ -1625,7 +1641,9 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_Pass)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_PrincipledMaterial)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "PrincipledMaterial");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D",
|
||||
ModuleKind::QmlLibrary,
|
||||
"PrincipledMaterial");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DPrincipledMaterial();
|
||||
|
||||
@@ -1643,7 +1661,9 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_PrincipledMaterial)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_SpecularGlossyMaterial)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "SpecularGlossyMaterial");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D",
|
||||
ModuleKind::QmlLibrary,
|
||||
"SpecularGlossyMaterial");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DSpecularGlossyMaterial();
|
||||
|
||||
@@ -1661,7 +1681,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_SpecularGlossyMaterial)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_SceneEnvironment)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "SceneEnvironment");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "SceneEnvironment");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DSceneEnvironment();
|
||||
|
||||
@@ -1679,7 +1699,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_SceneEnvironment)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Shader)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "Shader");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "Shader");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DShader();
|
||||
|
||||
@@ -1697,7 +1717,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_Shader)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_Texture)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "Texture");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "Texture");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DTexture();
|
||||
|
||||
@@ -1715,7 +1735,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_Texture)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_TextureInput)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "TextureInput");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "TextureInput");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DTextureInput();
|
||||
|
||||
@@ -1733,7 +1753,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_TextureInput)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_CubeMapTexture)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "CubeMapTexture");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "CubeMapTexture");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DCubeMapTexture();
|
||||
|
||||
@@ -1751,7 +1771,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_CubeMapTexture)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick3D_View3D)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", "View3D");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick3D", ModuleKind::QmlLibrary, "View3D");
|
||||
|
||||
bool isType = metaInfo.isQtQuick3DView3D();
|
||||
|
||||
@@ -1769,7 +1789,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick3D_View3D)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_BorderImage)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "BorderImage");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "BorderImage");
|
||||
|
||||
bool isType = metaInfo.isQtQuickBorderImage();
|
||||
|
||||
@@ -1787,7 +1807,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_BorderImage)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuickControls_SwipeView)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Controls", "SwipeView");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Controls", ModuleKind::QmlLibrary, "SwipeView");
|
||||
|
||||
bool isType = metaInfo.isQtQuickControlsSwipeView();
|
||||
|
||||
@@ -1805,7 +1825,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuickControls_SwipeView)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuickControls_TabBar)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Controls", "TabBar");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Controls", ModuleKind::QmlLibrary, "TabBar");
|
||||
|
||||
bool isType = metaInfo.isQtQuickControlsTabBar();
|
||||
|
||||
@@ -1823,7 +1843,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuickControls_TabBar)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuickExtras_Picture)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Extras", "Picture");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Extras", ModuleKind::QmlLibrary, "Picture");
|
||||
|
||||
bool isType = metaInfo.isQtQuickExtrasPicture();
|
||||
|
||||
@@ -1841,7 +1861,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuickExtras_Picture)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_Image)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "Image");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Image");
|
||||
|
||||
bool isType = metaInfo.isQtQuickImage();
|
||||
|
||||
@@ -1859,7 +1879,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_Image)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_Item)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "Item");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Item");
|
||||
|
||||
bool isType = metaInfo.isQtQuickItem();
|
||||
|
||||
@@ -1877,7 +1897,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_Item)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuickLayouts_BorderImage)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Layouts", "Layout");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Layouts", ModuleKind::QmlLibrary, "Layout");
|
||||
|
||||
bool isType = metaInfo.isQtQuickLayoutsLayout();
|
||||
|
||||
@@ -1895,7 +1915,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuickLayouts_Layout)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_Loader)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "Loader");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Loader");
|
||||
|
||||
bool isType = metaInfo.isQtQuickLoader();
|
||||
|
||||
@@ -1913,7 +1933,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_Loader)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_Path)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "Path");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Path");
|
||||
|
||||
bool isType = metaInfo.isQtQuickPath();
|
||||
|
||||
@@ -1931,7 +1951,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_Path)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_PauseAnimation)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "PauseAnimation");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "PauseAnimation");
|
||||
|
||||
bool isType = metaInfo.isQtQuickPauseAnimation();
|
||||
|
||||
@@ -1949,7 +1969,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_PauseAnimation)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_Positioner)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "Positioner");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Positioner");
|
||||
|
||||
bool isType = metaInfo.isQtQuickPositioner();
|
||||
|
||||
@@ -1967,7 +1987,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_Positioner)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_PropertyAnimation)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "PropertyAnimation");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "PropertyAnimation");
|
||||
|
||||
bool isType = metaInfo.isQtQuickPropertyAnimation();
|
||||
|
||||
@@ -1985,7 +2005,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_PropertyAnimation)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_PropertyChanges)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "PropertyChanges");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "PropertyChanges");
|
||||
|
||||
bool isType = metaInfo.isQtQuickPropertyChanges();
|
||||
|
||||
@@ -2003,7 +2023,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_PropertyChanges)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_Repeater)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "Repeater");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Repeater");
|
||||
|
||||
bool isType = metaInfo.isQtQuickRepeater();
|
||||
|
||||
@@ -2021,7 +2041,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_Repeater)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_State)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "State");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "State");
|
||||
|
||||
bool isType = metaInfo.isQtQuickState();
|
||||
|
||||
@@ -2039,7 +2059,9 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_State)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuickNative_StateOperation)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick-cppnative", "QQuickStateOperation");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick",
|
||||
ModuleKind::CppLibrary,
|
||||
"QQuickStateOperation");
|
||||
|
||||
bool isType = metaInfo.isQtQuickStateOperation();
|
||||
|
||||
@@ -2057,7 +2079,9 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuickNative_StateOperation)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuickStudioComponents_GroupItem)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Studio.Components", "GroupItem");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Studio.Components",
|
||||
ModuleKind::QmlLibrary,
|
||||
"GroupItem");
|
||||
|
||||
bool isType = metaInfo.isQtQuickStudioComponentsGroupItem();
|
||||
|
||||
@@ -2075,7 +2099,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuickStudioComponents_GroupItem)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_Text)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "Text");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Text");
|
||||
|
||||
bool isType = metaInfo.isQtQuickText();
|
||||
|
||||
@@ -2093,7 +2117,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_Text)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuickTimeline_Keyframe)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Timeline", "Keyframe");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Timeline", ModuleKind::QmlLibrary, "Keyframe");
|
||||
|
||||
bool isType = metaInfo.isQtQuickTimelineKeyframe();
|
||||
|
||||
@@ -2111,7 +2135,9 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_Keyframe)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuickTimeline_KeyframeGroup)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Timeline", "KeyframeGroup");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Timeline",
|
||||
ModuleKind::QmlLibrary,
|
||||
"KeyframeGroup");
|
||||
|
||||
bool isType = metaInfo.isQtQuickTimelineKeyframeGroup();
|
||||
|
||||
@@ -2129,7 +2155,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_KeyframeGroup)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuickTimeline_Timeline)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Timeline", "Timeline");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Timeline", ModuleKind::QmlLibrary, "Timeline");
|
||||
|
||||
bool isType = metaInfo.isQtQuickTimelineTimeline();
|
||||
|
||||
@@ -2147,7 +2173,9 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_Timeline)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuickTimeline_TimelineAnimation)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Timeline", "TimelineAnimation");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Timeline",
|
||||
ModuleKind::QmlLibrary,
|
||||
"TimelineAnimation");
|
||||
|
||||
bool isType = metaInfo.isQtQuickTimelineTimelineAnimation();
|
||||
|
||||
@@ -2165,7 +2193,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_TimelineAnimation)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuick_Transition)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "Transition");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Transition");
|
||||
|
||||
bool isType = metaInfo.isQtQuickTransition();
|
||||
|
||||
@@ -2183,7 +2211,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuick_Transition)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtQuickWindow_Window)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Window", "Window");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Window", ModuleKind::QmlLibrary, "Window");
|
||||
|
||||
bool isType = metaInfo.isQtQuickWindowWindow();
|
||||
|
||||
@@ -2201,7 +2229,9 @@ TEST_F(NodeMetaInfo, default_is_not_QtQuickWindow_Window)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtSafeRenderer_SafeRendererPicture)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("Qt.SafeRenderer", "SafeRendererPicture");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("Qt.SafeRenderer",
|
||||
ModuleKind::QmlLibrary,
|
||||
"SafeRendererPicture");
|
||||
|
||||
bool isType = metaInfo.isQtSafeRendererSafeRendererPicture();
|
||||
|
||||
@@ -2219,7 +2249,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtSafeRenderer_SafeRendererPicture)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_QtSafeRenderer_SafePicture)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("Qt.SafeRenderer", "SafePicture");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("Qt.SafeRenderer", ModuleKind::QmlLibrary, "SafePicture");
|
||||
|
||||
bool isType = metaInfo.isQtSafeRendererSafePicture();
|
||||
|
||||
@@ -2237,7 +2267,7 @@ TEST_F(NodeMetaInfo, default_is_not_QtSafeRenderer_SafePicture)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_string)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QML", "string");
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "string");
|
||||
|
||||
bool isType = metaInfo.isString();
|
||||
|
||||
@@ -2255,7 +2285,7 @@ TEST_F(NodeMetaInfo, default_is_not_string)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuick_Item_is_suitable_for_MouseArea_fill)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "Item");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Item");
|
||||
|
||||
bool isType = metaInfo.isSuitableForMouseAreaFill();
|
||||
|
||||
@@ -2264,7 +2294,7 @@ TEST_F(NodeMetaInfo, QtQuick_Item_is_suitable_for_MouseArea_fill)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuick_MouseArea_is_suitable_for_MouseArea_fill)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "MouseArea");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "MouseArea");
|
||||
|
||||
bool isType = metaInfo.isSuitableForMouseAreaFill();
|
||||
|
||||
@@ -2273,7 +2303,7 @@ TEST_F(NodeMetaInfo, QtQuick_MouseArea_is_suitable_for_MouseArea_fill)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuickControls_Control_is_suitable_for_MouseArea_fill)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Controls", "Control");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Controls", ModuleKind::QmlLibrary, "Control");
|
||||
|
||||
bool isType = metaInfo.isSuitableForMouseAreaFill();
|
||||
|
||||
@@ -2282,7 +2312,7 @@ TEST_F(NodeMetaInfo, QtQuickControls_Control_is_suitable_for_MouseArea_fill)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuickTemplates_Control_is_suitable_for_MouseArea_fill)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Templates", "Control");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick.Templates", ModuleKind::QmlLibrary, "Control");
|
||||
|
||||
bool isType = metaInfo.isSuitableForMouseAreaFill();
|
||||
|
||||
@@ -2300,7 +2330,7 @@ TEST_F(NodeMetaInfo, default_is_not_suitable_for_MouseArea_fill)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_url)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QML", "url");
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "url");
|
||||
|
||||
bool isType = metaInfo.isUrl();
|
||||
|
||||
@@ -2318,7 +2348,7 @@ TEST_F(NodeMetaInfo, default_is_not_url)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_variant)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QML", "var");
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "var");
|
||||
|
||||
bool isType = metaInfo.isVariant();
|
||||
|
||||
@@ -2336,7 +2366,7 @@ TEST_F(NodeMetaInfo, default_is_not_variant)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_vector2d)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QtQuick", "vector2d");
|
||||
auto metaInfo = createMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector2d");
|
||||
|
||||
bool isType = metaInfo.isVector2D();
|
||||
|
||||
@@ -2354,7 +2384,7 @@ TEST_F(NodeMetaInfo, default_is_not_vector2d)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_vector3d)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QtQuick", "vector3d");
|
||||
auto metaInfo = createMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector3d");
|
||||
|
||||
bool isType = metaInfo.isVector3D();
|
||||
|
||||
@@ -2372,7 +2402,7 @@ TEST_F(NodeMetaInfo, default_is_not_vector3d)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_vector4d)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QtQuick", "vector4d");
|
||||
auto metaInfo = createMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector4d");
|
||||
|
||||
bool isType = metaInfo.isVector4D();
|
||||
|
||||
@@ -2390,7 +2420,7 @@ TEST_F(NodeMetaInfo, default_is_not_vector4d)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuick_ListView_is_view)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "ListView");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "ListView");
|
||||
|
||||
bool isType = metaInfo.isView();
|
||||
|
||||
@@ -2399,7 +2429,7 @@ TEST_F(NodeMetaInfo, QtQuick_ListView_is_view)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuick_GridView_is_view)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "GridView");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "GridView");
|
||||
|
||||
bool isType = metaInfo.isView();
|
||||
|
||||
@@ -2408,7 +2438,7 @@ TEST_F(NodeMetaInfo, QtQuick_GridView_is_view)
|
||||
|
||||
TEST_F(NodeMetaInfo, QtQuick_PathView_is_view)
|
||||
{
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", "PathView");
|
||||
auto metaInfo = createDerivedDummyMetaInfo("QtQuick", ModuleKind::QmlLibrary, "PathView");
|
||||
|
||||
bool isType = metaInfo.isView();
|
||||
|
||||
@@ -2428,7 +2458,7 @@ TEST_F(NodeMetaInfo, is_enumeration)
|
||||
{
|
||||
TypeTraits traits;
|
||||
traits.isEnum = true;
|
||||
auto metaInfo = createMetaInfo("QML", "Foo", traits);
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "Foo", traits);
|
||||
|
||||
bool isType = metaInfo.isEnumeration();
|
||||
|
||||
@@ -2437,7 +2467,7 @@ TEST_F(NodeMetaInfo, is_enumeration)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_not_enumeration)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QML", "Foo", {});
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "Foo", {});
|
||||
|
||||
bool isType = metaInfo.isEnumeration();
|
||||
|
||||
@@ -2457,7 +2487,7 @@ TEST_F(NodeMetaInfo, all_external_type_names)
|
||||
{
|
||||
QmlDesigner::Storage::Info::ExportedTypeNames names{{qmlModuleId, "Object", 2, -1},
|
||||
{qmlModuleId, "Obj", 2, 1}};
|
||||
auto metaInfo = createMetaInfo("QML", "Foo");
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "Foo");
|
||||
ON_CALL(projectStorageMock, exportedTypeNames(metaInfo.id())).WillByDefault(Return(names));
|
||||
|
||||
auto exportedTypeNames = metaInfo.allExportedTypeNames();
|
||||
@@ -2483,7 +2513,7 @@ TEST_F(NodeMetaInfo, external_type_names_for_source_id)
|
||||
{
|
||||
QmlDesigner::Storage::Info::ExportedTypeNames names{{qmlModuleId, "Object", 2, -1},
|
||||
{qmlModuleId, "Obj", 2, 1}};
|
||||
auto metaInfo = createMetaInfo("QML", "Foo");
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "Foo");
|
||||
ON_CALL(projectStorageMock, exportedTypeNames(metaInfo.id(), model.fileUrlSourceId()))
|
||||
.WillByDefault(Return(names));
|
||||
|
||||
@@ -2511,7 +2541,7 @@ TEST_F(NodeMetaInfo, invalid_source_id_has_no_external_type_names_for_source_id)
|
||||
{
|
||||
QmlDesigner::Storage::Info::ExportedTypeNames names{{qmlModuleId, "Object", 2, -1},
|
||||
{qmlModuleId, "Obj", 2, 1}};
|
||||
auto metaInfo = createMetaInfo("QML", "Foo");
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "Foo");
|
||||
ON_CALL(projectStorageMock, exportedTypeNames(metaInfo.id(), model.fileUrlSourceId()))
|
||||
.WillByDefault(Return(names));
|
||||
QmlDesigner::SourceId sourceId;
|
||||
@@ -2523,7 +2553,7 @@ TEST_F(NodeMetaInfo, invalid_source_id_has_no_external_type_names_for_source_id)
|
||||
|
||||
TEST_F(NodeMetaInfo, float_is_a_number)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QML-cppnative", "float");
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::CppLibrary, "float");
|
||||
|
||||
bool isType = metaInfo.isNumber();
|
||||
|
||||
@@ -2550,7 +2580,7 @@ TEST_F(NodeMetaInfo, int_is_a_number)
|
||||
|
||||
TEST_F(NodeMetaInfo, uint_is_a_number)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QML-cppnative", "uint");
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::CppLibrary, "uint");
|
||||
|
||||
bool isType = metaInfo.isNumber();
|
||||
|
||||
@@ -2568,7 +2598,7 @@ TEST_F(NodeMetaInfo, default_is_not_number)
|
||||
|
||||
TEST_F(NodeMetaInfo, property_editor_specifics_path)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QtQuick", "Item");
|
||||
auto metaInfo = createMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Item");
|
||||
auto pathId = QmlDesigner::SourceId::create(45);
|
||||
ON_CALL(projectStorageMock, propertyEditorPathId(metaInfo.id())).WillByDefault(Return(pathId));
|
||||
|
||||
@@ -2588,7 +2618,7 @@ TEST_F(NodeMetaInfo, default_property_editor_specifics_path_is_empty)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_reference)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QtQuick", "Item", TypeTraitsKind::Reference);
|
||||
auto metaInfo = createMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Item", TypeTraitsKind::Reference);
|
||||
|
||||
auto type = metaInfo.type();
|
||||
|
||||
@@ -2597,7 +2627,7 @@ TEST_F(NodeMetaInfo, is_reference)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_value)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QML", "bool", TypeTraitsKind::Value);
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "bool", TypeTraitsKind::Value);
|
||||
|
||||
auto type = metaInfo.type();
|
||||
|
||||
@@ -2606,7 +2636,7 @@ TEST_F(NodeMetaInfo, is_value)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_sequence)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QML", "QObjectList", TypeTraitsKind::Sequence);
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "QObjectList", TypeTraitsKind::Sequence);
|
||||
|
||||
auto type = metaInfo.type();
|
||||
|
||||
@@ -2615,7 +2645,7 @@ TEST_F(NodeMetaInfo, is_sequence)
|
||||
|
||||
TEST_F(NodeMetaInfo, is_none)
|
||||
{
|
||||
auto metaInfo = createMetaInfo("QML", "void", TypeTraitsKind::None);
|
||||
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "void", TypeTraitsKind::None);
|
||||
|
||||
auto type = metaInfo.type();
|
||||
|
||||
@@ -2657,7 +2687,7 @@ TEST_F(NodeMetaInfo, invalid_can_not_be_container)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_can_be_container)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.canBeContainer = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -2694,7 +2724,7 @@ TEST_F(NodeMetaInfo, invalid_do_no_forces_clipping)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_forces_clipping)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.forceClip = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -2731,7 +2761,7 @@ TEST_F(NodeMetaInfo, invalid_does_not_layout_children)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_layouts_children)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.doesLayoutChildren = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -2768,7 +2798,7 @@ TEST_F(NodeMetaInfo, invalid_cannot_be_dropped_in_form_editor)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_can_be_dropped_in_form_editor)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.canBeDroppedInFormEditor = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -2805,7 +2835,7 @@ TEST_F(NodeMetaInfo, invalid_cannot_be_dropped_in_navigator)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_can_be_dropped_in_navigator)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.canBeDroppedInNavigator = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -2842,7 +2872,7 @@ TEST_F(NodeMetaInfo, invalid_cannot_be_dropped_in_3d_view)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_can_be_dropped_in_3d_view)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.canBeDroppedInView3D = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -2879,7 +2909,7 @@ TEST_F(NodeMetaInfo, invalid_is_not_movable)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_is_movable)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.isMovable = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -2916,7 +2946,7 @@ TEST_F(NodeMetaInfo, invalid_is_not_resizable)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_is_resizable)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.isResizable = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -2953,7 +2983,7 @@ TEST_F(NodeMetaInfo, invalid_has_not_form_editor_item)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_has_form_editor_item)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.hasFormEditorItem = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -2990,7 +3020,7 @@ TEST_F(NodeMetaInfo, invalid_is_not_stacked_container)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_is_stacked_container)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.isStackedContainer = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -3027,7 +3057,7 @@ TEST_F(NodeMetaInfo, invalid_dont_takes_over_rendering_of_children)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_takes_over_rendering_of_children)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.takesOverRenderingOfChildren = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -3064,7 +3094,7 @@ TEST_F(NodeMetaInfo, invalid_is_not_visible_in_navigator)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_is_visible_in_navigator)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.visibleInNavigator = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
@@ -3101,7 +3131,7 @@ TEST_F(NodeMetaInfo, invalid_is_not_visible_in_library)
|
||||
|
||||
TEST_F(NodeMetaInfo, component_is_visible_in_library)
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project");
|
||||
auto moduleId = projectStorageMock.createModule("/path/to/project", ModuleKind::PathLibrary);
|
||||
TypeTraits traits{TypeTraitsKind::Reference};
|
||||
traits.visibleInLibrary = FlagIs::True;
|
||||
auto typeId = projectStorageMock.createType(moduleId, "Foo", traits);
|
||||
|
@@ -22,6 +22,7 @@ namespace {
|
||||
using QmlDesigner::Enumeration;
|
||||
using QmlDesigner::ModelNode;
|
||||
using QmlDesigner::ModelNodes;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
using QmlDesigner::Storage::PropertyDeclarationTraits;
|
||||
using QmlDesigner::Storage::TypeTraits;
|
||||
|
||||
@@ -29,10 +30,11 @@ class PropertyMetaInfo : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
QmlDesigner::NodeMetaInfo createNodeMetaInfo(Utils::SmallStringView moduleName,
|
||||
ModuleKind moduleKind,
|
||||
Utils::SmallStringView typeName,
|
||||
QmlDesigner::Storage::TypeTraits typeTraits = {})
|
||||
{
|
||||
auto moduleId = projectStorageMock.createModule(moduleName);
|
||||
auto moduleId = projectStorageMock.createModule(moduleName, moduleKind);
|
||||
auto typeId = projectStorageMock.createType(moduleId, typeName, typeTraits);
|
||||
|
||||
return QmlDesigner::NodeMetaInfo{typeId, &projectStorageMock};
|
||||
@@ -47,7 +49,7 @@ protected:
|
||||
QmlDesigner::Import::createLibraryImport("QtQuick"),
|
||||
QmlDesigner::Import::createLibraryImport("QtQml.Models")},
|
||||
QUrl::fromLocalFile(pathCache.path.toQString())};
|
||||
QmlDesigner::NodeMetaInfo nodeInfo = createNodeMetaInfo("QtQuick", "Foo");
|
||||
QmlDesigner::NodeMetaInfo nodeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Foo");
|
||||
};
|
||||
|
||||
TEST_F(PropertyMetaInfo, name)
|
||||
@@ -71,7 +73,7 @@ TEST_F(PropertyMetaInfo, default_has_no_name)
|
||||
|
||||
TEST_F(PropertyMetaInfo, property_type)
|
||||
{
|
||||
auto barInfo = createNodeMetaInfo("QtQuick", "Bar");
|
||||
auto barInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Bar");
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, barInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
|
||||
@@ -91,7 +93,7 @@ TEST_F(PropertyMetaInfo, default_hads_invalid_property_type)
|
||||
|
||||
TEST_F(PropertyMetaInfo, type)
|
||||
{
|
||||
auto barInfo = createNodeMetaInfo("QtQuick", "Bar");
|
||||
auto barInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "Bar");
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, barInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
|
||||
@@ -181,7 +183,7 @@ TEST_F(PropertyMetaInfo, is_enumeration)
|
||||
{
|
||||
TypeTraits traits;
|
||||
traits.isEnum = true;
|
||||
auto enumInfo = createNodeMetaInfo("QtQuick", "MyEnum", traits);
|
||||
auto enumInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "MyEnum", traits);
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, enumInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
|
||||
@@ -192,7 +194,7 @@ TEST_F(PropertyMetaInfo, is_enumeration)
|
||||
|
||||
TEST_F(PropertyMetaInfo, is_not_enumeration)
|
||||
{
|
||||
auto notEnumInfo = createNodeMetaInfo("QtQuick", "NoEnum", {});
|
||||
auto notEnumInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "NoEnum", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, notEnumInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
|
||||
@@ -275,7 +277,7 @@ TEST_F(PropertyMetaInfo, cast_to_enumeration)
|
||||
{
|
||||
TypeTraits traits;
|
||||
traits.isEnum = true;
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "MyEnum", traits);
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "MyEnum", traits);
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
Enumeration enumeration{"MyEnum.Foo"};
|
||||
@@ -288,7 +290,7 @@ TEST_F(PropertyMetaInfo, cast_to_enumeration)
|
||||
|
||||
TEST_F(PropertyMetaInfo, dont_to_cast_enumeration_if_property_type_is_not_enumeration)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "MyEnum", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "MyEnum", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
Enumeration enumeration{"MyEnum.Foo"};
|
||||
@@ -303,7 +305,7 @@ TEST_F(PropertyMetaInfo, dont_to_cast_enumeration_if_value_is_not_Enumeration)
|
||||
{
|
||||
TypeTraits traits;
|
||||
traits.isEnum = true;
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "MyEnum", traits);
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "MyEnum", traits);
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(QString{"enumeration"});
|
||||
@@ -315,7 +317,7 @@ TEST_F(PropertyMetaInfo, dont_to_cast_enumeration_if_value_is_not_Enumeration)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_to_model_node)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "var", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "var", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(model.rootModelNode());
|
||||
@@ -327,7 +329,7 @@ TEST_F(PropertyMetaInfo, cast_to_model_node)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_to_qvariant_always_returns_the_save_variant_if_the_property_type_is_var)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "var", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "var", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(QString{"foo"});
|
||||
@@ -339,7 +341,7 @@ TEST_F(PropertyMetaInfo, cast_to_qvariant_always_returns_the_save_variant_if_the
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_double_to_double)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "double", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "double", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14.2);
|
||||
@@ -351,7 +353,7 @@ TEST_F(PropertyMetaInfo, cast_double_to_double)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_int_to_double_returns_number_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "double", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "double", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14);
|
||||
@@ -363,7 +365,7 @@ TEST_F(PropertyMetaInfo, cast_int_to_double_returns_number_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_default_to_double_returns_zero_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "double", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "double", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant();
|
||||
@@ -375,7 +377,7 @@ TEST_F(PropertyMetaInfo, cast_default_to_double_returns_zero_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_qstring_to_double_returns_zero_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "double", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "double", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(QString{"foo"});
|
||||
@@ -387,7 +389,7 @@ TEST_F(PropertyMetaInfo, cast_qstring_to_double_returns_zero_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_float_to_float)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML-cppnative", "float", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::CppLibrary, "float", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14.2f);
|
||||
@@ -399,7 +401,7 @@ TEST_F(PropertyMetaInfo, cast_float_to_float)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_int_to_float_returns_number_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML-cppnative", "float", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::CppLibrary, "float", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14);
|
||||
@@ -411,7 +413,7 @@ TEST_F(PropertyMetaInfo, cast_int_to_float_returns_number_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_default_to_float_returns_zero_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML-cppnative", "float", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::CppLibrary, "float", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant();
|
||||
@@ -423,7 +425,7 @@ TEST_F(PropertyMetaInfo, cast_default_to_float_returns_zero_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_qstring_to_float_returns_zero_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML-cppnative", "float", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::CppLibrary, "float", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(QString{"foo"});
|
||||
@@ -435,7 +437,7 @@ TEST_F(PropertyMetaInfo, cast_qstring_to_float_returns_zero_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_int_to_int)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "int", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "int", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14);
|
||||
@@ -447,7 +449,7 @@ TEST_F(PropertyMetaInfo, cast_int_to_int)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_double_to_int_returns_number_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "int", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "int", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14.2);
|
||||
@@ -459,7 +461,7 @@ TEST_F(PropertyMetaInfo, cast_double_to_int_returns_number_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_default_to_int_returns_zero_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "int", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "int", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant();
|
||||
@@ -471,7 +473,7 @@ TEST_F(PropertyMetaInfo, cast_default_to_int_returns_zero_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_qstring_to_int_returns_zero_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "int", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "int", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(QString{"foo"});
|
||||
@@ -483,7 +485,7 @@ TEST_F(PropertyMetaInfo, cast_qstring_to_int_returns_zero_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_bool_to_bool)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "bool", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "bool", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(true);
|
||||
@@ -495,7 +497,7 @@ TEST_F(PropertyMetaInfo, cast_bool_to_bool)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_float_to_bool_returns_boolean_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "bool", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "bool", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14.2f);
|
||||
@@ -507,7 +509,7 @@ TEST_F(PropertyMetaInfo, cast_float_to_bool_returns_boolean_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_double_to_bool_returns_boolean_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "bool", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "bool", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14.2);
|
||||
@@ -519,7 +521,7 @@ TEST_F(PropertyMetaInfo, cast_double_to_bool_returns_boolean_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_int_to_bool_returns_boolean_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "bool", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "bool", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14);
|
||||
@@ -531,7 +533,7 @@ TEST_F(PropertyMetaInfo, cast_int_to_bool_returns_boolean_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_long_to_bool_returns_boolean_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "bool", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "bool", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14L);
|
||||
@@ -543,7 +545,7 @@ TEST_F(PropertyMetaInfo, cast_long_to_bool_returns_boolean_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_long_long_to_bool_returns_boolean_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "bool", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "bool", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14LL);
|
||||
@@ -555,7 +557,7 @@ TEST_F(PropertyMetaInfo, cast_long_long_to_bool_returns_boolean_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_default_to_bool_returns_zero_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "bool", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "bool", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant();
|
||||
@@ -567,7 +569,7 @@ TEST_F(PropertyMetaInfo, cast_default_to_bool_returns_zero_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_qstring_to_bool_returns_zero_variant)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "bool", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "bool", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(QString{"foo"});
|
||||
@@ -579,7 +581,7 @@ TEST_F(PropertyMetaInfo, cast_qstring_to_bool_returns_zero_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_string_to_string)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "string", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "string", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(QString{"foo"});
|
||||
@@ -591,7 +593,7 @@ TEST_F(PropertyMetaInfo, cast_string_to_string)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_QByteArray_to_empty_string)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "string", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "string", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(QByteArray{"foo"});
|
||||
@@ -603,7 +605,7 @@ TEST_F(PropertyMetaInfo, cast_QByteArray_to_empty_string)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_int_to_empty_string)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "string", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "string", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14);
|
||||
@@ -615,7 +617,7 @@ TEST_F(PropertyMetaInfo, cast_int_to_empty_string)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_default_to_empty_string)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "string", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "string", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant();
|
||||
@@ -627,7 +629,7 @@ TEST_F(PropertyMetaInfo, cast_default_to_empty_string)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_datatime_to_datetime)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "date", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "date", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto dataTime = QDateTime::currentDateTime();
|
||||
@@ -640,7 +642,7 @@ TEST_F(PropertyMetaInfo, cast_datatime_to_datetime)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_int_to_datetime_returns_default_datetime)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "date", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "date", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(14);
|
||||
@@ -652,7 +654,7 @@ TEST_F(PropertyMetaInfo, cast_int_to_datetime_returns_default_datetime)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_string_to_datetime_returns_default_datetime)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "date", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "date", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(QString{"Monday"});
|
||||
@@ -664,7 +666,7 @@ TEST_F(PropertyMetaInfo, cast_string_to_datetime_returns_default_datetime)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_default_to_datetime_returns_default_datetime)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "date", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "date", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant();
|
||||
@@ -676,7 +678,7 @@ TEST_F(PropertyMetaInfo, cast_default_to_datetime_returns_default_datetime)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_url_to_url)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "url", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "url", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto url = QUrl("http://www.qt.io/future");
|
||||
@@ -689,7 +691,7 @@ TEST_F(PropertyMetaInfo, cast_url_to_url)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_string_to_empty_url)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "url", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "url", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant::fromValue(QString{"http://www.qt.io/future"});
|
||||
@@ -701,7 +703,7 @@ TEST_F(PropertyMetaInfo, cast_string_to_empty_url)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_default_to_empty_url)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", "url", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QML", ModuleKind::QmlLibrary, "url", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant();
|
||||
@@ -713,7 +715,7 @@ TEST_F(PropertyMetaInfo, cast_default_to_empty_url)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_color_to_color)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "color", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "color", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto color = QColor(Qt::red);
|
||||
@@ -726,7 +728,7 @@ TEST_F(PropertyMetaInfo, cast_color_to_color)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_string_to_null_color)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "color", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "color", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant("red");
|
||||
@@ -738,7 +740,7 @@ TEST_F(PropertyMetaInfo, cast_string_to_null_color)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_int_to_null_color)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "color", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "color", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant(14);
|
||||
@@ -750,7 +752,7 @@ TEST_F(PropertyMetaInfo, cast_int_to_null_color)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_default_to_null_color)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "color", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "color", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant();
|
||||
@@ -762,7 +764,7 @@ TEST_F(PropertyMetaInfo, cast_default_to_null_color)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_vector2d_to_vector2d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector2d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector2d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto vector2d = QVector2D{32.2f, 2.2f};
|
||||
@@ -775,7 +777,7 @@ TEST_F(PropertyMetaInfo, cast_vector2d_to_vector2d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_string_to_vector2d_returns_an_empty_vector2d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector2d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector2d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant(QString{"foo"});
|
||||
@@ -787,7 +789,7 @@ TEST_F(PropertyMetaInfo, cast_string_to_vector2d_returns_an_empty_vector2d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_int_to_vector2d_returns_an_empty_vector2d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector2d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector2d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant(12);
|
||||
@@ -799,7 +801,7 @@ TEST_F(PropertyMetaInfo, cast_int_to_vector2d_returns_an_empty_vector2d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_vector3d_to_vector2d_returns_an_empty_vector2d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector2d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector2d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant(QVector3D{32.2f, 2.2f, 784.f});
|
||||
@@ -811,7 +813,7 @@ TEST_F(PropertyMetaInfo, cast_vector3d_to_vector2d_returns_an_empty_vector2d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_default_to_vector2d_returns_an_empty_vector2d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector2d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector2d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant();
|
||||
@@ -823,7 +825,7 @@ TEST_F(PropertyMetaInfo, cast_default_to_vector2d_returns_an_empty_vector2d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_vector3d_to_vector3d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector3d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector3d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto vector3d = QVector3D{32.2f, 2.2f, 44.4f};
|
||||
@@ -836,7 +838,7 @@ TEST_F(PropertyMetaInfo, cast_vector3d_to_vector3d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_string_to_vector3d_returns_an_empty_vector3d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector3d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector3d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant(QString{"foo"});
|
||||
@@ -848,7 +850,7 @@ TEST_F(PropertyMetaInfo, cast_string_to_vector3d_returns_an_empty_vector3d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_int_to_vector3d_returns_an_empty_vector3d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector3d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector3d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant(12);
|
||||
@@ -860,7 +862,7 @@ TEST_F(PropertyMetaInfo, cast_int_to_vector3d_returns_an_empty_vector3d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_vector4d_to_vector3d_returns_an_empty_vector3d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector3d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector3d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant(QVector4D{32.2f, 2.2f, 784.f, 99.f});
|
||||
@@ -872,7 +874,7 @@ TEST_F(PropertyMetaInfo, cast_vector4d_to_vector3d_returns_an_empty_vector3d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_default_to_vector3d_returns_an_empty_vector3d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector3d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector3d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant();
|
||||
@@ -884,7 +886,7 @@ TEST_F(PropertyMetaInfo, cast_default_to_vector3d_returns_an_empty_vector3d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_vector4d_to_vector4d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector4d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector4d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto vector4d = QVector4D{32.2f, 2.2f, 44.4f, 23.f};
|
||||
@@ -897,7 +899,7 @@ TEST_F(PropertyMetaInfo, cast_vector4d_to_vector4d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_string_to_vector4d_returns_an_empty_vector4d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector4d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector4d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant(QString{"foo"});
|
||||
@@ -909,7 +911,7 @@ TEST_F(PropertyMetaInfo, cast_string_to_vector4d_returns_an_empty_vector4d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_int_to_vector4d_returns_an_empty_vector4d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector4d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector4d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant(12);
|
||||
@@ -921,7 +923,7 @@ TEST_F(PropertyMetaInfo, cast_int_to_vector4d_returns_an_empty_vector4d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_vector2d_to_vector4d_returns_an_empty_vector4d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector4d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector4d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant(QVector2D{32.2f, 2.2f});
|
||||
@@ -933,7 +935,7 @@ TEST_F(PropertyMetaInfo, cast_vector2d_to_vector4d_returns_an_empty_vector4d)
|
||||
|
||||
TEST_F(PropertyMetaInfo, cast_default_to_vector4d_returns_an_empty_vector4d)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector4d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector4d", {});
|
||||
projectStorageMock.createProperty(nodeInfo.id(), "bar", {}, propertyTypeInfo.id());
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant();
|
||||
@@ -955,7 +957,7 @@ TEST_F(PropertyMetaInfo, default_cast_to_invalid_variant)
|
||||
|
||||
TEST_F(PropertyMetaInfo, not_existing_property_cast_returns_invalid_value)
|
||||
{
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", "vector4d", {});
|
||||
auto propertyTypeInfo = createNodeMetaInfo("QtQuick", ModuleKind::QmlLibrary, "vector4d", {});
|
||||
auto propertyInfo = nodeInfo.property("bar");
|
||||
auto value = QVariant(43);
|
||||
|
||||
|
@@ -26,6 +26,7 @@ using QmlDesigner::AbstractProperty;
|
||||
using QmlDesigner::ModelNode;
|
||||
using QmlDesigner::ModelNodes;
|
||||
using QmlDesigner::ModelResourceSet;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
|
||||
MATCHER(IsSorted, std::string(negation ? "isn't sorted" : "is sorted"))
|
||||
{
|
||||
@@ -125,10 +126,10 @@ protected:
|
||||
resourceManagementMock)};
|
||||
NiceMock<AbstractViewMock> viewMock;
|
||||
QmlDesigner::SourceId filePathId = pathCacheMock.sourceId;
|
||||
QmlDesigner::TypeId itemTypeId = projectStorageMock.typeId(projectStorageMock.moduleId(
|
||||
"QtQuick"),
|
||||
"Item",
|
||||
QmlDesigner::Storage::Version{});
|
||||
QmlDesigner::TypeId itemTypeId = projectStorageMock.typeId(
|
||||
projectStorageMock.moduleId("QtQuick", ModuleKind::QmlLibrary),
|
||||
"Item",
|
||||
QmlDesigner::Storage::Version{});
|
||||
QmlDesigner::ImportedTypeNameId itemTypeNameId = projectStorageMock.createImportedTypeNameId(
|
||||
filePathId, "Item", itemTypeId);
|
||||
ModelNode rootNode;
|
||||
@@ -759,8 +760,8 @@ TEST_F(Model, change_imports_is_synchronizing_imports_with_project_storage)
|
||||
{
|
||||
QmlDesigner::SourceId directoryPathId = QmlDesigner::SourceId::create(2);
|
||||
ON_CALL(pathCacheMock, sourceId(Eq("/path/foo/."))).WillByDefault(Return(directoryPathId));
|
||||
auto qtQuickModuleId = projectStorageMock.moduleId("QtQuick");
|
||||
auto qtQmlModelsModuleId = projectStorageMock.moduleId("QtQml.Models");
|
||||
auto qtQuickModuleId = projectStorageMock.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
auto qtQmlModelsModuleId = projectStorageMock.moduleId("QtQml.Models", ModuleKind::QmlLibrary);
|
||||
auto qtQuickImport = QmlDesigner::Import::createLibraryImport("QtQuick", "2.1");
|
||||
auto qtQmlModelsImport = QmlDesigner::Import::createLibraryImport("QtQml.Models");
|
||||
auto directoryImport = QmlDesigner::Import::createFileImport("foo");
|
||||
@@ -793,8 +794,8 @@ TEST_F(Model, change_imports_is_adding_import_in_project_storage)
|
||||
{
|
||||
QmlDesigner::SourceId directoryPathId = QmlDesigner::SourceId::create(2);
|
||||
ON_CALL(pathCacheMock, sourceId(Eq("/path/foo/."))).WillByDefault(Return(directoryPathId));
|
||||
auto qtQuickModuleId = projectStorageMock.moduleId("QtQuick");
|
||||
auto qtQmlModelsModuleId = projectStorageMock.moduleId("QtQml.Models");
|
||||
auto qtQuickModuleId = projectStorageMock.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
auto qtQmlModelsModuleId = projectStorageMock.moduleId("QtQml.Models", ModuleKind::QmlLibrary);
|
||||
auto qtQuickImport = QmlDesigner::Import::createLibraryImport("QtQuick", "2.1");
|
||||
auto qtQmlModelsImport = QmlDesigner::Import::createLibraryImport("QtQml.Models");
|
||||
auto directoryImport = QmlDesigner::Import::createFileImport("foo");
|
||||
@@ -813,7 +814,7 @@ TEST_F(Model, change_imports_is_removing_import_in_project_storage)
|
||||
{
|
||||
QmlDesigner::SourceId directoryPathId = QmlDesigner::SourceId::create(2);
|
||||
ON_CALL(pathCacheMock, sourceId(Eq("/path/foo/."))).WillByDefault(Return(directoryPathId));
|
||||
auto qtQmlModelsModuleId = projectStorageMock.moduleId("QtQml.Models");
|
||||
auto qtQmlModelsModuleId = projectStorageMock.moduleId("QtQml.Models", ModuleKind::QmlLibrary);
|
||||
auto qtQuickImport = QmlDesigner::Import::createLibraryImport("QtQuick", "2.1");
|
||||
auto qtQmlModelsImport = QmlDesigner::Import::createLibraryImport("QtQml.Models");
|
||||
auto directoryImport = QmlDesigner::Import::createFileImport("foo");
|
||||
@@ -846,8 +847,8 @@ TEST_F(Model, change_imports_is_changing_import_version_with_project_storage)
|
||||
{
|
||||
QmlDesigner::SourceId directoryPathId = QmlDesigner::SourceId::create(2);
|
||||
ON_CALL(pathCacheMock, sourceId(Eq("/path/foo/."))).WillByDefault(Return(directoryPathId));
|
||||
auto qtQuickModuleId = projectStorageMock.moduleId("QtQuick");
|
||||
auto qtQmlModelsModuleId = projectStorageMock.moduleId("QtQml.Models");
|
||||
auto qtQuickModuleId = projectStorageMock.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
auto qtQmlModelsModuleId = projectStorageMock.moduleId("QtQml.Models", ModuleKind::QmlLibrary);
|
||||
auto qtQuickImport = QmlDesigner::Import::createLibraryImport("QtQuick", "2.1");
|
||||
auto qtQmlModelsImport = QmlDesigner::Import::createLibraryImport("QtQml.Models");
|
||||
auto directoryImport = QmlDesigner::Import::createFileImport("foo");
|
||||
@@ -873,7 +874,7 @@ TEST_F(Model, create_model_node_has_meta_info)
|
||||
TEST_F(Model, create_qualified_model_node_has_meta_info)
|
||||
{
|
||||
auto qtQmlModelsImport = QmlDesigner::Import::createLibraryImport("QtQml.Models", "", "Foo");
|
||||
auto qtQmlModelsModulesId = projectStorageMock.moduleId("QtQml.Models");
|
||||
auto qtQmlModelsModulesId = projectStorageMock.moduleId("QtQml.Models", ModuleKind::QmlLibrary);
|
||||
auto importId = projectStorageMock.createImportId(qtQmlModelsModulesId, filePathId);
|
||||
auto listModelTypeId = projectStorageMock.typeId(qtQmlModelsModulesId,
|
||||
"ListModel",
|
||||
@@ -913,23 +914,23 @@ TEST_F(Model, meta_info_of_not_existing_type_is_invalid)
|
||||
|
||||
TEST_F(Model, module_is_valid)
|
||||
{
|
||||
auto module = model.module("QML");
|
||||
auto module = model.module("QML", ModuleKind::QmlLibrary);
|
||||
|
||||
ASSERT_THAT(module, IsTrue());
|
||||
}
|
||||
|
||||
TEST_F(Model, module_returns_always_the_same)
|
||||
{
|
||||
auto oldModule = model.module("QML");
|
||||
auto oldModule = model.module("QML", ModuleKind::QmlLibrary);
|
||||
|
||||
auto module = model.module("QML");
|
||||
auto module = model.module("QML", ModuleKind::QmlLibrary);
|
||||
|
||||
ASSERT_THAT(module, oldModule);
|
||||
}
|
||||
|
||||
TEST_F(Model, get_meta_info_by_module)
|
||||
{
|
||||
auto module = model.module("QML");
|
||||
auto module = model.module("QML", ModuleKind::QmlLibrary);
|
||||
|
||||
auto metaInfo = model.metaInfo(module, "QtObject");
|
||||
|
||||
@@ -938,7 +939,7 @@ TEST_F(Model, get_meta_info_by_module)
|
||||
|
||||
TEST_F(Model, get_invalid_meta_info_by_module_for_wrong_name)
|
||||
{
|
||||
auto module = model.module("QML");
|
||||
auto module = model.module("QML", ModuleKind::QmlLibrary);
|
||||
|
||||
auto metaInfo = model.metaInfo(module, "Object");
|
||||
|
||||
@@ -947,7 +948,7 @@ TEST_F(Model, get_invalid_meta_info_by_module_for_wrong_name)
|
||||
|
||||
TEST_F(Model, get_invalid_meta_info_by_module_for_wrong_module)
|
||||
{
|
||||
auto module = model.module("Qml");
|
||||
auto module = model.module("Qml", ModuleKind::QmlLibrary);
|
||||
|
||||
auto metaInfo = model.metaInfo(module, "Object");
|
||||
|
||||
@@ -986,8 +987,8 @@ TEST_F(Model, refresh_callback_is_calling_abstract_view)
|
||||
|
||||
TEST_F(Model, meta_infos_for_mdoule)
|
||||
{
|
||||
projectStorageMock.createModule("Foo");
|
||||
auto module = model.module("Foo");
|
||||
projectStorageMock.createModule("Foo", ModuleKind::QmlLibrary);
|
||||
auto module = model.module("Foo", ModuleKind::QmlLibrary);
|
||||
auto typeId = projectStorageMock.createObject(module.id(), "Bar");
|
||||
ON_CALL(projectStorageMock, typeIds(module.id()))
|
||||
.WillByDefault(Return(QVarLengthArray<QmlDesigner::TypeId, 256>{typeId}));
|
||||
|
@@ -13,6 +13,7 @@
|
||||
namespace {
|
||||
using QmlDesigner::ModelNode;
|
||||
using QmlDesigner::ModelNodes;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
|
||||
class ModelUtils : public ::testing::Test
|
||||
{
|
||||
@@ -20,7 +21,7 @@ protected:
|
||||
NiceMock<SourcePathCacheMockWithPaths> pathCacheMock{"/path/model.qml"};
|
||||
QmlDesigner::SourceId sourceId = pathCacheMock.createSourceId("/path/foo.qml");
|
||||
NiceMock<ProjectStorageMockWithQtQtuick> projectStorageMock{pathCacheMock.sourceId};
|
||||
QmlDesigner::ModuleId moduleId = projectStorageMock.moduleId("QtQuick");
|
||||
QmlDesigner::ModuleId moduleId = projectStorageMock.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
QmlDesigner::Model model{{projectStorageMock, pathCacheMock},
|
||||
"Item",
|
||||
{QmlDesigner::Import::createLibraryImport("QML"),
|
||||
|
@@ -44,11 +44,6 @@ protected:
|
||||
|
||||
~NodeListProperty() { model->detachView(&abstractViewMock); }
|
||||
|
||||
void setModuleId(Utils::SmallStringView moduleName, ModuleId moduleId)
|
||||
{
|
||||
ON_CALL(projectStorageMock, moduleId(Eq(moduleName))).WillByDefault(Return(moduleId));
|
||||
}
|
||||
|
||||
void setType(ModuleId moduleId,
|
||||
Utils::SmallStringView typeName,
|
||||
Utils::SmallString defaultPeopertyName)
|
||||
|
@@ -28,6 +28,7 @@ using QmlDesigner::PropertyDeclarationId;
|
||||
using QmlDesigner::SourceContextId;
|
||||
using QmlDesigner::SourceId;
|
||||
using QmlDesigner::SourceIds;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
using QmlDesigner::Storage::Synchronization::SynchronizationPackage;
|
||||
using QmlDesigner::Storage::Synchronization::TypeAnnotations;
|
||||
using QmlDesigner::Storage::TypeTraits;
|
||||
@@ -48,6 +49,12 @@ Storage::Imports operator+(const Storage::Imports &first,
|
||||
return imports;
|
||||
}
|
||||
|
||||
auto IsModule(Utils::SmallStringView name, ModuleKind kind)
|
||||
{
|
||||
return AllOf(Field(&QmlDesigner::Storage::Module::name, name),
|
||||
Field(&QmlDesigner::Storage::Module::kind, kind));
|
||||
}
|
||||
|
||||
MATCHER_P2(IsSourceContext,
|
||||
id,
|
||||
value,
|
||||
@@ -1158,15 +1165,15 @@ protected:
|
||||
SourceId sourceIdPath6{sourcePathCache.sourceId(pathPath6)};
|
||||
SourceId qmlProjectSourceId{sourcePathCache.sourceId("/path1/qmldir")};
|
||||
SourceId qtQuickProjectSourceId{sourcePathCache.sourceId("/path2/qmldir")};
|
||||
ModuleId qmlModuleId{storage.moduleId("Qml")};
|
||||
ModuleId qmlNativeModuleId{storage.moduleId("Qml-cppnative")};
|
||||
ModuleId qtQuickModuleId{storage.moduleId("QtQuick")};
|
||||
ModuleId qtQuickNativeModuleId{storage.moduleId("QtQuick-cppnative")};
|
||||
ModuleId pathToModuleId{storage.moduleId("/path/to")};
|
||||
ModuleId qtQuick3DModuleId{storage.moduleId("QtQuick3D")};
|
||||
ModuleId myModuleModuleId{storage.moduleId("MyModule")};
|
||||
ModuleId QMLModuleId{storage.moduleId("QML")};
|
||||
ModuleId QMLNativeModuleId{storage.moduleId("QML-cppnative")};
|
||||
ModuleId qmlModuleId{storage.moduleId("Qml", ModuleKind::QmlLibrary)};
|
||||
ModuleId qmlNativeModuleId{storage.moduleId("Qml", ModuleKind::CppLibrary)};
|
||||
ModuleId qtQuickModuleId{storage.moduleId("QtQuick", ModuleKind::QmlLibrary)};
|
||||
ModuleId qtQuickNativeModuleId{storage.moduleId("QtQuick", ModuleKind::CppLibrary)};
|
||||
ModuleId pathToModuleId{storage.moduleId("/path/to", ModuleKind::PathLibrary)};
|
||||
ModuleId qtQuick3DModuleId{storage.moduleId("QtQuick3D", ModuleKind::QmlLibrary)};
|
||||
ModuleId myModuleModuleId{storage.moduleId("MyModule", ModuleKind::QmlLibrary)};
|
||||
ModuleId QMLModuleId{storage.moduleId("QML", ModuleKind::QmlLibrary)};
|
||||
ModuleId QMLNativeModuleId{storage.moduleId("QML", ModuleKind::CppLibrary)};
|
||||
Storage::Imports importsSourceId1;
|
||||
Storage::Imports importsSourceId2;
|
||||
Storage::Imports importsSourceId3;
|
||||
@@ -2915,7 +2922,7 @@ TEST_F(ProjectStorage, fetch_invalid_type_id_by_impor_ids_and_exported_name_if_n
|
||||
{
|
||||
auto package{createSimpleSynchronizationPackage()};
|
||||
storage.synchronize(package);
|
||||
auto qtQuickModuleId = storage.moduleId("QtQuick");
|
||||
auto qtQuickModuleId = storage.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
|
||||
auto typeId = storage.fetchTypeIdByModuleIdsAndExportedName({qtQuickModuleId}, "Object");
|
||||
|
||||
@@ -5065,46 +5072,55 @@ TEST_F(ProjectStorage, minimal_updates)
|
||||
|
||||
TEST_F(ProjectStorage, get_module_id)
|
||||
{
|
||||
auto id = storage.moduleId("Qml");
|
||||
auto id = storage.moduleId("Qml", ModuleKind::QmlLibrary);
|
||||
|
||||
ASSERT_TRUE(id);
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, get_same_module_id_again)
|
||||
{
|
||||
auto initialId = storage.moduleId("Qml");
|
||||
auto initialId = storage.moduleId("Qml", ModuleKind::QmlLibrary);
|
||||
|
||||
auto id = storage.moduleId("Qml");
|
||||
auto id = storage.moduleId("Qml", ModuleKind::QmlLibrary);
|
||||
|
||||
ASSERT_THAT(id, Eq(initialId));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, module_name_throws_if_id_is_invalid)
|
||||
TEST_F(ProjectStorage, different_module_kind_returns_different_id)
|
||||
{
|
||||
ASSERT_THROW(storage.moduleName(ModuleId{}), QmlDesigner::ModuleDoesNotExists);
|
||||
auto qmlId = storage.moduleId("Qml", ModuleKind::QmlLibrary);
|
||||
|
||||
auto cppId = storage.moduleId("Qml", ModuleKind::CppLibrary);
|
||||
|
||||
ASSERT_THAT(cppId, Ne(qmlId));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, module_name_throws_if_id_does_not_exists)
|
||||
TEST_F(ProjectStorage, module_throws_if_id_is_invalid)
|
||||
{
|
||||
ASSERT_THROW(storage.moduleName(ModuleId::create(222)), QmlDesigner::ModuleDoesNotExists);
|
||||
ASSERT_THROW(storage.module(ModuleId{}), QmlDesigner::ModuleDoesNotExists);
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, get_module_name)
|
||||
TEST_F(ProjectStorage, module_throws_if_id_does_not_exists)
|
||||
{
|
||||
auto id = storage.moduleId("Qml");
|
||||
ASSERT_THROW(storage.module(ModuleId::create(222)), QmlDesigner::ModuleDoesNotExists);
|
||||
}
|
||||
|
||||
auto name = storage.moduleName(id);
|
||||
TEST_F(ProjectStorage, get_module)
|
||||
{
|
||||
auto id = storage.moduleId("Qml", ModuleKind::QmlLibrary);
|
||||
|
||||
ASSERT_THAT(name, Eq("Qml"));
|
||||
auto module = storage.module(id);
|
||||
|
||||
ASSERT_THAT(module, IsModule("Qml", ModuleKind::QmlLibrary));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, populate_module_cache)
|
||||
{
|
||||
auto id = storage.moduleId("Qml");
|
||||
auto id = storage.moduleId("Qml", ModuleKind::QmlLibrary);
|
||||
|
||||
QmlDesigner::ProjectStorage newStorage{database, database.isInitialized()};
|
||||
|
||||
ASSERT_THAT(newStorage.moduleName(id), Eq("Qml"));
|
||||
ASSERT_THAT(newStorage.module(id), IsModule("Qml", ModuleKind::QmlLibrary));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, add_project_dataes)
|
||||
@@ -5468,7 +5484,7 @@ TEST_F(ProjectStorage, module_exported_import_with_indirect_different_versions)
|
||||
TEST_F(ProjectStorage,
|
||||
module_exported_import_prevent_collision_if_module_is_indirectly_reexported_multiple_times)
|
||||
{
|
||||
ModuleId qtQuick4DModuleId{storage.moduleId("QtQuick4D")};
|
||||
ModuleId qtQuick4DModuleId{storage.moduleId("QtQuick4D", ModuleKind::QmlLibrary)};
|
||||
auto package{createModuleExportedImportSynchronizationPackage()};
|
||||
package.imports.emplace_back(qtQuickModuleId, Storage::Version{1}, sourceId5);
|
||||
package.moduleExportedImports.emplace_back(qtQuick4DModuleId,
|
||||
@@ -5524,8 +5540,8 @@ TEST_F(ProjectStorage,
|
||||
|
||||
TEST_F(ProjectStorage, distinguish_between_import_kinds)
|
||||
{
|
||||
ModuleId qml1ModuleId{storage.moduleId("Qml1")};
|
||||
ModuleId qml11ModuleId{storage.moduleId("Qml11")};
|
||||
ModuleId qml1ModuleId{storage.moduleId("Qml1", ModuleKind::QmlLibrary)};
|
||||
ModuleId qml11ModuleId{storage.moduleId("Qml11", ModuleKind::QmlLibrary)};
|
||||
auto package{createSimpleSynchronizationPackage()};
|
||||
package.moduleDependencies.emplace_back(qmlModuleId, Storage::Version{}, sourceId1);
|
||||
package.moduleDependencies.emplace_back(qml1ModuleId, Storage::Version{1}, sourceId1);
|
||||
|
@@ -27,6 +27,7 @@ using QmlDesigner::SourceId;
|
||||
namespace Storage = QmlDesigner::Storage;
|
||||
using QmlDesigner::IdPaths;
|
||||
using QmlDesigner::Storage::Import;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
using QmlDesigner::Storage::Synchronization::FileType;
|
||||
using QmlDesigner::Storage::Synchronization::IsAutoVersion;
|
||||
using QmlDesigner::Storage::Synchronization::ModuleExportedImport;
|
||||
@@ -180,8 +181,8 @@ public:
|
||||
|
||||
setQmlFileNames(u"/path", {"First.qml", "First2.qml", "Second.qml"});
|
||||
|
||||
ON_CALL(projectStorageMock, moduleId(_)).WillByDefault([&](const auto &name) {
|
||||
return storage.moduleId(name);
|
||||
ON_CALL(projectStorageMock, moduleId(_, _)).WillByDefault([&](const auto &name, const auto &kind) {
|
||||
return storage.moduleId(name, kind);
|
||||
});
|
||||
|
||||
firstType.prototype = Storage::Synchronization::ImportedType{"Object"};
|
||||
@@ -302,7 +303,10 @@ public:
|
||||
EXPECT_CALL(fileSystemMock, contentAsQString(Eq(path))).WillRepeatedly(Return(content));
|
||||
}
|
||||
|
||||
auto moduleId(Utils::SmallStringView name) const { return storage.moduleId(name); }
|
||||
auto moduleId(Utils::SmallStringView name, ModuleKind kind) const
|
||||
{
|
||||
return storage.moduleId(name, kind);
|
||||
}
|
||||
|
||||
protected:
|
||||
NiceMock<FileSystemMock> fileSystemMock;
|
||||
@@ -341,16 +345,16 @@ protected:
|
||||
QmlDesigner::SourcePath{itemLibraryPath + "/."});
|
||||
SourceId qmlImportsPathSourceId = sourcePathCache.sourceId(
|
||||
QmlDesigner::SourcePath{qmlImportsPath + "/."});
|
||||
ModuleId qmlModuleId{storage.moduleId("Qml")};
|
||||
ModuleId qmlCppNativeModuleId{storage.moduleId("Qml-cppnative")};
|
||||
ModuleId exampleModuleId{storage.moduleId("Example")};
|
||||
ModuleId exampleCppNativeModuleId{storage.moduleId("Example-cppnative")};
|
||||
ModuleId builtinModuleId{storage.moduleId("QML")};
|
||||
ModuleId builtinCppNativeModuleId{storage.moduleId("QML-cppnative")};
|
||||
ModuleId quickModuleId{storage.moduleId("Quick")};
|
||||
ModuleId quickCppNativeModuleId{storage.moduleId("Quick-cppnative")};
|
||||
ModuleId pathModuleId{storage.moduleId("/path")};
|
||||
ModuleId subPathQmlModuleId{storage.moduleId("/path/qml")};
|
||||
ModuleId qmlModuleId{storage.moduleId("Qml", ModuleKind::QmlLibrary)};
|
||||
ModuleId qmlCppNativeModuleId{storage.moduleId("Qml", ModuleKind::CppLibrary)};
|
||||
ModuleId exampleModuleId{storage.moduleId("Example", ModuleKind::QmlLibrary)};
|
||||
ModuleId exampleCppNativeModuleId{storage.moduleId("Example", ModuleKind::CppLibrary)};
|
||||
ModuleId builtinModuleId{storage.moduleId("QML", ModuleKind::QmlLibrary)};
|
||||
ModuleId builtinCppNativeModuleId{storage.moduleId("QML", ModuleKind::CppLibrary)};
|
||||
ModuleId quickModuleId{storage.moduleId("Quick", ModuleKind::QmlLibrary)};
|
||||
ModuleId quickCppNativeModuleId{storage.moduleId("Quick", ModuleKind::CppLibrary)};
|
||||
ModuleId pathModuleId{storage.moduleId("/path", ModuleKind::PathLibrary)};
|
||||
ModuleId subPathQmlModuleId{storage.moduleId("/path/qml", ModuleKind::PathLibrary)};
|
||||
Storage::Synchronization::Type objectType{
|
||||
"QObject",
|
||||
Storage::Synchronization::ImportedType{},
|
||||
@@ -500,9 +504,9 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_types)
|
||||
imports.push_back(import);
|
||||
});
|
||||
|
||||
EXPECT_CALL(projectStorageMock, moduleId(Eq("Example")));
|
||||
EXPECT_CALL(projectStorageMock, moduleId(Eq("Example-cppnative")));
|
||||
EXPECT_CALL(projectStorageMock, moduleId(Eq("/path")));
|
||||
EXPECT_CALL(projectStorageMock, moduleId(Eq("Example"), ModuleKind::QmlLibrary));
|
||||
EXPECT_CALL(projectStorageMock, moduleId(Eq("Example"), ModuleKind::CppLibrary));
|
||||
EXPECT_CALL(projectStorageMock, moduleId(Eq("/path"), ModuleKind::PathLibrary));
|
||||
EXPECT_CALL(projectStorageMock,
|
||||
synchronize(
|
||||
AllOf(Field(&SynchronizationPackage::imports, ElementsAre(import)),
|
||||
@@ -3509,7 +3513,7 @@ TEST_F(ProjectStorageUpdater, update_property_editor_panes)
|
||||
auto directoryId = sourcePathCache.sourceId(
|
||||
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QML/."});
|
||||
setFilesChanged({directoryId});
|
||||
auto qmlModuleId = storage.moduleId("QML");
|
||||
auto qmlModuleId = storage.moduleId("QML", ModuleKind::QmlLibrary);
|
||||
|
||||
EXPECT_CALL(projectStorageMock,
|
||||
synchronize(
|
||||
@@ -3542,8 +3546,8 @@ TEST_F(ProjectStorageUpdater, update_property_editor_specifics)
|
||||
auto controlsDirectoryId = sourcePathCache.sourceId(
|
||||
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QtQuick/Controls/."});
|
||||
setFilesChanged({qtQuickDirectoryId, controlsDirectoryId});
|
||||
auto qtQuickModuleId = storage.moduleId("QtQuick");
|
||||
auto controlsModuleId = storage.moduleId("QtQuick.Controls");
|
||||
auto qtQuickModuleId = storage.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
auto controlsModuleId = storage.moduleId("QtQuick.Controls", ModuleKind::QmlLibrary);
|
||||
|
||||
EXPECT_CALL(projectStorageMock,
|
||||
synchronize(AllOf(
|
||||
@@ -3579,8 +3583,8 @@ TEST_F(ProjectStorageUpdater, update_type_annotations)
|
||||
auto buttonSourceId = sourcePathCache.sourceId(
|
||||
QmlDesigner::SourcePath{itemLibraryPath + "/qtquickcontrols2.metainfo"});
|
||||
setFilesChanged({itemLibraryPathSourceId, itemSourceId, buttonSourceId});
|
||||
auto qtQuickModuleId = moduleId("QtQuick");
|
||||
auto qtQuickControlsModuleId = moduleId("QtQuick.Controls.Basic");
|
||||
auto qtQuickModuleId = moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
auto qtQuickControlsModuleId = moduleId("QtQuick.Controls.Basic", ModuleKind::QmlLibrary);
|
||||
QmlDesigner::Storage::TypeTraits itemTraits;
|
||||
itemTraits.canBeContainer = QmlDesigner::FlagIs::True;
|
||||
|
||||
@@ -3616,8 +3620,8 @@ TEST_F(ProjectStorageUpdater, update_changed_type_annotation)
|
||||
QmlDesigner::SourcePath{itemLibraryPath + "/qtquickcontrols2.metainfo"});
|
||||
setFilesDontChanged({itemLibraryPathSourceId});
|
||||
setFilesChanged({itemSourceId, buttonSourceId});
|
||||
auto qtQuickModuleId = moduleId("QtQuick");
|
||||
auto qtQuickControlsModuleId = moduleId("QtQuick.Controls.Basic");
|
||||
auto qtQuickModuleId = moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
auto qtQuickControlsModuleId = moduleId("QtQuick.Controls.Basic", ModuleKind::QmlLibrary);
|
||||
QmlDesigner::Storage::TypeTraits itemTraits;
|
||||
itemTraits.canBeContainer = QmlDesigner::FlagIs::True;
|
||||
|
||||
|
@@ -16,6 +16,7 @@ namespace Synchronization = Storage::Synchronization;
|
||||
using QmlDesigner::ModuleId;
|
||||
using QmlDesigner::SourceContextId;
|
||||
using QmlDesigner::SourceId;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
|
||||
MATCHER_P(HasPrototype, prototype, std::string(negation ? "isn't " : "is ") + PrintToString(prototype))
|
||||
{
|
||||
@@ -151,7 +152,7 @@ protected:
|
||||
SourceId qmlFileSourceId{sourcePathCache.sourceId("/path/to/qmlfile.qml")};
|
||||
SourceContextId qmlFileSourceContextId{sourcePathCache.sourceContextId(qmlFileSourceId)};
|
||||
Utils::PathString directoryPath{sourcePathCache.sourceContextPath(qmlFileSourceContextId)};
|
||||
ModuleId directoryModuleId{storage.moduleId(directoryPath)};
|
||||
ModuleId directoryModuleId{storage.moduleId(directoryPath, ModuleKind::PathLibrary)};
|
||||
};
|
||||
|
||||
TEST_F(QmlDocumentParser, prototype)
|
||||
@@ -163,7 +164,7 @@ TEST_F(QmlDocumentParser, prototype)
|
||||
|
||||
TEST_F(QmlDocumentParser, qualified_prototype)
|
||||
{
|
||||
auto exampleModuleId = storage.moduleId("Example");
|
||||
auto exampleModuleId = storage.moduleId("Example", ModuleKind::QmlLibrary);
|
||||
QString text = R"(import Example 2.1 as Example
|
||||
Example.Item{})";
|
||||
|
||||
@@ -187,7 +188,7 @@ TEST_F(QmlDocumentParser, properties)
|
||||
|
||||
TEST_F(QmlDocumentParser, qualified_properties)
|
||||
{
|
||||
auto exampleModuleId = storage.moduleId("Example");
|
||||
auto exampleModuleId = storage.moduleId("Example", ModuleKind::QmlLibrary);
|
||||
|
||||
auto type = parser.parse(R"(import Example 2.1 as Example
|
||||
Item{ property Example.Foo foo})",
|
||||
@@ -222,7 +223,7 @@ TEST_F(QmlDocumentParser, enumeration_in_properties)
|
||||
|
||||
TEST_F(QmlDocumentParser, qualified_enumeration_in_properties)
|
||||
{
|
||||
auto exampleModuleId = storage.moduleId("Example");
|
||||
auto exampleModuleId = storage.moduleId("Example", ModuleKind::QmlLibrary);
|
||||
|
||||
auto type = parser.parse(R"(import Example 2.1 as Example
|
||||
Item{ property Example.Enumeration.Foo foo})",
|
||||
@@ -242,9 +243,9 @@ TEST_F(QmlDocumentParser, qualified_enumeration_in_properties)
|
||||
|
||||
TEST_F(QmlDocumentParser, imports)
|
||||
{
|
||||
ModuleId fooDirectoryModuleId = storage.moduleId("/path/foo");
|
||||
ModuleId qmlModuleId = storage.moduleId("QML");
|
||||
ModuleId qtQuickModuleId = storage.moduleId("QtQuick");
|
||||
ModuleId fooDirectoryModuleId = storage.moduleId("/path/foo", ModuleKind::PathLibrary);
|
||||
ModuleId qmlModuleId = storage.moduleId("QML", ModuleKind::QmlLibrary);
|
||||
ModuleId qtQuickModuleId = storage.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
|
||||
auto type = parser.parse(R"(import QtQuick
|
||||
import "../foo"
|
||||
@@ -263,9 +264,9 @@ TEST_F(QmlDocumentParser, imports)
|
||||
|
||||
TEST_F(QmlDocumentParser, imports_with_version)
|
||||
{
|
||||
ModuleId fooDirectoryModuleId = storage.moduleId("/path/foo");
|
||||
ModuleId qmlModuleId = storage.moduleId("QML");
|
||||
ModuleId qtQuickModuleId = storage.moduleId("QtQuick");
|
||||
ModuleId fooDirectoryModuleId = storage.moduleId("/path/foo", ModuleKind::PathLibrary);
|
||||
ModuleId qmlModuleId = storage.moduleId("QML", ModuleKind::QmlLibrary);
|
||||
ModuleId qtQuickModuleId = storage.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
|
||||
auto type = parser.parse(R"(import QtQuick 2.1
|
||||
import "../foo"
|
||||
@@ -284,8 +285,8 @@ TEST_F(QmlDocumentParser, imports_with_version)
|
||||
|
||||
TEST_F(QmlDocumentParser, imports_with_explict_directory)
|
||||
{
|
||||
ModuleId qmlModuleId = storage.moduleId("QML");
|
||||
ModuleId qtQuickModuleId = storage.moduleId("QtQuick");
|
||||
ModuleId qmlModuleId = storage.moduleId("QML", ModuleKind::QmlLibrary);
|
||||
ModuleId qtQuickModuleId = storage.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
|
||||
auto type = parser.parse(R"(import QtQuick
|
||||
import "../to"
|
||||
@@ -358,10 +359,10 @@ TEST_F(QmlDocumentParser, enumeration)
|
||||
|
||||
TEST_F(QmlDocumentParser, DISABLED_duplicate_imports_are_removed)
|
||||
{
|
||||
ModuleId fooDirectoryModuleId = storage.moduleId("/path/foo");
|
||||
ModuleId qmlModuleId = storage.moduleId("QML");
|
||||
ModuleId qtQmlModuleId = storage.moduleId("QtQml");
|
||||
ModuleId qtQuickModuleId = storage.moduleId("QtQuick");
|
||||
ModuleId fooDirectoryModuleId = storage.moduleId("/path/foo", ModuleKind::PathLibrary);
|
||||
ModuleId qmlModuleId = storage.moduleId("QML", ModuleKind::QmlLibrary);
|
||||
ModuleId qtQmlModuleId = storage.moduleId("QtQml", ModuleKind::QmlLibrary);
|
||||
ModuleId qtQuickModuleId = storage.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||
|
||||
auto type = parser.parse(R"(import QtQuick
|
||||
import "../foo"
|
||||
@@ -497,7 +498,7 @@ TEST_F(QmlDocumentParser, alias_on_list_property)
|
||||
|
||||
TEST_F(QmlDocumentParser, qualified_list_property)
|
||||
{
|
||||
auto exampleModuleId = storage.moduleId("Example");
|
||||
auto exampleModuleId = storage.moduleId("Example", ModuleKind::QmlLibrary);
|
||||
auto type = parser.parse(R"(import Example 2.1 as Example
|
||||
Item{
|
||||
property list<Example.Foo> foos
|
||||
|
@@ -17,6 +17,7 @@ namespace Synchronization = QmlDesigner::Storage::Synchronization;
|
||||
using QmlDesigner::ModuleId;
|
||||
using QmlDesigner::SourceContextId;
|
||||
using QmlDesigner::SourceId;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
|
||||
MATCHER_P3(IsImport,
|
||||
moduleId,
|
||||
@@ -175,13 +176,12 @@ protected:
|
||||
Storage::Imports imports;
|
||||
Synchronization::Types types;
|
||||
SourceId qmltypesFileSourceId{sourcePathCache.sourceId("path/to/types.qmltypes")};
|
||||
ModuleId qtQmlNativeModuleId = storage.moduleId("QtQml-cppnative");
|
||||
ModuleId qtQmlNativeModuleId = storage.moduleId("QtQml", ModuleKind::CppLibrary);
|
||||
Synchronization::ProjectData projectData{qmltypesFileSourceId,
|
||||
qmltypesFileSourceId,
|
||||
qtQmlNativeModuleId,
|
||||
Synchronization::FileType::QmlTypes};
|
||||
SourceContextId qmltypesFileSourceContextId{sourcePathCache.sourceContextId(qmltypesFileSourceId)};
|
||||
ModuleId directoryModuleId{storage.moduleId("path/to/")};
|
||||
};
|
||||
|
||||
TEST_F(QmlTypesParser, imports)
|
||||
@@ -194,19 +194,19 @@ TEST_F(QmlTypesParser, imports)
|
||||
parser.parse(source, imports, types, projectData);
|
||||
|
||||
ASSERT_THAT(imports,
|
||||
UnorderedElementsAre(IsImport(storage.moduleId("QML-cppnative"),
|
||||
UnorderedElementsAre(IsImport(storage.moduleId("QML", ModuleKind::CppLibrary),
|
||||
QmlDesigner::Storage::Version{},
|
||||
qmltypesFileSourceId),
|
||||
IsImport(storage.moduleId("QtQml-cppnative"),
|
||||
IsImport(storage.moduleId("QtQml", ModuleKind::CppLibrary),
|
||||
QmlDesigner::Storage::Version{},
|
||||
qmltypesFileSourceId),
|
||||
IsImport(storage.moduleId("QtQuick-cppnative"),
|
||||
IsImport(storage.moduleId("QtQuick", ModuleKind::CppLibrary),
|
||||
QmlDesigner::Storage::Version{},
|
||||
qmltypesFileSourceId),
|
||||
IsImport(storage.moduleId("QtQuick.Window-cppnative"),
|
||||
IsImport(storage.moduleId("QtQuick.Window", ModuleKind::CppLibrary),
|
||||
QmlDesigner::Storage::Version{},
|
||||
qmltypesFileSourceId),
|
||||
IsImport(storage.moduleId("QtFoo-cppnative"),
|
||||
IsImport(storage.moduleId("QtFoo", ModuleKind::CppLibrary),
|
||||
QmlDesigner::Storage::Version{},
|
||||
qmltypesFileSourceId)));
|
||||
}
|
||||
@@ -286,8 +286,8 @@ TEST_F(QmlTypesParser, exported_types)
|
||||
Component { name: "QObject"
|
||||
exports: ["QML/QtObject 1.0", "QtQml/QtObject 2.1"]
|
||||
}})"};
|
||||
ModuleId qmlModuleId = storage.moduleId("QML");
|
||||
ModuleId qtQmlModuleId = storage.moduleId("QtQml");
|
||||
ModuleId qmlModuleId = storage.moduleId("QML", ModuleKind::QmlLibrary);
|
||||
ModuleId qtQmlModuleId = storage.moduleId("QtQml", ModuleKind::QmlLibrary);
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
|
||||
@@ -853,7 +853,7 @@ TEST_F(QmlTypesParser, default_property)
|
||||
|
||||
TEST_F(QmlTypesParser, skip_template_item)
|
||||
{
|
||||
ModuleId moduleId = storage.moduleId("QtQuick.Templates-cppnative");
|
||||
ModuleId moduleId = storage.moduleId("QtQuick.Templates", ModuleKind::CppLibrary);
|
||||
Synchronization::ProjectData projectData{qmltypesFileSourceId,
|
||||
qmltypesFileSourceId,
|
||||
moduleId,
|
||||
|
@@ -30,7 +30,10 @@ protected:
|
||||
static_database.reset();
|
||||
}
|
||||
|
||||
auto moduleId(Utils::SmallStringView name) const { return storage.moduleId(name); }
|
||||
auto moduleId(Utils::SmallStringView name) const
|
||||
{
|
||||
return storage.moduleId(name, QmlDesigner::Storage::ModuleKind::QmlLibrary);
|
||||
}
|
||||
|
||||
protected:
|
||||
inline static std::unique_ptr<Sqlite::Database> static_database;
|
||||
|
Reference in New Issue
Block a user