forked from qt-creator/qt-creator
QmlDesigner: Rename ProjectData into DirectoryInfo
The design is now directory based. So the name should reflect that. Task-number: QDS-12665 Change-Id: I7479c37357a4fd33f5f3b4c93d63d2fdd4ca6ef9 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -502,25 +502,25 @@ struct ProjectStorage::Statements
|
||||
"DELETE FROM exportedTypeNames WHERE exportedTypeNameId=?", database};
|
||||
Sqlite::WriteStatement<2> updateExportedTypeNameTypeIdStatement{
|
||||
"UPDATE exportedTypeNames SET typeId=?2 WHERE exportedTypeNameId=?1", database};
|
||||
mutable Sqlite::ReadStatement<4, 1> selectProjectDatasForSourceIdsStatement{
|
||||
"SELECT projectSourceId, sourceId, moduleId, fileType FROM projectDatas WHERE "
|
||||
"projectSourceId IN carray(?1) ORDER BY projectSourceId, sourceId",
|
||||
mutable Sqlite::ReadStatement<4, 1> selectDirectoryInfosForSourceIdsStatement{
|
||||
"SELECT directorySourceId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
|
||||
"directorySourceId IN carray(?1) ORDER BY directorySourceId, sourceId",
|
||||
database};
|
||||
Sqlite::WriteStatement<4> insertProjectDataStatement{
|
||||
"INSERT INTO projectDatas(projectSourceId, sourceId, "
|
||||
Sqlite::WriteStatement<4> insertDirectoryInfoStatement{
|
||||
"INSERT INTO directoryInfos(directorySourceId, sourceId, "
|
||||
"moduleId, fileType) VALUES(?1, ?2, ?3, ?4)",
|
||||
database};
|
||||
Sqlite::WriteStatement<2> deleteProjectDataStatement{
|
||||
"DELETE FROM projectDatas WHERE projectSourceId=?1 AND sourceId=?2", database};
|
||||
Sqlite::WriteStatement<4> updateProjectDataStatement{
|
||||
"UPDATE projectDatas SET moduleId=?3, fileType=?4 WHERE projectSourceId=?1 AND sourceId=?2",
|
||||
Sqlite::WriteStatement<2> deleteDirectoryInfoStatement{
|
||||
"DELETE FROM directoryInfos WHERE directorySourceId=?1 AND sourceId=?2", database};
|
||||
Sqlite::WriteStatement<4> updateDirectoryInfoStatement{
|
||||
"UPDATE directoryInfos SET moduleId=?3, fileType=?4 WHERE directorySourceId=?1 AND sourceId=?2",
|
||||
database};
|
||||
mutable Sqlite::ReadStatement<4, 1> selectProjectDatasForSourceIdStatement{
|
||||
"SELECT projectSourceId, sourceId, moduleId, fileType FROM projectDatas WHERE "
|
||||
"projectSourceId=?1",
|
||||
mutable Sqlite::ReadStatement<4, 1> selectDirectoryInfosForSourceIdStatement{
|
||||
"SELECT directorySourceId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
|
||||
"directorySourceId=?1",
|
||||
database};
|
||||
mutable Sqlite::ReadStatement<4, 1> selectProjectDataForSourceIdStatement{
|
||||
"SELECT projectSourceId, sourceId, moduleId, fileType FROM projectDatas WHERE "
|
||||
mutable Sqlite::ReadStatement<4, 1> selectDirectoryInfoForSourceIdStatement{
|
||||
"SELECT directorySourceId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
|
||||
"sourceId=?1 LIMIT 1",
|
||||
database};
|
||||
mutable Sqlite::ReadStatement<1, 1> selectTypeIdsForSourceIdsStatement{
|
||||
@@ -745,7 +745,7 @@ public:
|
||||
createModuleExportedImportsTable(database, moduleIdColumn);
|
||||
createDocumentImportsTable(database, moduleIdColumn);
|
||||
createFileStatusesTable(database);
|
||||
createProjectDatasTable(database);
|
||||
createDirectoryInfosTable(database);
|
||||
createPropertyEditorPathsTable(database);
|
||||
createTypeAnnotionsTable(database);
|
||||
}
|
||||
@@ -1063,19 +1063,19 @@ public:
|
||||
table.initialize(database);
|
||||
}
|
||||
|
||||
void createProjectDatasTable(Database &database)
|
||||
void createDirectoryInfosTable(Database &database)
|
||||
{
|
||||
Sqlite::StrictTable table;
|
||||
table.setUseIfNotExists(true);
|
||||
table.setUseWithoutRowId(true);
|
||||
table.setName("projectDatas");
|
||||
auto &projectSourceIdColumn = table.addColumn("projectSourceId",
|
||||
table.setName("directoryInfos");
|
||||
auto &directorySourceIdColumn = table.addColumn("directorySourceId",
|
||||
Sqlite::StrictColumnType::Integer);
|
||||
auto &sourceIdColumn = table.addColumn("sourceId", Sqlite::StrictColumnType::Integer);
|
||||
table.addColumn("moduleId", Sqlite::StrictColumnType::Integer);
|
||||
table.addColumn("fileType", Sqlite::StrictColumnType::Integer);
|
||||
|
||||
table.addPrimaryKeyContraint({projectSourceIdColumn, sourceIdColumn});
|
||||
table.addPrimaryKeyContraint({directorySourceIdColumn, sourceIdColumn});
|
||||
table.addUniqueIndex({sourceIdColumn});
|
||||
|
||||
table.initialize(database);
|
||||
@@ -1196,7 +1196,7 @@ void ProjectStorage::synchronize(Storage::Synchronization::SynchronizationPackag
|
||||
|
||||
linkAliases(insertedAliasPropertyDeclarations, updatedAliasPropertyDeclarations);
|
||||
|
||||
synchronizeProjectDatas(package.projectDatas, package.updatedProjectSourceIds);
|
||||
synchronizeDirectoryInfos(package.directoryInfos, package.updatedProjectSourceIds);
|
||||
|
||||
commonTypeCache_.resetTypeIds();
|
||||
});
|
||||
@@ -2113,53 +2113,53 @@ FileStatus ProjectStorage::fetchFileStatus(SourceId sourceId) const
|
||||
return fileStatus;
|
||||
}
|
||||
|
||||
std::optional<Storage::Synchronization::ProjectData> ProjectStorage::fetchProjectData(SourceId sourceId) const
|
||||
std::optional<Storage::Synchronization::DirectoryInfo> ProjectStorage::fetchDirectoryInfo(SourceId sourceId) const
|
||||
{
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"fetch project data"_t,
|
||||
projectStorageCategory(),
|
||||
keyValue("source id", sourceId)};
|
||||
|
||||
auto projectData = s->selectProjectDataForSourceIdStatement
|
||||
.optionalValueWithTransaction<Storage::Synchronization::ProjectData>(
|
||||
auto directoryInfo = s->selectDirectoryInfoForSourceIdStatement
|
||||
.optionalValueWithTransaction<Storage::Synchronization::DirectoryInfo>(
|
||||
sourceId);
|
||||
|
||||
tracer.end(keyValue("project data", projectData));
|
||||
tracer.end(keyValue("project data", directoryInfo));
|
||||
|
||||
return projectData;
|
||||
return directoryInfo;
|
||||
}
|
||||
|
||||
Storage::Synchronization::ProjectDatas ProjectStorage::fetchProjectDatas(SourceId projectSourceId) const
|
||||
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(SourceId directorySourceId) const
|
||||
{
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"fetch project datas by source id"_t,
|
||||
projectStorageCategory(),
|
||||
keyValue("source id", projectSourceId)};
|
||||
keyValue("source id", directorySourceId)};
|
||||
|
||||
auto projectDatas = s->selectProjectDatasForSourceIdStatement
|
||||
.valuesWithTransaction<Storage::Synchronization::ProjectData, 1024>(
|
||||
projectSourceId);
|
||||
auto directoryInfos = s->selectDirectoryInfosForSourceIdStatement
|
||||
.valuesWithTransaction<Storage::Synchronization::DirectoryInfo, 1024>(
|
||||
directorySourceId);
|
||||
|
||||
tracer.end(keyValue("project datas", projectDatas));
|
||||
tracer.end(keyValue("project datas", directoryInfos));
|
||||
|
||||
return projectDatas;
|
||||
return directoryInfos;
|
||||
}
|
||||
|
||||
Storage::Synchronization::ProjectDatas ProjectStorage::fetchProjectDatas(
|
||||
const SourceIds &projectSourceIds) const
|
||||
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
||||
const SourceIds &directorySourceIds) const
|
||||
{
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"fetch project datas by source ids"_t,
|
||||
projectStorageCategory(),
|
||||
keyValue("source ids", projectSourceIds)};
|
||||
keyValue("source ids", directorySourceIds)};
|
||||
|
||||
auto projectDatas = s->selectProjectDatasForSourceIdsStatement
|
||||
.valuesWithTransaction<Storage::Synchronization::ProjectData, 64>(
|
||||
toIntegers(projectSourceIds));
|
||||
auto directoryInfos = s->selectDirectoryInfosForSourceIdsStatement
|
||||
.valuesWithTransaction<Storage::Synchronization::DirectoryInfo, 64>(
|
||||
toIntegers(directorySourceIds));
|
||||
|
||||
tracer.end(keyValue("project datas", projectDatas));
|
||||
tracer.end(keyValue("project datas", directoryInfos));
|
||||
|
||||
return projectDatas;
|
||||
return directoryInfos;
|
||||
}
|
||||
|
||||
void ProjectStorage::setPropertyEditorPathId(TypeId typeId, SourceId pathId)
|
||||
@@ -2465,74 +2465,74 @@ void ProjectStorage::synchronizeTypes(Storage::Synchronization::Types &types,
|
||||
syncDefaultProperties(types);
|
||||
}
|
||||
|
||||
void ProjectStorage::synchronizeProjectDatas(Storage::Synchronization::ProjectDatas &projectDatas,
|
||||
void ProjectStorage::synchronizeDirectoryInfos(Storage::Synchronization::DirectoryInfos &directoryInfos,
|
||||
const SourceIds &updatedProjectSourceIds)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"synchronize project datas"_t, projectStorageCategory()};
|
||||
|
||||
auto compareKey = [](auto &&first, auto &&second) {
|
||||
auto projectSourceIdDifference = first.projectSourceId - second.projectSourceId;
|
||||
if (projectSourceIdDifference != 0)
|
||||
return projectSourceIdDifference;
|
||||
auto directorySourceIdDifference = first.directorySourceId - second.directorySourceId;
|
||||
if (directorySourceIdDifference != 0)
|
||||
return directorySourceIdDifference;
|
||||
|
||||
return first.sourceId - second.sourceId;
|
||||
};
|
||||
|
||||
std::sort(projectDatas.begin(), projectDatas.end(), [&](auto &&first, auto &&second) {
|
||||
return std::tie(first.projectSourceId, first.sourceId)
|
||||
< std::tie(second.projectSourceId, second.sourceId);
|
||||
std::sort(directoryInfos.begin(), directoryInfos.end(), [&](auto &&first, auto &&second) {
|
||||
return std::tie(first.directorySourceId, first.sourceId)
|
||||
< std::tie(second.directorySourceId, second.sourceId);
|
||||
});
|
||||
|
||||
auto range = s->selectProjectDatasForSourceIdsStatement.range<Storage::Synchronization::ProjectData>(
|
||||
auto range = s->selectDirectoryInfosForSourceIdsStatement.range<Storage::Synchronization::DirectoryInfo>(
|
||||
toIntegers(updatedProjectSourceIds));
|
||||
|
||||
auto insert = [&](const Storage::Synchronization::ProjectData &projectData) {
|
||||
auto insert = [&](const Storage::Synchronization::DirectoryInfo &directoryInfo) {
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"insert project data"_t,
|
||||
projectStorageCategory(),
|
||||
keyValue("project data", projectData)};
|
||||
keyValue("project data", directoryInfo)};
|
||||
|
||||
if (!projectData.projectSourceId)
|
||||
throw ProjectDataHasInvalidProjectSourceId{};
|
||||
if (!projectData.sourceId)
|
||||
throw ProjectDataHasInvalidSourceId{};
|
||||
if (!directoryInfo.directorySourceId)
|
||||
throw DirectoryInfoHasInvalidProjectSourceId{};
|
||||
if (!directoryInfo.sourceId)
|
||||
throw DirectoryInfoHasInvalidSourceId{};
|
||||
|
||||
s->insertProjectDataStatement.write(projectData.projectSourceId,
|
||||
projectData.sourceId,
|
||||
projectData.moduleId,
|
||||
projectData.fileType);
|
||||
s->insertDirectoryInfoStatement.write(directoryInfo.directorySourceId,
|
||||
directoryInfo.sourceId,
|
||||
directoryInfo.moduleId,
|
||||
directoryInfo.fileType);
|
||||
};
|
||||
|
||||
auto update = [&](const Storage::Synchronization::ProjectData &projectDataFromDatabase,
|
||||
const Storage::Synchronization::ProjectData &projectData) {
|
||||
if (projectDataFromDatabase.fileType != projectData.fileType
|
||||
|| !compareInvalidAreTrue(projectDataFromDatabase.moduleId, projectData.moduleId)) {
|
||||
auto update = [&](const Storage::Synchronization::DirectoryInfo &directoryInfoFromDatabase,
|
||||
const Storage::Synchronization::DirectoryInfo &directoryInfo) {
|
||||
if (directoryInfoFromDatabase.fileType != directoryInfo.fileType
|
||||
|| !compareInvalidAreTrue(directoryInfoFromDatabase.moduleId, directoryInfo.moduleId)) {
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"update project data"_t,
|
||||
projectStorageCategory(),
|
||||
keyValue("project data", projectData),
|
||||
keyValue("project data from database", projectDataFromDatabase)};
|
||||
keyValue("project data", directoryInfo),
|
||||
keyValue("project data from database", directoryInfoFromDatabase)};
|
||||
|
||||
s->updateProjectDataStatement.write(projectData.projectSourceId,
|
||||
projectData.sourceId,
|
||||
projectData.moduleId,
|
||||
projectData.fileType);
|
||||
s->updateDirectoryInfoStatement.write(directoryInfo.directorySourceId,
|
||||
directoryInfo.sourceId,
|
||||
directoryInfo.moduleId,
|
||||
directoryInfo.fileType);
|
||||
return Sqlite::UpdateChange::Update;
|
||||
}
|
||||
|
||||
return Sqlite::UpdateChange::No;
|
||||
};
|
||||
|
||||
auto remove = [&](const Storage::Synchronization::ProjectData &projectData) {
|
||||
auto remove = [&](const Storage::Synchronization::DirectoryInfo &directoryInfo) {
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"remove project data"_t,
|
||||
projectStorageCategory(),
|
||||
keyValue("project data", projectData)};
|
||||
keyValue("project data", directoryInfo)};
|
||||
|
||||
s->deleteProjectDataStatement.write(projectData.projectSourceId, projectData.sourceId);
|
||||
s->deleteDirectoryInfoStatement.write(directoryInfo.directorySourceId, directoryInfo.sourceId);
|
||||
};
|
||||
|
||||
Sqlite::insertUpdateDelete(range, projectDatas, compareKey, insert, update, remove);
|
||||
Sqlite::insertUpdateDelete(range, directoryInfos, compareKey, insert, update, remove);
|
||||
}
|
||||
|
||||
void ProjectStorage::synchronizeFileStatuses(FileStatuses &fileStatuses,
|
||||
|
@@ -229,11 +229,11 @@ public:
|
||||
|
||||
FileStatus fetchFileStatus(SourceId sourceId) const override;
|
||||
|
||||
std::optional<Storage::Synchronization::ProjectData> fetchProjectData(SourceId sourceId) const override;
|
||||
std::optional<Storage::Synchronization::DirectoryInfo> fetchDirectoryInfo(SourceId sourceId) const override;
|
||||
|
||||
Storage::Synchronization::ProjectDatas fetchProjectDatas(SourceId projectSourceId) const override;
|
||||
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(SourceId directorySourceId) const override;
|
||||
|
||||
Storage::Synchronization::ProjectDatas fetchProjectDatas(const SourceIds &projectSourceIds) const;
|
||||
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(const SourceIds &directorySourceIds) const;
|
||||
|
||||
void setPropertyEditorPathId(TypeId typeId, SourceId pathId);
|
||||
|
||||
@@ -560,7 +560,7 @@ private:
|
||||
Prototypes &relinkableExtensions,
|
||||
const SourceIds &updatedSourceIds);
|
||||
|
||||
void synchronizeProjectDatas(Storage::Synchronization::ProjectDatas &projectDatas,
|
||||
void synchronizeDirectoryInfos(Storage::Synchronization::DirectoryInfos &directoryInfos,
|
||||
const SourceIds &updatedProjectSourceIds);
|
||||
|
||||
void synchronizeFileStatuses(FileStatuses &fileStatuses, const SourceIds &updatedSourceIds);
|
||||
|
@@ -148,32 +148,32 @@ const char *CannotParseQmlDocumentFile::what() const noexcept
|
||||
return "Cannot parse qml types file!";
|
||||
}
|
||||
|
||||
ProjectDataHasInvalidProjectSourceId::ProjectDataHasInvalidProjectSourceId()
|
||||
DirectoryInfoHasInvalidProjectSourceId::DirectoryInfoHasInvalidProjectSourceId()
|
||||
{
|
||||
category().threadEvent("ProjectDataHasInvalidProjectSourceId"_t);
|
||||
category().threadEvent("DirectoryInfoHasInvalidProjectSourceId"_t);
|
||||
}
|
||||
|
||||
const char *ProjectDataHasInvalidProjectSourceId::what() const noexcept
|
||||
const char *DirectoryInfoHasInvalidProjectSourceId::what() const noexcept
|
||||
{
|
||||
return "The project source id is invalid!";
|
||||
}
|
||||
|
||||
ProjectDataHasInvalidSourceId::ProjectDataHasInvalidSourceId()
|
||||
DirectoryInfoHasInvalidSourceId::DirectoryInfoHasInvalidSourceId()
|
||||
{
|
||||
category().threadEvent("ProjectDataHasInvalidSourceId"_t);
|
||||
category().threadEvent("DirectoryInfoHasInvalidSourceId"_t);
|
||||
}
|
||||
|
||||
const char *ProjectDataHasInvalidSourceId::what() const noexcept
|
||||
const char *DirectoryInfoHasInvalidSourceId::what() const noexcept
|
||||
{
|
||||
return "The source id is invalid!";
|
||||
}
|
||||
|
||||
ProjectDataHasInvalidModuleId::ProjectDataHasInvalidModuleId()
|
||||
DirectoryInfoHasInvalidModuleId::DirectoryInfoHasInvalidModuleId()
|
||||
{
|
||||
category().threadEvent("ProjectDataHasInvalidModuleId"_t);
|
||||
category().threadEvent("DirectoryInfoHasInvalidModuleId"_t);
|
||||
}
|
||||
|
||||
const char *ProjectDataHasInvalidModuleId::what() const noexcept
|
||||
const char *DirectoryInfoHasInvalidModuleId::what() const noexcept
|
||||
{
|
||||
return "The module id is invalid!";
|
||||
}
|
||||
|
@@ -130,24 +130,24 @@ public:
|
||||
const char *what() const noexcept override;
|
||||
};
|
||||
|
||||
class QMLDESIGNERCORE_EXPORT ProjectDataHasInvalidProjectSourceId : public ProjectStorageError
|
||||
class QMLDESIGNERCORE_EXPORT DirectoryInfoHasInvalidProjectSourceId : public ProjectStorageError
|
||||
{
|
||||
public:
|
||||
ProjectDataHasInvalidProjectSourceId();
|
||||
DirectoryInfoHasInvalidProjectSourceId();
|
||||
const char *what() const noexcept override;
|
||||
};
|
||||
|
||||
class QMLDESIGNERCORE_EXPORT ProjectDataHasInvalidSourceId : public ProjectStorageError
|
||||
class QMLDESIGNERCORE_EXPORT DirectoryInfoHasInvalidSourceId : public ProjectStorageError
|
||||
{
|
||||
public:
|
||||
ProjectDataHasInvalidSourceId();
|
||||
DirectoryInfoHasInvalidSourceId();
|
||||
const char *what() const noexcept override;
|
||||
};
|
||||
|
||||
class QMLDESIGNERCORE_EXPORT ProjectDataHasInvalidModuleId : public ProjectStorageError
|
||||
class QMLDESIGNERCORE_EXPORT DirectoryInfoHasInvalidModuleId : public ProjectStorageError
|
||||
{
|
||||
public:
|
||||
ProjectDataHasInvalidModuleId();
|
||||
DirectoryInfoHasInvalidModuleId();
|
||||
const char *what() const noexcept override;
|
||||
};
|
||||
|
||||
|
@@ -80,8 +80,8 @@ public:
|
||||
virtual bool isBasedOn(TypeId, TypeId, TypeId, TypeId, TypeId, TypeId, TypeId, TypeId) const = 0;
|
||||
|
||||
virtual FileStatus fetchFileStatus(SourceId sourceId) const = 0;
|
||||
virtual Storage::Synchronization::ProjectDatas fetchProjectDatas(SourceId sourceId) const = 0;
|
||||
virtual std::optional<Storage::Synchronization::ProjectData> fetchProjectData(SourceId sourceId) const = 0;
|
||||
virtual Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(SourceId sourceId) const = 0;
|
||||
virtual std::optional<Storage::Synchronization::DirectoryInfo> fetchDirectoryInfo(SourceId sourceId) const = 0;
|
||||
|
||||
virtual SourceId propertyEditorPathId(TypeId typeId) const = 0;
|
||||
virtual const Storage::Info::CommonTypeCache<ProjectStorageType> &commonTypeCache() const = 0;
|
||||
|
@@ -1160,44 +1160,44 @@ public:
|
||||
|
||||
using PropertyEditorQmlPaths = std::vector<class PropertyEditorQmlPath>;
|
||||
|
||||
class ProjectData
|
||||
class DirectoryInfo
|
||||
{
|
||||
public:
|
||||
ProjectData(SourceId projectSourceId, SourceId sourceId, ModuleId moduleId, FileType fileType)
|
||||
: projectSourceId{projectSourceId}
|
||||
DirectoryInfo(SourceId directorySourceId, SourceId sourceId, ModuleId moduleId, FileType fileType)
|
||||
: directorySourceId{directorySourceId}
|
||||
, sourceId{sourceId}
|
||||
, moduleId{moduleId}
|
||||
, fileType{fileType}
|
||||
{}
|
||||
|
||||
friend bool operator==(const ProjectData &first, const ProjectData &second)
|
||||
friend bool operator==(const DirectoryInfo &first, const DirectoryInfo &second)
|
||||
{
|
||||
return first.projectSourceId == second.projectSourceId && first.sourceId == second.sourceId
|
||||
return first.directorySourceId == second.directorySourceId && first.sourceId == second.sourceId
|
||||
&& first.moduleId.internalId() == second.moduleId.internalId()
|
||||
&& first.fileType == second.fileType;
|
||||
}
|
||||
|
||||
template<typename String>
|
||||
friend void convertToString(String &string, const ProjectData &projectData)
|
||||
friend void convertToString(String &string, const DirectoryInfo &directoryInfo)
|
||||
{
|
||||
using NanotraceHR::dictonary;
|
||||
using NanotraceHR::keyValue;
|
||||
auto dict = dictonary(keyValue("project source id", projectData.projectSourceId),
|
||||
keyValue("source id", projectData.sourceId),
|
||||
keyValue("module id", projectData.moduleId),
|
||||
keyValue("file type", projectData.fileType));
|
||||
auto dict = dictonary(keyValue("project source id", directoryInfo.directorySourceId),
|
||||
keyValue("source id", directoryInfo.sourceId),
|
||||
keyValue("module id", directoryInfo.moduleId),
|
||||
keyValue("file type", directoryInfo.fileType));
|
||||
|
||||
convertToString(string, dict);
|
||||
}
|
||||
|
||||
public:
|
||||
SourceId projectSourceId;
|
||||
SourceId directorySourceId;
|
||||
SourceId sourceId;
|
||||
ModuleId moduleId;
|
||||
FileType fileType;
|
||||
};
|
||||
|
||||
using ProjectDatas = std::vector<ProjectData>;
|
||||
using DirectoryInfos = std::vector<DirectoryInfo>;
|
||||
|
||||
class TypeAnnotation
|
||||
{
|
||||
@@ -1291,8 +1291,8 @@ public:
|
||||
, fileStatuses(std::move(fileStatuses))
|
||||
{}
|
||||
|
||||
SynchronizationPackage(SourceIds updatedProjectSourceIds, ProjectDatas projectDatas)
|
||||
: projectDatas(std::move(projectDatas))
|
||||
SynchronizationPackage(SourceIds updatedProjectSourceIds, DirectoryInfos directoryInfos)
|
||||
: directoryInfos(std::move(directoryInfos))
|
||||
, updatedProjectSourceIds(std::move(updatedProjectSourceIds))
|
||||
{}
|
||||
|
||||
@@ -1302,7 +1302,7 @@ public:
|
||||
SourceIds updatedSourceIds;
|
||||
SourceIds updatedFileStatusSourceIds;
|
||||
FileStatuses fileStatuses;
|
||||
ProjectDatas projectDatas;
|
||||
DirectoryInfos directoryInfos;
|
||||
SourceIds updatedProjectSourceIds;
|
||||
Imports moduleDependencies;
|
||||
SourceIds updatedModuleDependencySourceIds;
|
||||
|
@@ -134,13 +134,13 @@ SourceIds filterNotUpdatedSourceIds(SourceIds updatedSourceIds, SourceIds notUpd
|
||||
}
|
||||
|
||||
void addSourceIds(SourceIds &sourceIds,
|
||||
const Storage::Synchronization::ProjectDatas &projectDatas,
|
||||
const Storage::Synchronization::DirectoryInfos &directoryInfos,
|
||||
TracerLiteral message,
|
||||
Tracer &tracer)
|
||||
{
|
||||
for (const auto &projectData : projectDatas) {
|
||||
tracer.tick(message, keyValue("source id", projectData.sourceId));
|
||||
sourceIds.push_back(projectData.sourceId);
|
||||
for (const auto &directoryInfo : directoryInfos) {
|
||||
tracer.tick(message, keyValue("source id", directoryInfo.sourceId));
|
||||
sourceIds.push_back(directoryInfo.sourceId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,19 +311,17 @@ void ProjectStorageUpdater::updateQmlTypes(const QStringList &qmlTypesPaths,
|
||||
keyValue("source id", sourceId),
|
||||
keyValue("qml types path", qmlTypesPath));
|
||||
|
||||
Storage::Synchronization::ProjectData projectData{sourceId,
|
||||
sourceId,
|
||||
moduleId,
|
||||
Storage::Synchronization::FileType::QmlTypes};
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo{
|
||||
sourceId, sourceId, moduleId, Storage::Synchronization::FileType::QmlTypes};
|
||||
|
||||
FileState state = parseTypeInfo(projectData,
|
||||
FileState state = parseTypeInfo(directoryInfo,
|
||||
Utils::PathString{qmlTypesPath},
|
||||
package,
|
||||
notUpdatedSourceIds);
|
||||
|
||||
if (state == FileState::Changed) {
|
||||
tracer.tick("append project data"_t, keyValue("project data", projectData));
|
||||
package.projectDatas.push_back(std::move(projectData));
|
||||
tracer.tick("append project data"_t, keyValue("project data", directoryInfo));
|
||||
package.directoryInfos.push_back(std::move(directoryInfo));
|
||||
tracer.tick("append updated project source ids"_t, keyValue("source id", sourceId));
|
||||
package.updatedProjectSourceIds.push_back(sourceId);
|
||||
}
|
||||
@@ -382,10 +380,10 @@ void ProjectStorageUpdater::updateDirectoryChanged(std::string_view directoryPat
|
||||
tracer.tick("append updated module id"_t, keyValue("module id", moduleId));
|
||||
package.updatedModuleIds.push_back(moduleId);
|
||||
|
||||
const auto qmlProjectDatas = m_projectStorage.fetchProjectDatas(directorySourceId);
|
||||
addSourceIds(package.updatedSourceIds, qmlProjectDatas, "append updated source id"_t, tracer);
|
||||
const auto qmlDirectoryInfos = m_projectStorage.fetchDirectoryInfos(directorySourceId);
|
||||
addSourceIds(package.updatedSourceIds, qmlDirectoryInfos, "append updated source id"_t, tracer);
|
||||
addSourceIds(package.updatedFileStatusSourceIds,
|
||||
qmlProjectDatas,
|
||||
qmlDirectoryInfos,
|
||||
"append updated file status source id"_t,
|
||||
tracer);
|
||||
|
||||
@@ -463,7 +461,7 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
|
||||
case FileState::NotChanged: {
|
||||
tracer.tick("update directory not changed"_t);
|
||||
|
||||
parseProjectDatas(m_projectStorage.fetchProjectDatas(directorySourceId),
|
||||
parseDirectoryInfos(m_projectStorage.fetchDirectoryInfos(directorySourceId),
|
||||
package,
|
||||
notUpdatedSourceIds,
|
||||
watchedSourceIdsIds);
|
||||
@@ -476,13 +474,13 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
|
||||
package.updatedFileStatusSourceIds.push_back(qmldirSourceId);
|
||||
package.updatedProjectSourceIds.push_back(directorySourceId);
|
||||
package.updatedSourceIds.push_back(qmldirSourceId);
|
||||
auto qmlProjectDatas = m_projectStorage.fetchProjectDatas(directorySourceId);
|
||||
for (const Storage::Synchronization::ProjectData &projectData : qmlProjectDatas) {
|
||||
tracer.tick("append updated source id"_t, keyValue("source id", projectData.sourceId));
|
||||
package.updatedSourceIds.push_back(projectData.sourceId);
|
||||
auto qmlDirectoryInfos = m_projectStorage.fetchDirectoryInfos(directorySourceId);
|
||||
for (const Storage::Synchronization::DirectoryInfo &directoryInfo : qmlDirectoryInfos) {
|
||||
tracer.tick("append updated source id"_t, keyValue("source id", directoryInfo.sourceId));
|
||||
package.updatedSourceIds.push_back(directoryInfo.sourceId);
|
||||
tracer.tick("append updated file status source id"_t,
|
||||
keyValue("source id", projectData.sourceId));
|
||||
package.updatedFileStatusSourceIds.push_back(projectData.sourceId);
|
||||
keyValue("source id", directoryInfo.sourceId));
|
||||
package.updatedFileStatusSourceIds.push_back(directoryInfo.sourceId);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -802,9 +800,9 @@ void ProjectStorageUpdater::pathsWithIdsChanged(const std::vector<IdPaths> &chan
|
||||
for (SourceId sourceId : filterUniqueSourceIds(std::move(qmltypesSourceIds))) {
|
||||
if (!contains(directorySourceContextIds, m_pathCache.sourceContextId(sourceId))) {
|
||||
auto qmltypesPath = m_pathCache.sourcePath(sourceId);
|
||||
auto projectData = m_projectStorage.fetchProjectData(sourceId);
|
||||
if (projectData)
|
||||
parseTypeInfo(*projectData, qmltypesPath, package, notUpdatedSourceIds);
|
||||
auto directoryInfo = m_projectStorage.fetchDirectoryInfo(sourceId);
|
||||
if (directoryInfo)
|
||||
parseTypeInfo(*directoryInfo, qmltypesPath, package, notUpdatedSourceIds);
|
||||
}
|
||||
}
|
||||
} catch (const QmlDesigner::CannotParseQmlTypesFile &) {
|
||||
@@ -869,41 +867,42 @@ void ProjectStorageUpdater::parseTypeInfos(const QStringList &typeInfos,
|
||||
tracer.tick("append module dependenct source source id"_t, keyValue("source id", sourceId));
|
||||
package.updatedModuleDependencySourceIds.push_back(sourceId);
|
||||
|
||||
auto projectData = package.projectDatas.emplace_back(
|
||||
auto directoryInfo = package.directoryInfos.emplace_back(
|
||||
directorySourceId, sourceId, moduleId, Storage::Synchronization::FileType::QmlTypes);
|
||||
tracer.tick("append project data"_t, keyValue("source id", sourceId));
|
||||
|
||||
parseTypeInfo(projectData, qmltypesPath, package, notUpdatedSourceIds);
|
||||
parseTypeInfo(directoryInfo, qmltypesPath, package, notUpdatedSourceIds);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectStorageUpdater::parseProjectDatas(const Storage::Synchronization::ProjectDatas &projectDatas,
|
||||
void ProjectStorageUpdater::parseDirectoryInfos(
|
||||
const Storage::Synchronization::DirectoryInfos &directoryInfos,
|
||||
Storage::Synchronization::SynchronizationPackage &package,
|
||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||
WatchedSourceIdsIds &watchedSourceIds)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"parse project datas"_t, category()};
|
||||
|
||||
for (const Storage::Synchronization::ProjectData &projectData : projectDatas) {
|
||||
switch (projectData.fileType) {
|
||||
for (const Storage::Synchronization::DirectoryInfo &directoryInfo : directoryInfos) {
|
||||
switch (directoryInfo.fileType) {
|
||||
case Storage::Synchronization::FileType::QmlTypes: {
|
||||
watchedSourceIds.qmltypesSourceIds.push_back(projectData.sourceId);
|
||||
watchedSourceIds.qmltypesSourceIds.push_back(directoryInfo.sourceId);
|
||||
|
||||
auto qmltypesPath = m_pathCache.sourcePath(projectData.sourceId);
|
||||
parseTypeInfo(projectData, qmltypesPath, package, notUpdatedSourceIds);
|
||||
auto qmltypesPath = m_pathCache.sourcePath(directoryInfo.sourceId);
|
||||
parseTypeInfo(directoryInfo, qmltypesPath, package, notUpdatedSourceIds);
|
||||
break;
|
||||
}
|
||||
case Storage::Synchronization::FileType::QmlDocument: {
|
||||
watchedSourceIds.qmlSourceIds.push_back(projectData.sourceId);
|
||||
watchedSourceIds.qmlSourceIds.push_back(directoryInfo.sourceId);
|
||||
|
||||
parseQmlComponent(projectData.sourceId, package, notUpdatedSourceIds);
|
||||
parseQmlComponent(directoryInfo.sourceId, package, notUpdatedSourceIds);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::ProjectData &projectData,
|
||||
auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::DirectoryInfo &directoryInfo,
|
||||
Utils::SmallStringView qmltypesPath,
|
||||
Storage::Synchronization::SynchronizationPackage &package,
|
||||
NotUpdatedSourceIds ¬UpdatedSourceIds) -> FileState
|
||||
@@ -912,19 +911,19 @@ auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::Projec
|
||||
category(),
|
||||
keyValue("qmltypes path", qmltypesPath)};
|
||||
|
||||
auto state = fileState(projectData.sourceId, package, notUpdatedSourceIds);
|
||||
auto state = fileState(directoryInfo.sourceId, package, notUpdatedSourceIds);
|
||||
switch (state) {
|
||||
case FileState::Changed: {
|
||||
tracer.tick("append updated source ids"_t, keyValue("source id", projectData.sourceId));
|
||||
package.updatedSourceIds.push_back(projectData.sourceId);
|
||||
tracer.tick("append updated source ids"_t, keyValue("source id", directoryInfo.sourceId));
|
||||
package.updatedSourceIds.push_back(directoryInfo.sourceId);
|
||||
|
||||
const auto content = m_fileSystem.contentAsQString(QString{qmltypesPath});
|
||||
m_qmlTypesParser.parse(content, package.imports, package.types, projectData);
|
||||
m_qmlTypesParser.parse(content, package.imports, package.types, directoryInfo);
|
||||
break;
|
||||
}
|
||||
case FileState::NotChanged: {
|
||||
tracer.tick("append not updated source ids"_t, keyValue("source id", projectData.sourceId));
|
||||
notUpdatedSourceIds.sourceIds.push_back(projectData.sourceId);
|
||||
tracer.tick("append not updated source ids"_t, keyValue("source id", directoryInfo.sourceId));
|
||||
notUpdatedSourceIds.sourceIds.push_back(directoryInfo.sourceId);
|
||||
break;
|
||||
}
|
||||
case FileState::NotExists:
|
||||
@@ -971,9 +970,9 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
|
||||
tracer.tick("append not updated source id"_t, keyValue("source id", sourceId));
|
||||
notUpdatedSourceIds.sourceIds.emplace_back(sourceId);
|
||||
|
||||
const auto &projectData = package.projectDatas.emplace_back(
|
||||
const auto &directoryInfo = package.directoryInfos.emplace_back(
|
||||
directorySourceId, sourceId, ModuleId{}, Storage::Synchronization::FileType::QmlDocument);
|
||||
tracer.tick("append project data"_t, keyValue("project data", projectData));
|
||||
tracer.tick("append project data"_t, keyValue("project data", directoryInfo));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -987,9 +986,9 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
|
||||
break;
|
||||
}
|
||||
|
||||
const auto &projectData = package.projectDatas.emplace_back(
|
||||
const auto &directoryInfo = package.directoryInfos.emplace_back(
|
||||
directorySourceId, sourceId, ModuleId{}, Storage::Synchronization::FileType::QmlDocument);
|
||||
tracer.tick("append project data"_t, keyValue("project data", projectData));
|
||||
tracer.tick("append project data"_t, keyValue("project data", directoryInfo));
|
||||
|
||||
tracer.tick("append updated source id"_t, keyValue("source id", sourceId));
|
||||
package.updatedSourceIds.push_back(sourceId);
|
||||
|
@@ -192,11 +192,11 @@ private:
|
||||
Storage::Synchronization::SynchronizationPackage &package,
|
||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||
WatchedSourceIdsIds &watchedSourceIdsIds);
|
||||
void parseProjectDatas(const Storage::Synchronization::ProjectDatas &projectDatas,
|
||||
void parseDirectoryInfos(const Storage::Synchronization::DirectoryInfos &directoryInfos,
|
||||
Storage::Synchronization::SynchronizationPackage &package,
|
||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||
WatchedSourceIdsIds &watchedSourceIdsIds);
|
||||
FileState parseTypeInfo(const Storage::Synchronization::ProjectData &projectData,
|
||||
FileState parseTypeInfo(const Storage::Synchronization::DirectoryInfo &directoryInfo,
|
||||
Utils::SmallStringView qmltypesPath,
|
||||
Storage::Synchronization::SynchronizationPackage &package,
|
||||
NotUpdatedSourceIds ¬UpdatedSourceIds);
|
||||
|
@@ -495,7 +495,7 @@ bool skipType(const QQmlJSExportedScope &object, Utils::span<const QLatin1String
|
||||
}
|
||||
|
||||
void addTypes(Storage::Synchronization::Types &types,
|
||||
const Storage::Synchronization::ProjectData &projectData,
|
||||
const Storage::Synchronization::DirectoryInfo &directoryInfo,
|
||||
const QList<QQmlJSExportedScope> &objects,
|
||||
QmlTypesParser::ProjectStorage &storage,
|
||||
const ComponentWithoutNamespaces &componentNameWithoutNamespaces)
|
||||
@@ -503,15 +503,15 @@ 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.module(projectData.moduleId));
|
||||
const auto skipList = getSkipList(storage.module(directoryInfo.moduleId));
|
||||
|
||||
for (const auto &object : objects) {
|
||||
if (skipType(object, skipList))
|
||||
continue;
|
||||
|
||||
addType(types,
|
||||
projectData.sourceId,
|
||||
projectData.moduleId,
|
||||
directoryInfo.sourceId,
|
||||
directoryInfo.moduleId,
|
||||
object,
|
||||
storage,
|
||||
componentNameWithoutNamespaces);
|
||||
@@ -523,7 +523,7 @@ void addTypes(Storage::Synchronization::Types &types,
|
||||
void QmlTypesParser::parse(const QString &sourceContent,
|
||||
Storage::Imports &imports,
|
||||
Storage::Synchronization::Types &types,
|
||||
const Storage::Synchronization::ProjectData &projectData)
|
||||
const Storage::Synchronization::DirectoryInfo &directoryInfo)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"qmltypes parser parse"_t, category()};
|
||||
|
||||
@@ -536,8 +536,8 @@ void QmlTypesParser::parse(const QString &sourceContent,
|
||||
|
||||
auto componentNameWithoutNamespaces = createComponentNameWithoutNamespaces(components);
|
||||
|
||||
addImports(imports, projectData.sourceId, dependencies, m_storage, projectData.moduleId);
|
||||
addTypes(types, projectData, components, m_storage, componentNameWithoutNamespaces);
|
||||
addImports(imports, directoryInfo.sourceId, dependencies, m_storage, directoryInfo.moduleId);
|
||||
addTypes(types, directoryInfo, components, m_storage, componentNameWithoutNamespaces);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -545,7 +545,7 @@ void QmlTypesParser::parse(const QString &sourceContent,
|
||||
void QmlTypesParser::parse([[maybe_unused]] const QString &sourceContent,
|
||||
[[maybe_unused]] Storage::Imports &imports,
|
||||
[[maybe_unused]] Storage::Synchronization::Types &types,
|
||||
[[maybe_unused]] const Storage::Synchronization::ProjectData &projectData)
|
||||
[[maybe_unused]] const Storage::Synchronization::DirectoryInfo &directoryInfo)
|
||||
{}
|
||||
|
||||
#endif
|
||||
|
@@ -31,7 +31,7 @@ public:
|
||||
void parse(const QString &sourceContent,
|
||||
Storage::Imports &imports,
|
||||
Storage::Synchronization::Types &types,
|
||||
const Storage::Synchronization::ProjectData &projectData) override;
|
||||
const Storage::Synchronization::DirectoryInfo &directoryInfo) override;
|
||||
|
||||
private:
|
||||
#ifdef QDS_BUILD_QMLPARSER
|
||||
|
@@ -15,7 +15,7 @@ public:
|
||||
virtual void parse(const QString &sourceContent,
|
||||
Storage::Imports &imports,
|
||||
Storage::Synchronization::Types &types,
|
||||
const Storage::Synchronization::ProjectData &projectData)
|
||||
const Storage::Synchronization::DirectoryInfo &directoryInfo)
|
||||
= 0;
|
||||
|
||||
protected:
|
||||
|
@@ -210,10 +210,10 @@ std::unique_ptr<ProjectStorageData> createProjectStorageData(::ProjectExplorer::
|
||||
}
|
||||
} // namespace
|
||||
|
||||
class QmlDesignerProjectManager::QmlDesignerProjectManagerProjectData
|
||||
class QmlDesignerProjectManager::QmlDesignerProjectManagerDirectoryInfo
|
||||
{
|
||||
public:
|
||||
QmlDesignerProjectManagerProjectData(ImageCacheStorage<Sqlite::Database> &storage,
|
||||
QmlDesignerProjectManagerDirectoryInfo(ImageCacheStorage<Sqlite::Database> &storage,
|
||||
::ProjectExplorer::Project *project,
|
||||
ExternalDependenciesInterface &externalDependencies)
|
||||
: collector{connectionManager,
|
||||
@@ -297,8 +297,8 @@ namespace {
|
||||
ProjectStorageDependencies QmlDesignerProjectManager::projectStorageDependencies()
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
return {m_projectData->projectStorageData->storage,
|
||||
m_projectData->projectStorageData->pathCache};
|
||||
return {m_directoryInfo->projectStorageData->storage,
|
||||
m_directoryInfo->projectStorageData->pathCache};
|
||||
} else {
|
||||
return {*dummyProjectStorage(), *dummyPathCache()};
|
||||
}
|
||||
@@ -499,10 +499,10 @@ QString qtCreatorItemLibraryPath()
|
||||
|
||||
void QmlDesignerProjectManager::projectAdded(::ProjectExplorer::Project *project)
|
||||
{
|
||||
m_projectData = std::make_unique<QmlDesignerProjectManagerProjectData>(m_previewImageCacheData->storage,
|
||||
m_directoryInfo = std::make_unique<QmlDesignerProjectManagerDirectoryInfo>(m_previewImageCacheData->storage,
|
||||
project,
|
||||
m_externalDependencies);
|
||||
m_projectData->activeTarget = project->activeTarget();
|
||||
m_directoryInfo->activeTarget = project->activeTarget();
|
||||
|
||||
QObject::connect(project, &::ProjectExplorer::Project::fileListChanged, [&]() {
|
||||
fileListChanged();
|
||||
@@ -522,9 +522,9 @@ void QmlDesignerProjectManager::projectAdded(::ProjectExplorer::Project *project
|
||||
|
||||
void QmlDesignerProjectManager::aboutToRemoveProject(::ProjectExplorer::Project *)
|
||||
{
|
||||
if (m_projectData) {
|
||||
m_previewImageCacheData->collector.setTarget(m_projectData->activeTarget);
|
||||
m_projectData.reset();
|
||||
if (m_directoryInfo) {
|
||||
m_previewImageCacheData->collector.setTarget(m_directoryInfo->activeTarget);
|
||||
m_directoryInfo.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,14 +532,14 @@ void QmlDesignerProjectManager::projectRemoved(::ProjectExplorer::Project *) {}
|
||||
|
||||
void QmlDesignerProjectManager::generatePreview()
|
||||
{
|
||||
if (!m_projectData || !m_projectData->activeTarget)
|
||||
if (!m_directoryInfo || !m_directoryInfo->activeTarget)
|
||||
return;
|
||||
|
||||
::QmlProjectManager::QmlBuildSystem *qmlBuildSystem = getQmlBuildSystem(
|
||||
m_projectData->activeTarget);
|
||||
m_directoryInfo->activeTarget);
|
||||
|
||||
if (qmlBuildSystem) {
|
||||
m_previewImageCacheData->collector.setTarget(m_projectData->activeTarget);
|
||||
m_previewImageCacheData->collector.setTarget(m_directoryInfo->activeTarget);
|
||||
m_previewImageCacheData->factory.generate(qmlBuildSystem->mainFilePath().toString().toUtf8());
|
||||
}
|
||||
}
|
||||
@@ -587,12 +587,12 @@ void QmlDesignerProjectManager::fileListChanged()
|
||||
|
||||
void QmlDesignerProjectManager::activeTargetChanged(ProjectExplorer::Target *target)
|
||||
{
|
||||
if (!m_projectData || !m_projectData->projectStorageData)
|
||||
if (!m_directoryInfo || !m_directoryInfo->projectStorageData)
|
||||
return;
|
||||
|
||||
QObject::disconnect(m_projectData->activeTarget, nullptr, nullptr, nullptr);
|
||||
QObject::disconnect(m_directoryInfo->activeTarget, nullptr, nullptr, nullptr);
|
||||
|
||||
m_projectData->activeTarget = target;
|
||||
m_directoryInfo->activeTarget = target;
|
||||
|
||||
if (target) {
|
||||
QObject::connect(target, &::ProjectExplorer::Target::kitChanged, [&]() { kitChanged(); });
|
||||
@@ -625,17 +625,17 @@ void QmlDesignerProjectManager::projectChanged()
|
||||
|
||||
void QmlDesignerProjectManager::update()
|
||||
{
|
||||
if (!m_projectData || !m_projectData->projectStorageData)
|
||||
if (!m_directoryInfo || !m_directoryInfo->projectStorageData)
|
||||
return;
|
||||
|
||||
if constexpr (isUsingQmlDesignerLite()) {
|
||||
m_projectData->projectStorageData->updater.update(directoriesForLiteDesigner(),
|
||||
m_directoryInfo->projectStorageData->updater.update(directoriesForLiteDesigner(),
|
||||
qmlTypesForLiteDesigner(),
|
||||
propertyEditorResourcesPath(),
|
||||
{qtCreatorItemLibraryPath()});
|
||||
} else {
|
||||
m_projectData->projectStorageData->updater.update(directories(m_projectData->activeTarget),
|
||||
qmlTypes(m_projectData->activeTarget),
|
||||
m_directoryInfo->projectStorageData->updater.update(directories(m_directoryInfo->activeTarget),
|
||||
qmlTypes(m_directoryInfo->activeTarget),
|
||||
propertyEditorResourcesPath(),
|
||||
{qtCreatorItemLibraryPath()});
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ class QmlDesignerProjectManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
class QmlDesignerProjectManagerProjectData;
|
||||
class QmlDesignerProjectManagerDirectoryInfo;
|
||||
class PreviewImageCacheData;
|
||||
class ImageCacheData;
|
||||
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
std::once_flag imageCacheFlag;
|
||||
std::unique_ptr<ImageCacheData> m_imageCacheData;
|
||||
std::unique_ptr<PreviewImageCacheData> m_previewImageCacheData;
|
||||
std::unique_ptr<QmlDesignerProjectManagerProjectData> m_projectData;
|
||||
std::unique_ptr<QmlDesignerProjectManagerDirectoryInfo> m_directoryInfo;
|
||||
ExternalDependenciesInterface &m_externalDependencies;
|
||||
};
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -300,13 +300,13 @@ public:
|
||||
(QmlDesigner::SourceId sourceId),
|
||||
(const, override));
|
||||
|
||||
MOCK_METHOD(QmlDesigner::Storage::Synchronization::ProjectDatas,
|
||||
fetchProjectDatas,
|
||||
MOCK_METHOD(QmlDesigner::Storage::Synchronization::DirectoryInfos,
|
||||
fetchDirectoryInfos,
|
||||
(QmlDesigner::SourceId sourceId),
|
||||
(const, override));
|
||||
|
||||
MOCK_METHOD(std::optional<QmlDesigner::Storage::Synchronization::ProjectData>,
|
||||
fetchProjectData,
|
||||
MOCK_METHOD(std::optional<QmlDesigner::Storage::Synchronization::DirectoryInfo>,
|
||||
fetchDirectoryInfo,
|
||||
(QmlDesigner::SourceId sourceId),
|
||||
(const, override));
|
||||
|
||||
|
@@ -15,6 +15,6 @@ public:
|
||||
(const QString &sourceContent,
|
||||
QmlDesigner::Storage::Imports &imports,
|
||||
QmlDesigner::Storage::Synchronization::Types &types,
|
||||
const QmlDesigner::Storage::Synchronization::ProjectData &projectData),
|
||||
const QmlDesigner::Storage::Synchronization::DirectoryInfo &directoryInfo),
|
||||
(override));
|
||||
};
|
||||
|
@@ -792,7 +792,7 @@ std::ostream &operator<<(std::ostream &out, const SynchronizationPackage &packag
|
||||
<< ", fileStatuses: " << package.fileStatuses
|
||||
<< ", updatedFileStatusSourceIds: " << package.updatedFileStatusSourceIds
|
||||
<< ", updatedProjectSourceIds: " << package.updatedProjectSourceIds
|
||||
<< ", projectDatas: " << package.projectDatas
|
||||
<< ", directoryInfos: " << package.directoryInfos
|
||||
<< ", propertyEditorQmlPaths: " << package.propertyEditorQmlPaths
|
||||
<< ", updatedPropertyEditorQmlPathSourceIds: "
|
||||
<< package.updatedPropertyEditorQmlPathSourceIds
|
||||
@@ -801,9 +801,9 @@ std::ostream &operator<<(std::ostream &out, const SynchronizationPackage &packag
|
||||
<< ")";
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const ProjectData &data)
|
||||
std::ostream &operator<<(std::ostream &out, const DirectoryInfo &data)
|
||||
{
|
||||
return out << "(" << data.projectSourceId << ", " << data.sourceId << ", " << data.moduleId
|
||||
return out << "(" << data.directorySourceId << ", " << data.sourceId << ", " << data.moduleId
|
||||
<< ", " << data.fileType << ")";
|
||||
}
|
||||
|
||||
|
@@ -207,7 +207,7 @@ class EnumeratorDeclaration;
|
||||
enum class ImportKind : char;
|
||||
enum class IsAutoVersion : char;
|
||||
enum class IsQualified : int;
|
||||
class ProjectData;
|
||||
class DirectoryInfo;
|
||||
class SynchronizationPackage;
|
||||
enum class FileType : char;
|
||||
enum class ChangeLevel : char;
|
||||
@@ -227,7 +227,7 @@ std::ostream &operator<<(std::ostream &out, const EnumerationDeclaration &enumer
|
||||
std::ostream &operator<<(std::ostream &out, const EnumeratorDeclaration &enumeratorDeclaration);
|
||||
std::ostream &operator<<(std::ostream &out, const ImportKind &importKind);
|
||||
std::ostream &operator<<(std::ostream &out, IsQualified isQualified);
|
||||
std::ostream &operator<<(std::ostream &out, const ProjectData &data);
|
||||
std::ostream &operator<<(std::ostream &out, const DirectoryInfo &data);
|
||||
std::ostream &operator<<(std::ostream &out, const SynchronizationPackage &package);
|
||||
std::ostream &operator<<(std::ostream &out, FileType fileType);
|
||||
std::ostream &operator<<(std::ostream &out, ChangeLevel changeLevel);
|
||||
|
@@ -5123,220 +5123,220 @@ TEST_F(ProjectStorage, populate_module_cache)
|
||||
ASSERT_THAT(newStorage.module(id), IsModule("Qml", ModuleKind::QmlLibrary));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, add_project_dataes)
|
||||
TEST_F(ProjectStorage, add_directory_infoes)
|
||||
{
|
||||
Storage::Synchronization::ProjectData projectData1{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
||||
sourceId1,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData2{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
||||
sourceId2,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData3{qtQuickProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
||||
sourceId3,
|
||||
qtQuickModuleId,
|
||||
Storage::Synchronization::FileType::QmlTypes};
|
||||
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
||||
{projectData1, projectData2, projectData3}});
|
||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||
|
||||
ASSERT_THAT(storage.fetchProjectDatas({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(projectData1, projectData2, projectData3));
|
||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(directoryInfo1, directoryInfo2, directoryInfo3));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, remove_project_data)
|
||||
TEST_F(ProjectStorage, remove_directory_info)
|
||||
{
|
||||
Storage::Synchronization::ProjectData projectData1{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
||||
sourceId1,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData2{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
||||
sourceId2,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData3{qtQuickProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
||||
sourceId3,
|
||||
qtQuickModuleId,
|
||||
Storage::Synchronization::FileType::QmlTypes};
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
||||
{projectData1, projectData2, projectData3}});
|
||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||
|
||||
storage.synchronize(
|
||||
SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId}, {projectData1}});
|
||||
SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId}, {directoryInfo1}});
|
||||
|
||||
ASSERT_THAT(storage.fetchProjectDatas({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(projectData1));
|
||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(directoryInfo1));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, update_project_data_file_type)
|
||||
TEST_F(ProjectStorage, update_directory_info_file_type)
|
||||
{
|
||||
Storage::Synchronization::ProjectData projectData1{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
||||
sourceId1,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData2{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
||||
sourceId2,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData2b{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo2b{qmlProjectSourceId,
|
||||
sourceId2,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlTypes};
|
||||
Storage::Synchronization::ProjectData projectData3{qtQuickProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
||||
sourceId3,
|
||||
qtQuickModuleId,
|
||||
Storage::Synchronization::FileType::QmlTypes};
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
||||
{projectData1, projectData2, projectData3}});
|
||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {projectData1, projectData2b}});
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1, directoryInfo2b}});
|
||||
|
||||
ASSERT_THAT(storage.fetchProjectDatas({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(projectData1, projectData2b, projectData3));
|
||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(directoryInfo1, directoryInfo2b, directoryInfo3));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, update_project_data_module_id)
|
||||
TEST_F(ProjectStorage, update_directory_info_module_id)
|
||||
{
|
||||
Storage::Synchronization::ProjectData projectData1{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
||||
sourceId1,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData2{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
||||
sourceId3,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData2b{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo2b{qmlProjectSourceId,
|
||||
sourceId3,
|
||||
qtQuickModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData3{qtQuickProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
||||
sourceId2,
|
||||
qtQuickModuleId,
|
||||
Storage::Synchronization::FileType::QmlTypes};
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
||||
{projectData1, projectData2, projectData3}});
|
||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {projectData1, projectData2b}});
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1, directoryInfo2b}});
|
||||
|
||||
ASSERT_THAT(storage.fetchProjectDatas({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(projectData1, projectData2b, projectData3));
|
||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(directoryInfo1, directoryInfo2b, directoryInfo3));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, throw_for_invalid_source_id_in_project_data)
|
||||
TEST_F(ProjectStorage, throw_for_invalid_source_id_in_directory_info)
|
||||
{
|
||||
Storage::Synchronization::ProjectData projectData1{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
||||
SourceId{},
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
|
||||
ASSERT_THROW(storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {projectData1}}),
|
||||
QmlDesigner::ProjectDataHasInvalidSourceId);
|
||||
ASSERT_THROW(storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1}}),
|
||||
QmlDesigner::DirectoryInfoHasInvalidSourceId);
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, insert_project_data_with_invalid_module_id)
|
||||
TEST_F(ProjectStorage, insert_directory_info_with_invalid_module_id)
|
||||
{
|
||||
Storage::Synchronization::ProjectData projectData1{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
||||
sourceId1,
|
||||
ModuleId{},
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {projectData1}});
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1}});
|
||||
|
||||
ASSERT_THAT(storage.fetchProjectDatas({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(projectData1));
|
||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(directoryInfo1));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, update_project_data_with_invalid_module_id)
|
||||
TEST_F(ProjectStorage, update_directory_info_with_invalid_module_id)
|
||||
{
|
||||
Storage::Synchronization::ProjectData projectData1{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
||||
sourceId1,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {projectData1}});
|
||||
projectData1.moduleId = ModuleId{};
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1}});
|
||||
directoryInfo1.moduleId = ModuleId{};
|
||||
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {projectData1}});
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1}});
|
||||
|
||||
ASSERT_THAT(storage.fetchProjectDatas({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(projectData1));
|
||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
||||
UnorderedElementsAre(directoryInfo1));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, throw_for_updating_with_invalid_project_source_id_in_project_data)
|
||||
TEST_F(ProjectStorage, throw_for_updating_with_invalid_project_source_id_in_directory_info)
|
||||
{
|
||||
Storage::Synchronization::ProjectData projectData1{SourceId{},
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo1{SourceId{},
|
||||
sourceId1,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
|
||||
ASSERT_THROW(storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {projectData1}}),
|
||||
QmlDesigner::ProjectDataHasInvalidProjectSourceId);
|
||||
ASSERT_THROW(storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1}}),
|
||||
QmlDesigner::DirectoryInfoHasInvalidProjectSourceId);
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, fetch_project_datas_by_directory_source_ids)
|
||||
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_source_ids)
|
||||
{
|
||||
Storage::Synchronization::ProjectData projectData1{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
||||
sourceId1,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData2{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
||||
sourceId2,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData3{qtQuickProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
||||
sourceId3,
|
||||
qtQuickModuleId,
|
||||
Storage::Synchronization::FileType::QmlTypes};
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
||||
{projectData1, projectData2, projectData3}});
|
||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||
|
||||
auto projectDatas = storage.fetchProjectDatas({qmlProjectSourceId, qtQuickProjectSourceId});
|
||||
auto directoryInfos = storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId});
|
||||
|
||||
ASSERT_THAT(projectDatas, UnorderedElementsAre(projectData1, projectData2, projectData3));
|
||||
ASSERT_THAT(directoryInfos, UnorderedElementsAre(directoryInfo1, directoryInfo2, directoryInfo3));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, fetch_project_datas_by_directory_source_id)
|
||||
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_source_id)
|
||||
{
|
||||
Storage::Synchronization::ProjectData projectData1{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
||||
sourceId1,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData2{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
||||
sourceId2,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData3{qtQuickProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
||||
sourceId3,
|
||||
qtQuickModuleId,
|
||||
Storage::Synchronization::FileType::QmlTypes};
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
||||
{projectData1, projectData2, projectData3}});
|
||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||
|
||||
auto projectData = storage.fetchProjectDatas(qmlProjectSourceId);
|
||||
auto directoryInfo = storage.fetchDirectoryInfos(qmlProjectSourceId);
|
||||
|
||||
ASSERT_THAT(projectData, UnorderedElementsAre(projectData1, projectData2));
|
||||
ASSERT_THAT(directoryInfo, UnorderedElementsAre(directoryInfo1, directoryInfo2));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, fetch_project_data_by_source_ids)
|
||||
TEST_F(ProjectStorage, fetch_directory_info_by_source_ids)
|
||||
{
|
||||
Storage::Synchronization::ProjectData projectData1{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
||||
sourceId1,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData2{qmlProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
||||
sourceId2,
|
||||
qmlModuleId,
|
||||
Storage::Synchronization::FileType::QmlDocument};
|
||||
Storage::Synchronization::ProjectData projectData3{qtQuickProjectSourceId,
|
||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
||||
sourceId3,
|
||||
qtQuickModuleId,
|
||||
Storage::Synchronization::FileType::QmlTypes};
|
||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
||||
{projectData1, projectData2, projectData3}});
|
||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||
|
||||
auto projectData = storage.fetchProjectData({sourceId2});
|
||||
auto directoryInfo = storage.fetchDirectoryInfo({sourceId2});
|
||||
|
||||
ASSERT_THAT(projectData, Eq(projectData2));
|
||||
ASSERT_THAT(directoryInfo, Eq(directoryInfo2));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, exclude_exported_types)
|
||||
|
@@ -28,10 +28,10 @@ namespace Storage = QmlDesigner::Storage;
|
||||
using QmlDesigner::IdPaths;
|
||||
using QmlDesigner::Storage::Import;
|
||||
using QmlDesigner::Storage::ModuleKind;
|
||||
using QmlDesigner::Storage::Synchronization::DirectoryInfo;
|
||||
using QmlDesigner::Storage::Synchronization::FileType;
|
||||
using QmlDesigner::Storage::Synchronization::IsAutoVersion;
|
||||
using QmlDesigner::Storage::Synchronization::ModuleExportedImport;
|
||||
using QmlDesigner::Storage::Synchronization::ProjectData;
|
||||
using QmlDesigner::Storage::Synchronization::SynchronizationPackage;
|
||||
using QmlDesigner::Storage::TypeTraits;
|
||||
using QmlDesigner::Storage::TypeTraitsKind;
|
||||
@@ -96,21 +96,21 @@ MATCHER_P3(IsFileStatus,
|
||||
&& fileStatus.lastModified == lastModified;
|
||||
}
|
||||
|
||||
MATCHER_P4(IsProjectData,
|
||||
projectSourceId,
|
||||
MATCHER_P4(IsDirectoryInfo,
|
||||
directorySourceId,
|
||||
sourceId,
|
||||
moduleId,
|
||||
fileType,
|
||||
std::string(negation ? "isn't " : "is ")
|
||||
+ PrintToString(Storage::Synchronization::ProjectData{
|
||||
projectSourceId, sourceId, moduleId, fileType}))
|
||||
+ PrintToString(Storage::Synchronization::DirectoryInfo{
|
||||
directorySourceId, sourceId, moduleId, fileType}))
|
||||
{
|
||||
const Storage::Synchronization::ProjectData &projectData = arg;
|
||||
const Storage::Synchronization::DirectoryInfo &directoryInfo = arg;
|
||||
|
||||
return compareInvalidAreTrue(projectData.projectSourceId, projectSourceId)
|
||||
&& projectData.sourceId == sourceId
|
||||
&& compareInvalidAreTrue(projectData.moduleId, moduleId)
|
||||
&& projectData.fileType == fileType;
|
||||
return compareInvalidAreTrue(directoryInfo.directorySourceId, directorySourceId)
|
||||
&& directoryInfo.sourceId == sourceId
|
||||
&& compareInvalidAreTrue(directoryInfo.moduleId, moduleId)
|
||||
&& directoryInfo.fileType == fileType;
|
||||
}
|
||||
|
||||
MATCHER(PackageIsEmpty, std::string(negation ? "isn't empty" : "is empty"))
|
||||
@@ -118,7 +118,7 @@ MATCHER(PackageIsEmpty, std::string(negation ? "isn't empty" : "is empty"))
|
||||
const Storage::Synchronization::SynchronizationPackage &package = arg;
|
||||
|
||||
return package.imports.empty() && package.types.empty() && package.fileStatuses.empty()
|
||||
&& package.updatedSourceIds.empty() && package.projectDatas.empty()
|
||||
&& package.updatedSourceIds.empty() && package.directoryInfos.empty()
|
||||
&& package.updatedFileStatusSourceIds.empty() && package.updatedProjectSourceIds.empty()
|
||||
&& package.moduleDependencies.empty() && package.updatedModuleDependencySourceIds.empty()
|
||||
&& package.moduleExportedImports.empty() && package.updatedModuleIds.empty()
|
||||
@@ -282,14 +282,14 @@ public:
|
||||
ON_CALL(fileSystemMock, qmlFileNames(Eq(directoryPath))).WillByDefault(Return(qmlFileNames));
|
||||
}
|
||||
|
||||
void setProjectDatas(SourceId directoryPathSourceId,
|
||||
const QmlDesigner::Storage::Synchronization::ProjectDatas &projectDatas)
|
||||
void setDirectoryInfos(SourceId directoryPathSourceId,
|
||||
const QmlDesigner::Storage::Synchronization::DirectoryInfos &directoryInfos)
|
||||
{
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(directoryPathSourceId)))
|
||||
.WillByDefault(Return(projectDatas));
|
||||
for (const ProjectData &projectData : projectDatas) {
|
||||
ON_CALL(projectStorageMock, fetchProjectData(Eq(projectData.sourceId)))
|
||||
.WillByDefault(Return(std::optional{projectData}));
|
||||
ON_CALL(projectStorageMock, fetchDirectoryInfos(Eq(directoryPathSourceId)))
|
||||
.WillByDefault(Return(directoryInfos));
|
||||
for (const DirectoryInfo &directoryInfo : directoryInfos) {
|
||||
ON_CALL(projectStorageMock, fetchDirectoryInfo(Eq(directoryInfo.sourceId)))
|
||||
.WillByDefault(Return(std::optional{directoryInfo}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -476,9 +476,9 @@ TEST_F(ProjectStorageUpdater, parse_qml_types)
|
||||
setContent(u"/path/example2.qmltypes", qmltypes2);
|
||||
|
||||
EXPECT_CALL(qmlTypesParserMock,
|
||||
parse(qmltypes, _, _, Field(&ProjectData::moduleId, exampleCppNativeModuleId)));
|
||||
parse(qmltypes, _, _, Field(&DirectoryInfo::moduleId, exampleCppNativeModuleId)));
|
||||
EXPECT_CALL(qmlTypesParserMock,
|
||||
parse(qmltypes2, _, _, Field(&ProjectData::moduleId, exampleCppNativeModuleId)));
|
||||
parse(qmltypes2, _, _, Field(&DirectoryInfo::moduleId, exampleCppNativeModuleId)));
|
||||
|
||||
updater.update(directories, {}, {}, {});
|
||||
}
|
||||
@@ -516,8 +516,8 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_types)
|
||||
Field(&SynchronizationPackage::fileStatuses,
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 1, 21),
|
||||
IsFileStatus(qmltypesPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmltypesPathSourceId,
|
||||
exampleCppNativeModuleId,
|
||||
FileType::QmlTypes))),
|
||||
@@ -655,16 +655,16 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents)
|
||||
IsFileStatus(qmlDocumentSourceId3, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -680,7 +680,7 @@ TEST_F(ProjectStorageUpdater, synchronize_add_only_qml_document_in_directory)
|
||||
setFilesChanged({directoryPathSourceId});
|
||||
setFilesDontChanged({qmlDirPathSourceId, qmlDocumentSourceId1});
|
||||
setFilesAdded({qmlDocumentSourceId2});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument}});
|
||||
setQmlFileNames(u"/path", {"First.qml", "First2.qml"});
|
||||
|
||||
@@ -715,12 +715,12 @@ TEST_F(ProjectStorageUpdater, synchronize_add_only_qml_document_in_directory)
|
||||
IsFileStatus(directoryPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -738,7 +738,8 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document)
|
||||
setFilesChanged({qmlDirPathSourceId});
|
||||
setFilesDontChanged({qmlDocumentSourceId1, qmlDocumentSourceId2});
|
||||
setFilesRemoved({qmlDocumentSourceId3});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId3, ModuleId{}, FileType::QmlDocument}});
|
||||
@@ -778,12 +779,12 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document)
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -799,7 +800,7 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document_in_qmldir_only)
|
||||
setContent(u"/path/qmldir", qmldir);
|
||||
setFilesChanged({qmlDirPathSourceId});
|
||||
setFilesDontChanged({qmlDocumentSourceId1, qmlDocumentSourceId2});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}});
|
||||
setQmlFileNames(u"/path", {"First.qml", "First2.qml"});
|
||||
@@ -833,12 +834,12 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document_in_qmldir_only)
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -855,7 +856,7 @@ TEST_F(ProjectStorageUpdater, synchronize_add_qml_document_to_qmldir)
|
||||
setContent(u"/path/qmldir", qmldir);
|
||||
setFilesChanged({qmlDirPathSourceId});
|
||||
setFilesDontChanged({qmlDocumentSourceId1, qmlDocumentSourceId2});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}});
|
||||
setQmlFileNames(u"/path", {"First.qml", "First2.qml"});
|
||||
@@ -891,12 +892,12 @@ TEST_F(ProjectStorageUpdater, synchronize_add_qml_document_to_qmldir)
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -912,7 +913,7 @@ TEST_F(ProjectStorageUpdater, synchronize_remove_qml_document_from_qmldir)
|
||||
setContent(u"/path/qmldir", qmldir);
|
||||
setFilesDontChanged({qmlDocumentSourceId1, qmlDocumentSourceId2});
|
||||
setFilesChanged({qmlDirPathSourceId});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}});
|
||||
setQmlFileNames(u"/path", {"First.qml", "First2.qml"});
|
||||
@@ -946,12 +947,12 @@ TEST_F(ProjectStorageUpdater, synchronize_remove_qml_document_from_qmldir)
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -1012,16 +1013,16 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_dont_update_if_up_to_dat
|
||||
UnorderedElementsAre(qmlDirPathSourceId, qmlDocumentSourceId1, qmlDocumentSourceId2)),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -1031,7 +1032,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_dont_update_if_up_to_dat
|
||||
|
||||
TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed)
|
||||
{
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
@@ -1075,14 +1076,14 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed)
|
||||
qmltypes2PathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
qmlDocumentSourceId2)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.update(directories, {}, {}, {});
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed_and_some_updated_files)
|
||||
{
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
@@ -1110,7 +1111,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed_and_some
|
||||
IsFileStatus(qmlDocumentSourceId1, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
|
||||
UnorderedElementsAre(qmltypesPathSourceId, qmlDocumentSourceId1)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.update(directories, {}, {}, {});
|
||||
}
|
||||
@@ -1118,7 +1119,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed_and_some
|
||||
TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_not_changed_and_some_removed_files)
|
||||
{
|
||||
setQmlFileNames(u"/path", {"First2.qml"});
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
@@ -1137,7 +1138,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_changed_and_some_rem
|
||||
typeinfo example2.qmltypes)"};
|
||||
setContent(u"/path/qmldir", qmldir);
|
||||
setQmlFileNames(u"/path", {"First2.qml"});
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
@@ -1169,12 +1170,12 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_changed_and_some_rem
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId, qmltypesPathSourceId, qmlDocumentSourceId1)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmltypes2PathSourceId,
|
||||
exampleCppNativeModuleId,
|
||||
FileType::QmlTypes))))));
|
||||
@@ -1191,7 +1192,7 @@ TEST_F(ProjectStorageUpdater, update_qml_types_files_is_empty)
|
||||
Field(&SynchronizationPackage::updatedSourceIds, IsEmpty()),
|
||||
Field(&SynchronizationPackage::fileStatuses, IsEmpty()),
|
||||
Field(&SynchronizationPackage::updatedFileStatusSourceIds, IsEmpty()),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()),
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds, IsEmpty()))));
|
||||
|
||||
updater.update({}, {}, {}, {});
|
||||
@@ -1210,12 +1211,12 @@ TEST_F(ProjectStorageUpdater, update_qml_types_files)
|
||||
IsFileStatus(qmltypes2PathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
|
||||
UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(qmltypesPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(qmltypesPathSourceId,
|
||||
qmltypesPathSourceId,
|
||||
builtinCppNativeModuleId,
|
||||
FileType::QmlTypes),
|
||||
IsProjectData(qmltypes2PathSourceId,
|
||||
IsDirectoryInfo(qmltypes2PathSourceId,
|
||||
qmltypes2PathSourceId,
|
||||
builtinCppNativeModuleId,
|
||||
FileType::QmlTypes))),
|
||||
@@ -1239,8 +1240,8 @@ TEST_F(ProjectStorageUpdater, dont_update_qml_types_files_if_unchanged)
|
||||
UnorderedElementsAre(IsFileStatus(qmltypesPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
|
||||
UnorderedElementsAre(qmltypesPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(qmltypesPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(qmltypesPathSourceId,
|
||||
qmltypesPathSourceId,
|
||||
builtinCppNativeModuleId,
|
||||
FileType::QmlTypes))),
|
||||
@@ -1284,8 +1285,8 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_with_different_version_b
|
||||
IsFileStatus(qmlDocumentSourceId1, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -1325,8 +1326,8 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_with_different_type_name
|
||||
IsFileStatus(qmlDocumentSourceId1, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -1750,10 +1751,10 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qml_files_changed)
|
||||
{
|
||||
setFilesDontChanged({qmldir1SourceId, qmldir2SourceId, path1SourceId, path2SourceId});
|
||||
setFilesChanged({firstSourceId, secondSourceId, thirdSourceId});
|
||||
setProjectDatas(path1SourceId,
|
||||
setDirectoryInfos(path1SourceId,
|
||||
{{path1SourceId, firstSourceId, exampleModuleId, FileType::QmlDocument},
|
||||
{path1SourceId, secondSourceId, exampleModuleId, FileType::QmlDocument}});
|
||||
setProjectDatas(path2SourceId,
|
||||
setDirectoryInfos(path2SourceId,
|
||||
{{path2SourceId, thirdSourceId, ModuleId{}, FileType::QmlDocument}});
|
||||
|
||||
EXPECT_CALL(patchWatcherMock,
|
||||
@@ -1773,10 +1774,10 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qml_files_and_directories_dont
|
||||
firstSourceId,
|
||||
secondSourceId,
|
||||
thirdSourceId});
|
||||
setProjectDatas(path1SourceId,
|
||||
setDirectoryInfos(path1SourceId,
|
||||
{{path1SourceId, firstSourceId, exampleModuleId, FileType::QmlDocument},
|
||||
{path1SourceId, secondSourceId, exampleModuleId, FileType::QmlDocument}});
|
||||
setProjectDatas(path2SourceId,
|
||||
setDirectoryInfos(path2SourceId,
|
||||
{{path2SourceId, thirdSourceId, ModuleId{}, FileType::QmlDocument}});
|
||||
|
||||
EXPECT_CALL(patchWatcherMock,
|
||||
@@ -1828,9 +1829,9 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qmltypes_files_changed)
|
||||
{
|
||||
setFilesDontChanged({qmldir1SourceId, qmldir2SourceId, path1SourceId, path2SourceId});
|
||||
setFilesChanged({qmltypes1SourceId, qmltypes2SourceId});
|
||||
setProjectDatas(path1SourceId,
|
||||
setDirectoryInfos(path1SourceId,
|
||||
{{path1SourceId, qmltypes1SourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
setProjectDatas(path2SourceId,
|
||||
setDirectoryInfos(path2SourceId,
|
||||
{{path2SourceId, qmltypes2SourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
|
||||
EXPECT_CALL(patchWatcherMock,
|
||||
@@ -1849,9 +1850,9 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmltypes_files_and_directories
|
||||
path2SourceId,
|
||||
qmltypes1SourceId,
|
||||
qmltypes2SourceId});
|
||||
setProjectDatas(path1SourceId,
|
||||
setDirectoryInfos(path1SourceId,
|
||||
{{path1SourceId, qmltypes1SourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
setProjectDatas(path2SourceId,
|
||||
setDirectoryInfos(path2SourceId,
|
||||
{{path2SourceId, qmltypes2SourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
|
||||
EXPECT_CALL(patchWatcherMock,
|
||||
@@ -1927,16 +1928,16 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir)
|
||||
IsFileStatus(qmlDocumentSourceId3, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -1955,7 +1956,8 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_throws_if
|
||||
TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_throws_if_directory_does_not_exists)
|
||||
{
|
||||
setFilesDontExists({qmlDirPathSourceId, directoryPathSourceId});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId3, ModuleId{}, FileType::QmlDocument}});
|
||||
@@ -1977,7 +1979,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_throws_if
|
||||
Field(&SynchronizationPackage::fileStatuses, IsEmpty()),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.update(directories, {}, {}, {});
|
||||
}
|
||||
@@ -1988,7 +1990,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_add_qml_d
|
||||
setFilesChanged({directoryPathSourceId});
|
||||
setFilesAdded({qmlDocumentSourceId3});
|
||||
setFilesDontChanged({qmlDocumentSourceId1, qmlDocumentSourceId2});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}});
|
||||
|
||||
@@ -2014,16 +2016,16 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_add_qml_d
|
||||
IsFileStatus(qmlDocumentSourceId3, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -2038,7 +2040,8 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_removes_q
|
||||
setFilesRemoved({qmlDocumentSourceId3});
|
||||
setFilesDontChanged({qmlDocumentSourceId1, qmlDocumentSourceId2});
|
||||
setQmlFileNames(u"/path", {"First.qml", "First2.qml"});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId3, ModuleId{}, FileType::QmlDocument}});
|
||||
@@ -2057,12 +2060,12 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_removes_q
|
||||
UnorderedElementsAre(IsFileStatus(directoryPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -2125,16 +2128,16 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories)
|
||||
IsFileStatus(qmlDocumentSourceId3, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -2149,7 +2152,8 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removed_directory)
|
||||
qmlDocumentSourceId1,
|
||||
qmlDocumentSourceId2,
|
||||
qmlDocumentSourceId3});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId3, ModuleId{}, FileType::QmlDocument}});
|
||||
@@ -2171,7 +2175,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removed_directory)
|
||||
Field(&SynchronizationPackage::fileStatuses, UnorderedElementsAre()),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.pathsWithIdsChanged({{directoryProjectChunkId, {directoryPathSourceId}}});
|
||||
}
|
||||
@@ -2273,16 +2277,16 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_and_qmldir)
|
||||
IsFileStatus(qmlDocumentSourceId3, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -2335,7 +2339,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_add_only_qml_document_in_directory
|
||||
setFilesChanged({directoryPathSourceId});
|
||||
setFilesDontChanged({qmlDirPathSourceId, qmlDocumentSourceId1});
|
||||
setFilesAdded({qmlDocumentSourceId2});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument}});
|
||||
setQmlFileNames(u"/path", {"First.qml", "First2.qml"});
|
||||
|
||||
@@ -2370,12 +2374,12 @@ TEST_F(ProjectStorageUpdater, watcher_updates_add_only_qml_document_in_directory
|
||||
IsFileStatus(directoryPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -2393,7 +2397,8 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removes_qml_document)
|
||||
setFilesChanged({qmlDirPathSourceId});
|
||||
setFilesDontChanged({qmlDocumentSourceId1, qmlDocumentSourceId2});
|
||||
setFilesRemoved({qmlDocumentSourceId3});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId3, ModuleId{}, FileType::QmlDocument}});
|
||||
@@ -2433,12 +2438,12 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removes_qml_document)
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -2454,7 +2459,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removes_qml_document_in_qmldir_onl
|
||||
setContent(u"/path/qmldir", qmldir);
|
||||
setFilesChanged({qmlDirPathSourceId});
|
||||
setFilesDontChanged({qmlDocumentSourceId1, qmlDocumentSourceId2});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}});
|
||||
setQmlFileNames(u"/path", {"First.qml", "First2.qml"});
|
||||
@@ -2488,12 +2493,12 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removes_qml_document_in_qmldir_onl
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -2510,7 +2515,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_add_qml_document_to_qm
|
||||
setContent(u"/path/qmldir", qmldir);
|
||||
setFilesChanged({qmlDirPathSourceId});
|
||||
setFilesDontChanged({qmlDocumentSourceId1, qmlDocumentSourceId2});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}});
|
||||
setQmlFileNames(u"/path", {"First.qml", "First2.qml"});
|
||||
@@ -2546,12 +2551,12 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_add_qml_document_to_qm
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -2567,7 +2572,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_remove_qml_document_fr
|
||||
setContent(u"/path/qmldir", qmldir);
|
||||
setFilesDontChanged({qmlDocumentSourceId1, qmlDocumentSourceId2});
|
||||
setFilesChanged({qmlDirPathSourceId});
|
||||
setProjectDatas(directoryPathSourceId,
|
||||
setDirectoryInfos(directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}});
|
||||
setQmlFileNames(u"/path", {"First.qml", "First2.qml"});
|
||||
@@ -2601,12 +2606,12 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_remove_qml_document_fr
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -2667,16 +2672,16 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_dont_update_qml_docume
|
||||
UnorderedElementsAre(qmlDirPathSourceId, qmlDocumentSourceId1, qmlDocumentSourceId2)),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -2737,16 +2742,16 @@ TEST_F(ProjectStorageUpdater, watcher_updates_qmldirs_dont_update_qml_documents_
|
||||
UnorderedElementsAre(qmlDirPathSourceId, qmlDocumentSourceId1, qmlDocumentSourceId2)),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -2756,7 +2761,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_qmldirs_dont_update_qml_documents_
|
||||
|
||||
TEST_F(ProjectStorageUpdater, watcher_updates_directory_but_not_qmldir)
|
||||
{
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
@@ -2800,7 +2805,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directory_but_not_qmldir)
|
||||
qmltypes2PathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
qmlDocumentSourceId2)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.pathsWithIdsChanged({{directoryProjectChunkId, {directoryPathSourceId}}});
|
||||
}
|
||||
@@ -2832,7 +2837,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_qml_documents)
|
||||
IsFileStatus(qmlDocumentSourceId2, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
|
||||
UnorderedElementsAre(qmlDocumentSourceId1, qmlDocumentSourceId2)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.pathsWithIdsChanged(
|
||||
{{qmlDocumentProjectChunkId, {qmlDocumentSourceId1, qmlDocumentSourceId2}}});
|
||||
@@ -2859,7 +2864,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removed_qml_documents)
|
||||
UnorderedElementsAre(IsFileStatus(qmlDocumentSourceId1, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
|
||||
UnorderedElementsAre(qmlDocumentSourceId1, qmlDocumentSourceId2)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.pathsWithIdsChanged(
|
||||
{{qmlDocumentProjectChunkId, {qmlDocumentSourceId1, qmlDocumentSourceId2}}});
|
||||
@@ -2882,7 +2887,7 @@ TEST_F(ProjectStorageUpdater, watcher_dont_updates_qml_documents_for_other_proje
|
||||
|
||||
TEST_F(ProjectStorageUpdater, watcher_updates_qmltypes)
|
||||
{
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
@@ -2902,7 +2907,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_qmltypes)
|
||||
IsFileStatus(qmltypes2PathSourceId, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
|
||||
UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.pathsWithIdsChanged(
|
||||
{{qmltypesProjectChunkId, {qmltypesPathSourceId, qmltypes2PathSourceId}}});
|
||||
@@ -2910,7 +2915,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_qmltypes)
|
||||
|
||||
TEST_F(ProjectStorageUpdater, watcher_updates_removed_qmltypes_without_updated_qmldir)
|
||||
{
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
@@ -2926,7 +2931,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removed_qmltypes_without_updated_q
|
||||
|
||||
TEST_F(ProjectStorageUpdater, watcher_updates_removed_qmltypes_with_updated_qmldir)
|
||||
{
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
@@ -2956,8 +2961,8 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removed_qmltypes_with_updated_qmld
|
||||
UnorderedElementsAre(qmlDirPathSourceId,
|
||||
qmltypesPathSourceId,
|
||||
qmltypes2PathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmltypes2PathSourceId,
|
||||
exampleCppNativeModuleId,
|
||||
FileType::QmlTypes))))));
|
||||
@@ -2967,7 +2972,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removed_qmltypes_with_updated_qmld
|
||||
|
||||
TEST_F(ProjectStorageUpdater, watcher_dont_watches_directories_after_qmltypes_changes)
|
||||
{
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
@@ -2982,7 +2987,7 @@ TEST_F(ProjectStorageUpdater, watcher_dont_watches_directories_after_qmltypes_ch
|
||||
|
||||
TEST_F(ProjectStorageUpdater, watcher_dont_updates_qmltypes_for_other_projects)
|
||||
{
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
@@ -3050,16 +3055,16 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_and_but_not_included_q
|
||||
IsFileStatus(qmlDocumentSourceId3, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -3127,16 +3132,16 @@ TEST_F(ProjectStorageUpdater, watcher_updates_qmldir_and_but_not_included_qml_do
|
||||
IsFileStatus(qmlDocumentSourceId3, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -3148,7 +3153,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_qmldir_and_but_not_included_qml_do
|
||||
|
||||
TEST_F(ProjectStorageUpdater, watcher_updates_qmldir_and_but_not_included_qmltypes)
|
||||
{
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
@@ -3226,24 +3231,24 @@ TEST_F(ProjectStorageUpdater, watcher_updates_qmldir_and_but_not_included_qmltyp
|
||||
IsFileStatus(qmlDocumentSourceId3, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
Field(&SynchronizationPackage::directoryInfos,
|
||||
UnorderedElementsAre(IsDirectoryInfo(directoryPathSourceId,
|
||||
qmltypesPathSourceId,
|
||||
exampleCppNativeModuleId,
|
||||
FileType::QmlTypes),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmltypes2PathSourceId,
|
||||
exampleCppNativeModuleId,
|
||||
FileType::QmlTypes),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
IsDirectoryInfo(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -3274,7 +3279,7 @@ TEST_F(ProjectStorageUpdater, input_is_reused_next_call_if_an_error_happens)
|
||||
FirstType 2.2 First2.qml
|
||||
SecondType 2.2 Second.qml)"};
|
||||
setContent(u"/path/qmldir", qmldir);
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
@@ -3321,7 +3326,7 @@ TEST_F(ProjectStorageUpdater, input_is_reused_next_call_if_an_error_happens)
|
||||
qmlDocumentSourceId2,
|
||||
qmltypesPathSourceId,
|
||||
qmltypes2PathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.pathsWithIdsChanged(
|
||||
{{qmlDocumentProjectChunkId, {qmlDocumentSourceId1, qmlDocumentSourceId2}}});
|
||||
@@ -3334,7 +3339,7 @@ TEST_F(ProjectStorageUpdater, input_is_reused_next_call_if_an_error_happens_and_
|
||||
FirstType 2.2 First2.qml
|
||||
SecondType 2.2 Second.qml)"};
|
||||
setContent(u"/path/qmldir", qmldir);
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
@@ -3381,7 +3386,7 @@ TEST_F(ProjectStorageUpdater, input_is_reused_next_call_if_an_error_happens_and_
|
||||
qmlDocumentSourceId2,
|
||||
qmltypesPathSourceId,
|
||||
qmltypes2PathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.pathsWithIdsChanged(
|
||||
{{qmltypesProjectChunkId, {qmltypesPathSourceId, qmltypes2PathSourceId}},
|
||||
@@ -3395,7 +3400,7 @@ TEST_F(ProjectStorageUpdater, input_is_reused_next_call_if_an_error_happens_and_
|
||||
FirstType 2.2 First2.qml
|
||||
SecondType 2.2 Second.qml)"};
|
||||
setContent(u"/path/qmldir", qmldir);
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
@@ -3444,7 +3449,7 @@ TEST_F(ProjectStorageUpdater, input_is_reused_next_call_if_an_error_happens_and_
|
||||
qmlDocumentSourceId2,
|
||||
qmltypesPathSourceId,
|
||||
qmltypes2PathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.pathsWithIdsChanged(
|
||||
{{qmltypesProjectChunkId, {qmltypesPathSourceId, qmltypes2PathSourceId}},
|
||||
@@ -3458,7 +3463,7 @@ TEST_F(ProjectStorageUpdater, input_is_cleared_after_successful_update)
|
||||
FirstType 2.2 First2.qml
|
||||
SecondType 2.2 Second.qml)"};
|
||||
setContent(u"/path/qmldir", qmldir);
|
||||
setProjectDatas(
|
||||
setDirectoryInfos(
|
||||
directoryPathSourceId,
|
||||
{{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes}});
|
||||
@@ -3491,7 +3496,7 @@ TEST_F(ProjectStorageUpdater, input_is_cleared_after_successful_update)
|
||||
IsFileStatus(qmlDocumentSourceId2, 1, 21))),
|
||||
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
|
||||
UnorderedElementsAre(qmlDocumentSourceId1, qmlDocumentSourceId2)),
|
||||
Field(&SynchronizationPackage::projectDatas, IsEmpty()))));
|
||||
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
|
||||
|
||||
updater.pathsWithIdsChanged(
|
||||
{{qmlDocumentProjectChunkId, {qmlDocumentSourceId1, qmlDocumentSourceId2}}});
|
||||
|
@@ -177,7 +177,7 @@ protected:
|
||||
Synchronization::Types types;
|
||||
SourceId qmltypesFileSourceId{sourcePathCache.sourceId("path/to/types.qmltypes")};
|
||||
ModuleId qtQmlNativeModuleId = storage.moduleId("QtQml", ModuleKind::CppLibrary);
|
||||
Synchronization::ProjectData projectData{qmltypesFileSourceId,
|
||||
Synchronization::DirectoryInfo directoryInfo{qmltypesFileSourceId,
|
||||
qmltypesFileSourceId,
|
||||
qtQmlNativeModuleId,
|
||||
Synchronization::FileType::QmlTypes};
|
||||
@@ -191,7 +191,7 @@ TEST_F(QmlTypesParser, imports)
|
||||
dependencies:
|
||||
["QtQuick 2.15", "QtQuick.Window 2.1", "QtFoo 6"]})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(imports,
|
||||
UnorderedElementsAre(IsImport(storage.moduleId("QML", ModuleKind::CppLibrary),
|
||||
@@ -218,7 +218,7 @@ TEST_F(QmlTypesParser, types)
|
||||
Component { name: "QObject"}
|
||||
Component { name: "QQmlComponent"}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
UnorderedElementsAre(IsType("QObject",
|
||||
@@ -241,7 +241,7 @@ TEST_F(QmlTypesParser, prototype)
|
||||
Component { name: "QQmlComponent"
|
||||
prototype: "QObject"}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
UnorderedElementsAre(IsType("QObject",
|
||||
@@ -264,7 +264,7 @@ TEST_F(QmlTypesParser, extension)
|
||||
Component { name: "QQmlComponent"
|
||||
extension: "QObject"}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
UnorderedElementsAre(IsType("QObject",
|
||||
@@ -289,7 +289,7 @@ TEST_F(QmlTypesParser, exported_types)
|
||||
ModuleId qmlModuleId = storage.moduleId("QML", ModuleKind::QmlLibrary);
|
||||
ModuleId qtQmlModuleId = storage.moduleId("QtQml", ModuleKind::QmlLibrary);
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(
|
||||
types,
|
||||
@@ -312,7 +312,7 @@ TEST_F(QmlTypesParser, properties)
|
||||
Property { name: "targets"; type: "QQuickItem"; isList: true; isReadonly: true; isPointer: true }
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
ElementsAre(Field(
|
||||
@@ -346,7 +346,7 @@ TEST_F(QmlTypesParser, properties_with_qualified_types)
|
||||
Property { name: "values2"; type: "Qt::Vector" }
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
Contains(
|
||||
@@ -372,7 +372,7 @@ TEST_F(QmlTypesParser, properties_without_type)
|
||||
Property { name: "target"; type: "QObject"; isPointer: true }
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
ElementsAre(
|
||||
@@ -405,7 +405,7 @@ TEST_F(QmlTypesParser, functions)
|
||||
}
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
ElementsAre(Field(
|
||||
@@ -436,7 +436,7 @@ TEST_F(QmlTypesParser, skip_java_script_functions)
|
||||
}
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types, ElementsAre(Field(&Synchronization::Type::functionDeclarations, IsEmpty())));
|
||||
}
|
||||
@@ -456,7 +456,7 @@ TEST_F(QmlTypesParser, functions_with_qualified_types)
|
||||
}
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
Contains(
|
||||
@@ -491,7 +491,7 @@ TEST_F(QmlTypesParser, signals)
|
||||
}
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
ElementsAre(Field(&Synchronization::Type::signalDeclarations,
|
||||
@@ -524,7 +524,7 @@ TEST_F(QmlTypesParser, signals_with_qualified_types)
|
||||
}
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
Contains(
|
||||
@@ -557,7 +557,7 @@ TEST_F(QmlTypesParser, enumerations)
|
||||
}
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
Contains(Field(
|
||||
@@ -596,7 +596,7 @@ TEST_F(QmlTypesParser, enumeration_is_exported_as_type)
|
||||
exports: ["QML/QtObject 1.0", "QtQml/QtObject 2.1"]
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
QmlDesigner::Storage::TypeTraits traits{QmlDesigner::Storage::TypeTraitsKind::Value};
|
||||
traits.isEnum = true;
|
||||
|
||||
@@ -642,7 +642,7 @@ TEST_F(QmlTypesParser, enumeration_is_exported_as_type_with_alias)
|
||||
exports: ["QML/QtObject 1.0", "QtQml/QtObject 2.1"]
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
QmlDesigner::Storage::TypeTraits traits{QmlDesigner::Storage::TypeTraitsKind::Value};
|
||||
traits.isEnum = true;
|
||||
|
||||
@@ -690,7 +690,7 @@ TEST_F(QmlTypesParser, enumeration_is_exported_as_type_with_alias_too)
|
||||
exports: ["QML/QtObject 1.0", "QtQml/QtObject 2.1"]
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
QmlDesigner::Storage::TypeTraits traits{QmlDesigner::Storage::TypeTraitsKind::Value};
|
||||
traits.isEnum = true;
|
||||
|
||||
@@ -728,7 +728,7 @@ TEST_F(QmlTypesParser, enumeration_is_referenced_by_qualified_name)
|
||||
}
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
Contains(Field(&Synchronization::Type::propertyDeclarations,
|
||||
@@ -756,7 +756,7 @@ TEST_F(QmlTypesParser, alias_enumeration_is_referenced_by_qualified_name)
|
||||
}
|
||||
}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
Contains(Field(&Synchronization::Type::propertyDeclarations,
|
||||
@@ -773,7 +773,7 @@ TEST_F(QmlTypesParser, access_type_is_reference)
|
||||
Component { name: "QObject"
|
||||
accessSemantics: "reference"}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types, ElementsAre(IsTypeTrait(Storage::TypeTraitsKind::Reference)));
|
||||
}
|
||||
@@ -785,7 +785,7 @@ TEST_F(QmlTypesParser, access_type_is_value)
|
||||
Component { name: "QObject"
|
||||
accessSemantics: "value"}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types, ElementsAre(IsTypeTrait(Storage::TypeTraitsKind::Value)));
|
||||
}
|
||||
@@ -797,7 +797,7 @@ TEST_F(QmlTypesParser, access_type_is_sequence)
|
||||
Component { name: "QObject"
|
||||
accessSemantics: "sequence"}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types, ElementsAre(IsTypeTrait(Storage::TypeTraitsKind::Sequence)));
|
||||
}
|
||||
@@ -809,7 +809,7 @@ TEST_F(QmlTypesParser, access_type_is_none)
|
||||
Component { name: "QObject"
|
||||
accessSemantics: "none"}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types, ElementsAre(IsTypeTrait(Storage::TypeTraitsKind::None)));
|
||||
}
|
||||
@@ -821,7 +821,7 @@ TEST_F(QmlTypesParser, uses_custom_parser)
|
||||
Component { name: "QObject"
|
||||
hasCustomParser: true }})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types, ElementsAre(IsTypeTrait(UsesCustomParser(true))));
|
||||
}
|
||||
@@ -833,7 +833,7 @@ TEST_F(QmlTypesParser, uses_no_custom_parser)
|
||||
Component { name: "QObject"
|
||||
hasCustomParser: false }})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types, ElementsAre(IsTypeTrait(UsesCustomParser(false))));
|
||||
}
|
||||
@@ -845,7 +845,7 @@ TEST_F(QmlTypesParser, default_property)
|
||||
Component { name: "QObject"
|
||||
defaultProperty: "children" }})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
ElementsAre(Field(&Synchronization::Type::defaultPropertyName, Eq("children"))));
|
||||
@@ -854,7 +854,7 @@ TEST_F(QmlTypesParser, default_property)
|
||||
TEST_F(QmlTypesParser, skip_template_item)
|
||||
{
|
||||
ModuleId moduleId = storage.moduleId("QtQuick.Templates", ModuleKind::CppLibrary);
|
||||
Synchronization::ProjectData projectData{qmltypesFileSourceId,
|
||||
Synchronization::DirectoryInfo directoryInfo{qmltypesFileSourceId,
|
||||
qmltypesFileSourceId,
|
||||
moduleId,
|
||||
Synchronization::FileType::QmlTypes};
|
||||
@@ -863,7 +863,7 @@ TEST_F(QmlTypesParser, skip_template_item)
|
||||
Component { name: "QQuickItem"}
|
||||
Component { name: "QQmlComponent"}})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
parser.parse(source, imports, types, directoryInfo);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
UnorderedElementsAre(IsType("QQmlComponent",
|
||||
|
Reference in New Issue
Block a user