forked from qt-creator/qt-creator
QmlDesigner: Use directory source id for project data
There are qml directories without a qmldir. To identify them we use the directory source id instead of the qmldir source id. Task-number: QDS-9345 Change-Id: I4ed4596a21576e6bbd18c5117753669ef8a68a28 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -289,6 +289,7 @@ void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
|
||||
QmlDirParser parser;
|
||||
parser.parse(m_fileSystem.contentAsQString(QString{qmldirSourcePath}));
|
||||
|
||||
if (qmldirState == FileState::Changed)
|
||||
package.updatedSourceIds.push_back(qmlDirSourceId);
|
||||
|
||||
Utils::PathString moduleName{parser.typeNamespace()};
|
||||
@@ -305,7 +306,7 @@ void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
|
||||
m_projectStorage);
|
||||
package.updatedModuleIds.push_back(moduleId);
|
||||
|
||||
const auto qmlProjectDatas = m_projectStorage.fetchProjectDatas(qmlDirSourceId);
|
||||
const auto qmlProjectDatas = m_projectStorage.fetchProjectDatas(directorySourceId);
|
||||
addSourceIds(package.updatedSourceIds, qmlProjectDatas);
|
||||
addSourceIds(package.updatedFileStatusSourceIds, qmlProjectDatas);
|
||||
|
||||
@@ -315,7 +316,7 @@ void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
|
||||
parseTypeInfos(qmlTypes,
|
||||
filterMultipleEntries(parser.dependencies()),
|
||||
imports,
|
||||
qmlDirSourceId,
|
||||
directorySourceId,
|
||||
directoryPath,
|
||||
cppModuleId,
|
||||
package,
|
||||
@@ -325,16 +326,16 @@ void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
|
||||
}
|
||||
parseQmlComponents(
|
||||
createComponents(parser.components(), moduleId, pathModuleId, m_fileSystem, directory),
|
||||
qmlDirSourceId,
|
||||
directorySourceId,
|
||||
directoryId,
|
||||
package,
|
||||
notUpdatedFileStatusSourceIds,
|
||||
watchedQmlSourceIds);
|
||||
package.updatedProjectSourceIds.push_back(qmlDirSourceId);
|
||||
package.updatedProjectSourceIds.push_back(directorySourceId);
|
||||
break;
|
||||
}
|
||||
case FileState::NotChanged: {
|
||||
parseProjectDatas(m_projectStorage.fetchProjectDatas(qmlDirSourceId),
|
||||
parseProjectDatas(m_projectStorage.fetchProjectDatas(directorySourceId),
|
||||
package,
|
||||
notUpdatedFileStatusSourceIds,
|
||||
notUpdatedSourceIds,
|
||||
@@ -343,7 +344,7 @@ void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
|
||||
}
|
||||
case FileState::NotExists: {
|
||||
package.updatedSourceIds.push_back(qmlDirSourceId);
|
||||
auto qmlProjectDatas = m_projectStorage.fetchProjectDatas(qmlDirSourceId);
|
||||
auto qmlProjectDatas = m_projectStorage.fetchProjectDatas(directorySourceId);
|
||||
for (const Storage::Synchronization::ProjectData &projectData : qmlProjectDatas) {
|
||||
package.updatedSourceIds.push_back(projectData.sourceId);
|
||||
}
|
||||
@@ -362,7 +363,7 @@ void ProjectStorageUpdater::pathsChanged(const SourceIds &) {}
|
||||
void ProjectStorageUpdater::parseTypeInfos(const QStringList &typeInfos,
|
||||
const QList<QmlDirParser::Import> &qmldirDependencies,
|
||||
const QList<QmlDirParser::Import> &qmldirImports,
|
||||
SourceId qmldirSourceId,
|
||||
SourceId directorySourceId,
|
||||
Utils::SmallStringView directoryPath,
|
||||
ModuleId moduleId,
|
||||
Storage::Synchronization::SynchronizationPackage &package,
|
||||
@@ -384,7 +385,7 @@ void ProjectStorageUpdater::parseTypeInfos(const QStringList &typeInfos,
|
||||
package.updatedModuleDependencySourceIds.push_back(sourceId);
|
||||
|
||||
auto projectData = package.projectDatas.emplace_back(
|
||||
qmldirSourceId, sourceId, moduleId, Storage::Synchronization::FileType::QmlTypes);
|
||||
directorySourceId, sourceId, moduleId, Storage::Synchronization::FileType::QmlTypes);
|
||||
|
||||
parseTypeInfo(projectData,
|
||||
qmltypesPath,
|
||||
@@ -459,7 +460,7 @@ auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::Projec
|
||||
void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFilePath,
|
||||
Utils::SmallStringView directoryPath,
|
||||
Storage::Synchronization::ExportedTypes exportedTypes,
|
||||
SourceId qmldirSourceId,
|
||||
SourceId directorySourceId,
|
||||
Storage::Synchronization::SynchronizationPackage &package,
|
||||
SourceIds ¬UpdatedFileStatusSourceIds,
|
||||
SourceIds &watchedQmlSourceIds)
|
||||
@@ -490,7 +491,7 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
|
||||
break;
|
||||
}
|
||||
|
||||
package.projectDatas.emplace_back(qmldirSourceId,
|
||||
package.projectDatas.emplace_back(directorySourceId,
|
||||
sourceId,
|
||||
ModuleId{},
|
||||
Storage::Synchronization::FileType::QmlDocument);
|
||||
@@ -571,7 +572,7 @@ Storage::Synchronization::ExportedTypes createExportedTypes(ProjectStorageUpdate
|
||||
} // namespace
|
||||
|
||||
void ProjectStorageUpdater::parseQmlComponents(Components components,
|
||||
SourceId qmldirSourceId,
|
||||
SourceId directorySourceId,
|
||||
SourceContextId directoryId,
|
||||
Storage::Synchronization::SynchronizationPackage &package,
|
||||
SourceIds ¬UpdatedFileStatusSourceIds,
|
||||
@@ -589,7 +590,7 @@ void ProjectStorageUpdater::parseQmlComponents(Components components,
|
||||
parseQmlComponent(fileName,
|
||||
directoryPath,
|
||||
createExportedTypes(componentsWithSameFileName),
|
||||
qmldirSourceId,
|
||||
directorySourceId,
|
||||
package,
|
||||
notUpdatedFileStatusSourceIds,
|
||||
watchedQmlSourceIds);
|
||||
|
@@ -113,7 +113,7 @@ private:
|
||||
void parseTypeInfos(const QStringList &typeInfos,
|
||||
const QList<QmlDirParser::Import> &qmldirDependencies,
|
||||
const QList<QmlDirParser::Import> &qmldirImports,
|
||||
SourceId qmldirSourceId,
|
||||
SourceId directorySourceId,
|
||||
Utils::SmallStringView directoryPath,
|
||||
ModuleId moduleId,
|
||||
Storage::Synchronization::SynchronizationPackage &package,
|
||||
@@ -131,7 +131,7 @@ private:
|
||||
SourceIds ¬UpdatedFileStatusSourceIds,
|
||||
SourceIds ¬UpdatedSourceIds);
|
||||
void parseQmlComponents(Components components,
|
||||
SourceId qmldirSourceId,
|
||||
SourceId directorySourceId,
|
||||
SourceContextId directoryId,
|
||||
Storage::Synchronization::SynchronizationPackage &package,
|
||||
SourceIds ¬UpdatedFileStatusSourceIds,
|
||||
@@ -139,7 +139,7 @@ private:
|
||||
void parseQmlComponent(Utils::SmallStringView fileName,
|
||||
Utils::SmallStringView directory,
|
||||
Storage::Synchronization::ExportedTypes exportedTypes,
|
||||
SourceId qmldirSourceId,
|
||||
SourceId directorySourceId,
|
||||
Storage::Synchronization::SynchronizationPackage &package,
|
||||
SourceIds ¬UpdatedFileStatusSourceIds,
|
||||
SourceIds &watchedQmlSourceIds);
|
||||
|
@@ -349,9 +349,9 @@ TEST_F(ProjectStorageUpdater, GetContentForQmlDirPathsIfFileStatusIsDifferent)
|
||||
|
||||
TEST_F(ProjectStorageUpdater, RequestFileStatusFromFileSystem)
|
||||
{
|
||||
EXPECT_CALL(fileSystemMock, fileStatus(Ne(qmlDirPathSourceId))).Times(AnyNumber());
|
||||
EXPECT_CALL(fileSystemMock, fileStatus(Ne(directoryPathSourceId))).Times(AnyNumber());
|
||||
|
||||
EXPECT_CALL(fileSystemMock, fileStatus(Eq(qmlDirPathSourceId)));
|
||||
EXPECT_CALL(fileSystemMock, fileStatus(Eq(directoryPathSourceId)));
|
||||
|
||||
updater.update(directories, {});
|
||||
}
|
||||
@@ -447,12 +447,12 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlTypes)
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 21, 421),
|
||||
IsFileStatus(qmltypesPathSourceId, 21, 421))),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(qmlDirPathSourceId,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
qmltypesPathSourceId,
|
||||
exampleCppNativeModuleId,
|
||||
FileType::QmlTypes))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId)))));
|
||||
UnorderedElementsAre(directoryPathSourceId)))));
|
||||
|
||||
updater.update(directories, {});
|
||||
}
|
||||
@@ -599,12 +599,17 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocuments)
|
||||
IsFileStatus(qmlDocumentSourceId2, 22, 13),
|
||||
IsFileStatus(qmlDocumentSourceId3, 22, 14))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId)),
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(
|
||||
IsProjectData(qmlDirPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument),
|
||||
IsProjectData(qmlDirPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument),
|
||||
IsProjectData(qmlDirPathSourceId,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -621,6 +626,10 @@ TEST_F(ProjectStorageUpdater, SynchronizeAddOnlyQmlDocumentInDirectory)
|
||||
.WillByDefault(Return(FileStatus{qmlDocumentSourceId1, 22, 2}));
|
||||
ON_CALL(fileSystemMock, qmlFileNames(Eq(QString("/path"))))
|
||||
.WillByDefault(Return(QStringList{"First.qml", "First2.qml"}));
|
||||
ON_CALL(projectStorageMock, fetchFileStatus(Eq(qmlDirPathSourceId)))
|
||||
.WillByDefault(Return(FileStatus{qmlDirPathSourceId, 21, 421}));
|
||||
ON_CALL(projectStorageMock, fetchFileStatus(Eq(directoryPathSourceId)))
|
||||
.WillByDefault(Return(FileStatus{directoryPathSourceId, 21, 421}));
|
||||
|
||||
EXPECT_CALL(projectStorageMock,
|
||||
synchronize(AllOf(
|
||||
@@ -643,24 +652,25 @@ TEST_F(ProjectStorageUpdater, SynchronizeAddOnlyQmlDocumentInDirectory)
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
UnorderedElementsAre(
|
||||
IsExportedType(pathModuleId, "First2", -1, -1))))))/*,
|
||||
IsExportedType(pathModuleId, "First2", -1, -1)))))),
|
||||
Field(&SynchronizationPackage::updatedSourceIds,
|
||||
UnorderedElementsAre(qmlDocumentSourceId1, qmlDocumentSourceId2)),
|
||||
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
|
||||
UnorderedElementsAre(qmlDocumentSourceId2)),
|
||||
UnorderedElementsAre(directoryPathSourceId, qmlDocumentSourceId2)),
|
||||
Field(&SynchronizationPackage::fileStatuses,
|
||||
UnorderedElementsAre(IsFileStatus(qmlDocumentSourceId2, 22, 13))),
|
||||
UnorderedElementsAre(IsFileStatus(qmlDocumentSourceId2, 22, 13),
|
||||
IsFileStatus(directoryPathSourceId, 2, 421))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId)),
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(qmlDirPathSourceId,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(qmlDirPathSourceId,
|
||||
IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument)))*/)));
|
||||
FileType::QmlDocument))))));
|
||||
|
||||
updater.update(directories, {});
|
||||
}
|
||||
@@ -680,11 +690,11 @@ TEST_F(ProjectStorageUpdater, SynchronizeRemovesQmlDocument)
|
||||
.WillByDefault(Return(FileStatus{qmlDocumentSourceId2, 22, 2}));
|
||||
ON_CALL(fileSystemMock, fileStatus(Eq(qmlDocumentSourceId3)))
|
||||
.WillByDefault(Return(FileStatus{qmlDocumentSourceId3, -1, -1}));
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(qmlDirPathSourceId)))
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(directoryPathSourceId)))
|
||||
.WillByDefault(Return(QmlDesigner::Storage::Synchronization::ProjectDatas{
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument},
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId3, ModuleId{}, FileType::QmlDocument}}));
|
||||
{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId3, ModuleId{}, FileType::QmlDocument}}));
|
||||
ON_CALL(fileSystemMock, qmlFileNames(Eq(QString("/path"))))
|
||||
.WillByDefault(Return(QStringList{"First.qml", "First2.qml"}));
|
||||
|
||||
@@ -721,13 +731,13 @@ TEST_F(ProjectStorageUpdater, SynchronizeRemovesQmlDocument)
|
||||
Field(&SynchronizationPackage::fileStatuses,
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 21, 422))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId)),
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(qmlDirPathSourceId,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(qmlDirPathSourceId,
|
||||
IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -747,10 +757,10 @@ TEST_F(ProjectStorageUpdater, SynchronizeRemovesQmlDocumentInQmldirOnly)
|
||||
.WillByDefault(Return(FileStatus{qmlDocumentSourceId1, 22, 2}));
|
||||
ON_CALL(fileSystemMock, fileStatus(Eq(qmlDocumentSourceId2)))
|
||||
.WillByDefault(Return(FileStatus{qmlDocumentSourceId2, 22, 2}));
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(qmlDirPathSourceId)))
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(directoryPathSourceId)))
|
||||
.WillByDefault(Return(QmlDesigner::Storage::Synchronization::ProjectDatas{
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}}));
|
||||
{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}}));
|
||||
ON_CALL(fileSystemMock, qmlFileNames(Eq(QString("/path"))))
|
||||
.WillByDefault(Return(QStringList{"First.qml", "First2.qml"}));
|
||||
|
||||
@@ -782,13 +792,13 @@ TEST_F(ProjectStorageUpdater, SynchronizeRemovesQmlDocumentInQmldirOnly)
|
||||
Field(&SynchronizationPackage::fileStatuses,
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 21, 422))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId)),
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(qmlDirPathSourceId,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(qmlDirPathSourceId,
|
||||
IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -809,10 +819,10 @@ TEST_F(ProjectStorageUpdater, SynchronizeAddQmlDocumentToQmldir)
|
||||
.WillByDefault(Return(FileStatus{qmlDocumentSourceId1, 22, 2}));
|
||||
ON_CALL(fileSystemMock, fileStatus(Eq(qmlDocumentSourceId2)))
|
||||
.WillByDefault(Return(FileStatus{qmlDocumentSourceId2, 22, 2}));
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(qmlDirPathSourceId)))
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(directoryPathSourceId)))
|
||||
.WillByDefault(Return(QmlDesigner::Storage::Synchronization::ProjectDatas{
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}}));
|
||||
{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}}));
|
||||
ON_CALL(fileSystemMock, qmlFileNames(Eq(QString("/path"))))
|
||||
.WillByDefault(Return(QStringList{"First.qml", "First2.qml"}));
|
||||
|
||||
@@ -846,13 +856,13 @@ TEST_F(ProjectStorageUpdater, SynchronizeAddQmlDocumentToQmldir)
|
||||
Field(&SynchronizationPackage::fileStatuses,
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 21, 422))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId)),
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(qmlDirPathSourceId,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(qmlDirPathSourceId,
|
||||
IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -872,10 +882,10 @@ TEST_F(ProjectStorageUpdater, SynchronizeAddQmlDocumentToDirectory)
|
||||
.WillByDefault(Return(FileStatus{qmlDocumentSourceId1, 22, 2}));
|
||||
ON_CALL(fileSystemMock, fileStatus(Eq(qmlDocumentSourceId2)))
|
||||
.WillByDefault(Return(FileStatus{qmlDocumentSourceId2, 22, 2}));
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(qmlDirPathSourceId)))
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(directoryPathSourceId)))
|
||||
.WillByDefault(Return(QmlDesigner::Storage::Synchronization::ProjectDatas{
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}}));
|
||||
{directoryPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument}}));
|
||||
ON_CALL(fileSystemMock, qmlFileNames(Eq(QString("/path"))))
|
||||
.WillByDefault(Return(QStringList{"First.qml", "First2.qml"}));
|
||||
|
||||
@@ -907,13 +917,13 @@ TEST_F(ProjectStorageUpdater, SynchronizeAddQmlDocumentToDirectory)
|
||||
Field(&SynchronizationPackage::fileStatuses,
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 21, 422))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId)),
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(qmlDirPathSourceId,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(qmlDirPathSourceId,
|
||||
IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -974,12 +984,17 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsDontUpdateIfUpToDate)
|
||||
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId, qmlDocumentSourceId1, qmlDocumentSourceId2)),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId)),
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(
|
||||
IsProjectData(qmlDirPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument),
|
||||
IsProjectData(qmlDirPathSourceId, qmlDocumentSourceId2, ModuleId{}, FileType::QmlDocument),
|
||||
IsProjectData(qmlDirPathSourceId,
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId2,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument),
|
||||
IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId3,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
@@ -1002,10 +1017,10 @@ TEST_F(ProjectStorageUpdater, UpdateQmldirDocuments)
|
||||
|
||||
TEST_F(ProjectStorageUpdater, AddSourceIdForForInvalidDirectoryFileStatus)
|
||||
{
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(qmlDirPathSourceId)))
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(directoryPathSourceId)))
|
||||
.WillByDefault(Return(QmlDesigner::Storage::Synchronization::ProjectDatas{
|
||||
{qmlDirPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{qmlDirPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes}}));
|
||||
{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes}}));
|
||||
ON_CALL(fileSystemMock, fileStatus(Eq(directoryPathSourceId))).WillByDefault(Return(FileStatus{}));
|
||||
ON_CALL(fileSystemMock, fileStatus(Eq(qmlDirPathSourceId))).WillByDefault(Return(FileStatus{}));
|
||||
|
||||
@@ -1024,12 +1039,12 @@ TEST_F(ProjectStorageUpdater, AddSourceIdForForInvalidDirectoryFileStatus)
|
||||
|
||||
TEST_F(ProjectStorageUpdater, SynchronizIfQmldirFileHasNotChanged)
|
||||
{
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(qmlDirPathSourceId)))
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(directoryPathSourceId)))
|
||||
.WillByDefault(Return(QmlDesigner::Storage::Synchronization::ProjectDatas{
|
||||
{qmlDirPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{qmlDirPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId1, exampleModuleId, FileType::QmlDocument},
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId2, exampleModuleId, FileType::QmlDocument}}));
|
||||
{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmlDocumentSourceId1, exampleModuleId, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, exampleModuleId, FileType::QmlDocument}}));
|
||||
ON_CALL(projectStorageMock, fetchFileStatus(Eq(qmlDirPathSourceId)))
|
||||
.WillByDefault(Return(FileStatus{qmlDirPathSourceId, 21, 421}));
|
||||
|
||||
@@ -1076,12 +1091,12 @@ TEST_F(ProjectStorageUpdater, SynchronizIfQmldirFileHasNotChanged)
|
||||
|
||||
TEST_F(ProjectStorageUpdater, SynchronizIfQmldirFileHasNotChangedAndSomeUpdatedFiles)
|
||||
{
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(qmlDirPathSourceId)))
|
||||
ON_CALL(projectStorageMock, fetchProjectDatas(Eq(directoryPathSourceId)))
|
||||
.WillByDefault(Return(QmlDesigner::Storage::Synchronization::ProjectDatas{
|
||||
{qmlDirPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{qmlDirPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId1, exampleModuleId, FileType::QmlDocument},
|
||||
{qmlDirPathSourceId, qmlDocumentSourceId2, exampleModuleId, FileType::QmlDocument}}));
|
||||
{directoryPathSourceId, qmltypesPathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmltypes2PathSourceId, exampleModuleId, FileType::QmlTypes},
|
||||
{directoryPathSourceId, qmlDocumentSourceId1, exampleModuleId, FileType::QmlDocument},
|
||||
{directoryPathSourceId, qmlDocumentSourceId2, exampleModuleId, FileType::QmlDocument}}));
|
||||
ON_CALL(projectStorageMock, fetchFileStatus(Eq(qmlDirPathSourceId)))
|
||||
.WillByDefault(Return(FileStatus{qmlDirPathSourceId, 21, 421}));
|
||||
ON_CALL(projectStorageMock, fetchFileStatus(Eq(qmltypes2PathSourceId)))
|
||||
@@ -1191,10 +1206,9 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsWithDifferentVersionButSame
|
||||
ON_CALL(fileSystemMock, qmlFileNames(Eq(QString("/path"))))
|
||||
.WillByDefault(Return(QStringList{"First.qml"}));
|
||||
|
||||
EXPECT_CALL(
|
||||
projectStorageMock,
|
||||
synchronize(AllOf(
|
||||
Field(&SynchronizationPackage::imports, UnorderedElementsAre(import1)),
|
||||
EXPECT_CALL(projectStorageMock,
|
||||
synchronize(
|
||||
AllOf(Field(&SynchronizationPackage::imports, UnorderedElementsAre(import1)),
|
||||
Field(&SynchronizationPackage::types,
|
||||
UnorderedElementsAre(AllOf(
|
||||
IsStorageType("First.qml",
|
||||
@@ -1203,7 +1217,8 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsWithDifferentVersionButSame
|
||||
qmlDocumentSourceId1,
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(exampleModuleId, "FirstType", 1, 0),
|
||||
UnorderedElementsAre(
|
||||
IsExportedType(exampleModuleId, "FirstType", 1, 0),
|
||||
IsExportedType(exampleModuleId, "FirstType", 1, 1),
|
||||
IsExportedType(exampleModuleId, "FirstType", 6, 0),
|
||||
IsExportedType(pathModuleId, "First", -1, -1)))))),
|
||||
@@ -1215,10 +1230,12 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsWithDifferentVersionButSame
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 21, 421),
|
||||
IsFileStatus(qmlDocumentSourceId1, 22, 12))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId)),
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(
|
||||
qmlDirPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument))))));
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
|
||||
updater.update(directories, {});
|
||||
}
|
||||
@@ -1232,10 +1249,9 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsWithDifferentTypeNameButSam
|
||||
ON_CALL(fileSystemMock, qmlFileNames(Eq(QString("/path"))))
|
||||
.WillByDefault(Return(QStringList{"First.qml"}));
|
||||
|
||||
EXPECT_CALL(
|
||||
projectStorageMock,
|
||||
synchronize(AllOf(
|
||||
Field(&SynchronizationPackage::imports, UnorderedElementsAre(import1)),
|
||||
EXPECT_CALL(projectStorageMock,
|
||||
synchronize(
|
||||
AllOf(Field(&SynchronizationPackage::imports, UnorderedElementsAre(import1)),
|
||||
Field(&SynchronizationPackage::types,
|
||||
UnorderedElementsAre(AllOf(
|
||||
IsStorageType("First.qml",
|
||||
@@ -1244,7 +1260,8 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsWithDifferentTypeNameButSam
|
||||
qmlDocumentSourceId1,
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(exampleModuleId, "FirstType", 1, 0),
|
||||
UnorderedElementsAre(
|
||||
IsExportedType(exampleModuleId, "FirstType", 1, 0),
|
||||
IsExportedType(exampleModuleId, "FirstType2", 1, 0),
|
||||
IsExportedType(pathModuleId, "First", -1, -1)))))),
|
||||
Field(&SynchronizationPackage::updatedSourceIds,
|
||||
@@ -1255,10 +1272,12 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsWithDifferentTypeNameButSam
|
||||
UnorderedElementsAre(IsFileStatus(qmlDirPathSourceId, 21, 421),
|
||||
IsFileStatus(qmlDocumentSourceId1, 22, 12))),
|
||||
Field(&SynchronizationPackage::updatedProjectSourceIds,
|
||||
UnorderedElementsAre(qmlDirPathSourceId)),
|
||||
UnorderedElementsAre(directoryPathSourceId)),
|
||||
Field(&SynchronizationPackage::projectDatas,
|
||||
UnorderedElementsAre(IsProjectData(
|
||||
qmlDirPathSourceId, qmlDocumentSourceId1, ModuleId{}, FileType::QmlDocument))))));
|
||||
UnorderedElementsAre(IsProjectData(directoryPathSourceId,
|
||||
qmlDocumentSourceId1,
|
||||
ModuleId{},
|
||||
FileType::QmlDocument))))));
|
||||
|
||||
updater.update(directories, {});
|
||||
}
|
||||
|
Reference in New Issue
Block a user