QmlDesigner: Use C++ 20 designated initializer for update

It makes it easier to add new arguments without breaking the tests.

Change-Id: Id03053ac17e4da26a2abf2a23e6cc20848ed9af5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2024-07-31 15:32:49 +02:00
parent e3a062837d
commit 3fd89a31bc
4 changed files with 100 additions and 91 deletions

View File

@@ -260,11 +260,13 @@ std::vector<IdPaths> createIdPaths(ProjectStorageUpdater::WatchedSourceIdsIds wa
} // namespace
void ProjectStorageUpdater::update(QStringList directories,
QStringList qmlTypesPaths,
const QString &propertyEditorResourcesPath,
const QStringList &typeAnnotationPaths)
void ProjectStorageUpdater::update(Update update)
{
QStringList directories = std::move(update.directories);
QStringList qmlTypesPaths = std::move(update.qmlTypesPaths);
const QString &propertyEditorResourcesPath = update.propertyEditorResourcesPath;
const QStringList &typeAnnotationPaths = update.typeAnnotationPaths;
NanotraceHR::Tracer tracer{"update"_t,
category(),
keyValue("directories", directories),

View File

@@ -59,10 +59,15 @@ public:
, m_projectPartId{projectPartId}
{}
void update(QStringList directories,
QStringList qmlTypesPaths,
const QString &propertyEditorResourcesPath,
const QStringList &typeAnnotationPaths);
struct Update
{
QStringList directories = {};
QStringList qmlTypesPaths = {};
const QString propertyEditorResourcesPath = {};
const QStringList typeAnnotationPaths = {};
};
void update(Update update);
void pathsWithIdsChanged(const std::vector<IdPaths> &idPaths) override;
void pathsChanged(const SourceIds &filePathIds) override;

View File

@@ -586,15 +586,15 @@ void QmlDesignerProjectManager::update()
return;
if constexpr (isUsingQmlDesignerLite()) {
m_projectData->projectStorageData->updater.update(directoriesForLiteDesigner(),
m_projectData->projectStorageData->updater.update({directoriesForLiteDesigner(),
qmlTypesForLiteDesigner(),
propertyEditorResourcesPath(),
{qtCreatorItemLibraryPath()});
{qtCreatorItemLibraryPath()}});
} else {
m_projectData->projectStorageData->updater.update(directories(m_projectData->activeTarget),
m_projectData->projectStorageData->updater.update({directories(m_projectData->activeTarget),
qmlTypes(m_projectData->activeTarget),
propertyEditorResourcesPath(),
{qtCreatorItemLibraryPath()});
{qtCreatorItemLibraryPath()}});
}
}

View File

@@ -440,7 +440,7 @@ TEST_F(ProjectStorageUpdater, get_content_for_qml_dir_paths_if_file_status_is_di
EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/one/qmldir"))));
EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/two/qmldir"))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater,
@@ -458,7 +458,7 @@ TEST_F(ProjectStorageUpdater,
EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/one/qmldir"))));
EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/two/qmldir"))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, request_file_status_from_file_system)
@@ -467,7 +467,7 @@ TEST_F(ProjectStorageUpdater, request_file_status_from_file_system)
EXPECT_CALL(fileSystemMock, fileStatus(Eq(directoryPathSourceId)));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, request_file_status_from_file_system_for_subdirectories)
@@ -481,7 +481,7 @@ TEST_F(ProjectStorageUpdater, request_file_status_from_file_system_for_subdirect
EXPECT_CALL(fileSystemMock, fileStatus(Eq(path2SourceId)));
EXPECT_CALL(fileSystemMock, fileStatus(Eq(directoryPathSourceId)));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, get_content_for_qml_types)
@@ -493,7 +493,7 @@ TEST_F(ProjectStorageUpdater, get_content_for_qml_types)
EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/example.qmltypes"))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, get_content_for_qml_types_if_project_storage_file_status_is_invalid)
@@ -506,7 +506,7 @@ TEST_F(ProjectStorageUpdater, get_content_for_qml_types_if_project_storage_file_
EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/example.qmltypes"))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, parse_qml_types)
@@ -525,7 +525,7 @@ TEST_F(ProjectStorageUpdater, parse_qml_types)
EXPECT_CALL(qmlTypesParserMock,
parse(qmltypes2, _, _, Field(&DirectoryInfo::moduleId, exampleCppNativeModuleId)));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, parse_qml_types_in_subdirectories)
@@ -546,7 +546,7 @@ TEST_F(ProjectStorageUpdater, parse_qml_types_in_subdirectories)
EXPECT_CALL(qmlTypesParserMock,
parse(qmltypes2, _, _, Field(&DirectoryInfo::moduleId, exampleCppNativeModuleId)));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_is_empty_for_no_change)
@@ -555,7 +555,7 @@ TEST_F(ProjectStorageUpdater, synchronize_is_empty_for_no_change)
EXPECT_CALL(projectStorageMock, synchronize(PackageIsEmpty()));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_is_empty_for_no_change_in_subdirectory)
@@ -572,7 +572,7 @@ TEST_F(ProjectStorageUpdater, synchronize_is_empty_for_no_change_in_subdirectory
EXPECT_CALL(projectStorageMock, synchronize(PackageIsEmpty()));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qml_types)
@@ -607,7 +607,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_types)
Field(&SynchronizationPackage::updatedDirectoryInfoSourceIds,
UnorderedElementsAre(directoryPathSourceId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_subdircectories)
@@ -630,7 +630,7 @@ TEST_F(ProjectStorageUpdater, synchronize_subdircectories)
UnorderedElementsAre(
rootDirectoryPathSourceId, path1SourceId, path2SourceId, path3SourceId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_subdircectories_even_for_no_changes)
@@ -650,7 +650,7 @@ TEST_F(ProjectStorageUpdater, synchronize_subdircectories_even_for_no_changes)
Field(&SynchronizationPackage::updatedDirectoryInfoSourceIds,
UnorderedElementsAre(path1SourceId, path2SourceId, path3SourceId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_subdircectories_for_deleted_subdirecties)
@@ -678,7 +678,7 @@ TEST_F(ProjectStorageUpdater, synchronize_subdircectories_for_deleted_subdirecti
path2SourceId,
path3SourceId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qml_types_throws_if_qmltpes_does_not_exists)
@@ -686,7 +686,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_types_throws_if_qmltpes_does_not_e
Storage::Import import{qmlModuleId, Storage::Version{2, 3}, qmltypesPathSourceId};
setFilesDontExists({qmltypesPathSourceId});
ASSERT_THROW(updater.update(directories, {}, {}, {}), QmlDesigner::CannotParseQmlTypesFile);
ASSERT_THROW(updater.update({.directories = directories}), QmlDesigner::CannotParseQmlTypesFile);
}
TEST_F(ProjectStorageUpdater, synchronize_qml_types_are_empty_if_file_does_not_changed)
@@ -699,7 +699,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_types_are_empty_if_file_does_not_c
EXPECT_CALL(projectStorageMock, synchronize(PackageIsEmpty()));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, get_content_for_qml_documents)
@@ -720,7 +720,7 @@ TEST_F(ProjectStorageUpdater, get_content_for_qml_documents)
EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/OldSecond.qml"))));
EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/Second.qml"))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, parse_qml_documents)
@@ -741,7 +741,7 @@ TEST_F(ProjectStorageUpdater, parse_qml_documents)
EXPECT_CALL(qmlDocumentParserMock, parse(qmlDocument2, _, _, _));
EXPECT_CALL(qmlDocumentParserMock, parse(qmlDocument3, _, _, _));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, parse_qml_documents_with_non_existing_qml_document_throws)
@@ -750,7 +750,8 @@ TEST_F(ProjectStorageUpdater, parse_qml_documents_with_non_existing_qml_document
NonexitingType 1.0 NonexitingType.qml)"};
setContent(u"/path/qmldir", qmldir);
ASSERT_THROW(updater.update(directories, {}, {}, {}), QmlDesigner::CannotParseQmlDocumentFile);
ASSERT_THROW(updater.update({.directories = directories}),
QmlDesigner::CannotParseQmlDocumentFile);
}
TEST_F(ProjectStorageUpdater, synchronize_qml_documents)
@@ -823,7 +824,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents)
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_add_only_qml_document_in_directory)
@@ -879,7 +880,7 @@ TEST_F(ProjectStorageUpdater, synchronize_add_only_qml_document_in_directory)
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document)
@@ -943,7 +944,7 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document)
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document_in_qmldir_only)
@@ -998,7 +999,7 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document_in_qmldir_only)
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_add_qml_document_to_qmldir)
@@ -1056,7 +1057,7 @@ TEST_F(ProjectStorageUpdater, synchronize_add_qml_document_to_qmldir)
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_remove_qml_document_from_qmldir)
@@ -1111,7 +1112,7 @@ TEST_F(ProjectStorageUpdater, synchronize_remove_qml_document_from_qmldir)
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qml_documents_dont_update_if_up_to_date)
@@ -1181,7 +1182,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_dont_update_if_up_to_dat
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed)
@@ -1232,7 +1233,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed)
qmlDocumentSourceId2)),
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed_and_some_updated_files)
@@ -1267,7 +1268,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed_and_some
UnorderedElementsAre(qmltypesPathSourceId, qmlDocumentSourceId1)),
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_not_changed_and_some_removed_files)
@@ -1282,7 +1283,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_not_changed_and_some_rem
setFilesDontChanged({qmlDirPathSourceId, qmltypes2PathSourceId, qmlDocumentSourceId2});
setFilesRemoved({qmltypesPathSourceId, qmlDocumentSourceId1});
ASSERT_THROW(updater.update(directories, {}, {}, {}), QmlDesigner::CannotParseQmlTypesFile);
ASSERT_THROW(updater.update({.directories = directories}), QmlDesigner::CannotParseQmlTypesFile);
}
TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_changed_and_some_removed_files)
@@ -1334,7 +1335,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_changed_and_some_rem
exampleCppNativeModuleId,
FileType::QmlTypes))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, update_qml_types_files_is_empty)
@@ -1349,7 +1350,7 @@ TEST_F(ProjectStorageUpdater, update_qml_types_files_is_empty)
Field(&SynchronizationPackage::directoryInfos, IsEmpty()),
Field(&SynchronizationPackage::updatedDirectoryInfoSourceIds, IsEmpty()))));
updater.update({}, {}, {}, {});
updater.update({});
}
TEST_F(ProjectStorageUpdater, update_qml_types_files)
@@ -1377,7 +1378,7 @@ TEST_F(ProjectStorageUpdater, update_qml_types_files)
Field(&SynchronizationPackage::updatedDirectoryInfoSourceIds,
UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId)))));
updater.update({}, {"/path/example.qmltypes", "/path/example2.qmltypes"}, {}, {});
updater.update({.qmlTypesPaths = {"/path/example.qmltypes", "/path/example2.qmltypes"}});
}
TEST_F(ProjectStorageUpdater, dont_update_qml_types_files_if_unchanged)
@@ -1402,7 +1403,7 @@ TEST_F(ProjectStorageUpdater, dont_update_qml_types_files_if_unchanged)
Field(&SynchronizationPackage::updatedDirectoryInfoSourceIds,
UnorderedElementsAre(qmltypesPathSourceId)))));
updater.update({}, {"/path/example.qmltypes", "/path/example2.qmltypes"}, {}, {});
updater.update({.qmlTypesPaths = {"/path/example.qmltypes", "/path/example2.qmltypes"}});
}
TEST_F(ProjectStorageUpdater, synchronize_qml_documents_with_different_version_but_same_type_name_and_file_name)
@@ -1445,7 +1446,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_with_different_version_b
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qml_documents_with_different_type_name_but_same_version_and_file_name)
@@ -1486,7 +1487,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_with_different_type_name
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, dont_synchronize_selectors)
@@ -1504,7 +1505,7 @@ TEST_F(ProjectStorageUpdater, dont_synchronize_selectors)
Contains(Field(&Storage::Synchronization::Type::exportedTypes,
Contains(IsExportedType(exampleModuleId, "FirstType", 1, 0))))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies)
@@ -1529,7 +1530,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies)
Field(&SynchronizationPackage::updatedModuleDependencySourceIds,
UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies_with_double_entries)
@@ -1555,7 +1556,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies_with_double_entrie
Field(&SynchronizationPackage::updatedModuleDependencySourceIds,
UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies_with_colliding_imports)
@@ -1581,7 +1582,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies_with_colliding_imp
Field(&SynchronizationPackage::updatedModuleDependencySourceIds,
UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qmldir_with_no_dependencies)
@@ -1598,7 +1599,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_with_no_dependencies)
Field(&SynchronizationPackage::updatedModuleDependencySourceIds,
UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qmldir_imports)
@@ -1640,7 +1641,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_imports)
Field(&SynchronizationPackage::updatedModuleIds,
ElementsAre(exampleModuleId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qmldir_with_no_imports)
@@ -1654,7 +1655,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_with_no_imports)
Field(&SynchronizationPackage::updatedModuleIds,
ElementsAre(exampleModuleId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qmldir_imports_with_double_entries)
@@ -1697,7 +1698,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_imports_with_double_entries)
Field(&SynchronizationPackage::updatedModuleIds,
ElementsAre(exampleModuleId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qmldir_default_imports)
@@ -1739,7 +1740,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_default_imports)
Field(&SynchronizationPackage::updatedModuleIds,
ElementsAre(exampleModuleId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, do_not_synchronize_qmldir_optional_imports)
@@ -1773,7 +1774,7 @@ TEST_F(ProjectStorageUpdater, do_not_synchronize_qmldir_optional_imports)
Field(&SynchronizationPackage::updatedModuleIds,
ElementsAre(exampleModuleId)))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_directories)
@@ -1783,7 +1784,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_directories)
QmlDesigner::SourceType::Directory,
{path1SourceId, path2SourceId, path3SourceId}})));
updater.update(directories3, {}, {}, {});
updater.update({.directories = directories3});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_directory_does_not_exists)
@@ -1795,7 +1796,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_directory_does_not_exists)
QmlDesigner::SourceType::Directory,
{path1SourceId, path3SourceId}})));
updater.update(directories3, {}, {}, {});
updater.update({.directories = directories3});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_directory_does_not_changed)
@@ -1807,7 +1808,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_directory_does_not_changed)
QmlDesigner::SourceType::Directory,
{path1SourceId, path2SourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_directory_removed)
@@ -1818,7 +1819,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_directory_removed)
updateIdPaths(Contains(
IdPaths{projectPartId, QmlDesigner::SourceType::Directory, {path2SourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_qmldirs)
@@ -1828,7 +1829,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmldirs)
QmlDesigner::SourceType::QmlDir,
{qmldir1SourceId, qmldir2SourceId, qmldir3SourceId}})));
updater.update(directories3, {}, {}, {});
updater.update({.directories = directories3});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_does_not_exists)
@@ -1840,7 +1841,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_does_not_exists)
QmlDesigner::SourceType::QmlDir,
{qmldir1SourceId, qmldir3SourceId}})));
updater.update(directories3, {}, {}, {});
updater.update({.directories = directories3});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_does_not_changed)
@@ -1852,7 +1853,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_does_not_changed)
QmlDesigner::SourceType::QmlDir,
{qmldir1SourceId, qmldir2SourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_removed)
@@ -1863,7 +1864,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_removed)
updateIdPaths(Contains(
IdPaths{projectPartId, QmlDesigner::SourceType::QmlDir, {qmldir2SourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_qml_files)
@@ -1880,7 +1881,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qml_files)
QmlDesigner::SourceType::Qml,
{firstSourceId, secondSourceId, thirdSourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_only_qml_files_dont_changed)
@@ -1898,7 +1899,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qml_files_dont_changed)
QmlDesigner::SourceType::Qml,
{firstSourceId, secondSourceId, thirdSourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_only_qml_files_changed)
@@ -1916,7 +1917,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qml_files_changed)
QmlDesigner::SourceType::Qml,
{firstSourceId, secondSourceId, thirdSourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_qml_files_and_directories_dont_changed)
@@ -1939,7 +1940,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qml_files_and_directories_dont
QmlDesigner::SourceType::Qml,
{firstSourceId, secondSourceId, thirdSourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_qmltypes_files_in_qmldir)
@@ -1958,7 +1959,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmltypes_files_in_qmldir)
QmlDesigner::SourceType::QmlTypes,
{qmltypes1SourceId, qmltypes2SourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_only_qmltypes_files_in_qmldir_dont_changed)
@@ -1976,7 +1977,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qmltypes_files_in_qmldir_
QmlDesigner::SourceType::QmlTypes,
{qmltypes1SourceId, qmltypes2SourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_only_qmltypes_files_changed)
@@ -1993,7 +1994,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qmltypes_files_changed)
QmlDesigner::SourceType::QmlTypes,
{qmltypes1SourceId, qmltypes2SourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_qmltypes_files_and_directories_dont_changed)
@@ -2014,7 +2015,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmltypes_files_and_directories
QmlDesigner::SourceType::QmlTypes,
{qmltypes1SourceId, qmltypes2SourceId}})));
updater.update(directories2, {}, {}, {});
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_builtin_qmltypes_files)
@@ -2029,7 +2030,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_builtin_qmltypes_files)
QmlDesigner::SourceType::QmlTypes,
{qmltypes1SourceId, qmltypes2SourceId}})));
updater.update({}, {builtinQmltyplesPath1, builtinQmltyplesPath2}, {}, {});
updater.update({{}, {builtinQmltyplesPath1, builtinQmltyplesPath2}, {}, {}});
}
TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir)
@@ -2096,7 +2097,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir)
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_throws_if_qml_document_does_not_exists)
@@ -2104,7 +2105,8 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_throws_if
setFilesDontExists({qmlDirPathSourceId, qmlDocumentSourceId1});
setFilesAdded({directoryPathSourceId});
ASSERT_THROW(updater.update(directories, {}, {}, {}), QmlDesigner::CannotParseQmlDocumentFile);
ASSERT_THROW(updater.update({.directories = directories}),
QmlDesigner::CannotParseQmlDocumentFile);
}
TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_throws_if_directory_does_not_exists)
@@ -2135,7 +2137,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_throws_if
UnorderedElementsAre(directoryPathSourceId)),
Field(&SynchronizationPackage::directoryInfos, IsEmpty()))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_add_qml_document)
@@ -2184,7 +2186,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_add_qml_d
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_removes_qml_document)
@@ -2224,7 +2226,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_removes_q
ModuleId{},
FileType::QmlDocument))))));
updater.update(directories, {}, {}, {});
updater.update({.directories = directories});
}
TEST_F(ProjectStorageUpdater, watcher_updates_directories)
@@ -3753,7 +3755,7 @@ TEST_F(ProjectStorageUpdater, update_property_editor_panes)
Field(&SynchronizationPackage::updatedPropertyEditorQmlPathSourceIds,
ElementsAre(directoryId)))));
updater.update({}, {}, propertyEditorQmlPath, {});
updater.update({.propertyEditorResourcesPath = propertyEditorQmlPath});
}
TEST_F(ProjectStorageUpdater, update_property_editor_specifics)
@@ -3785,12 +3787,12 @@ TEST_F(ProjectStorageUpdater, update_property_editor_specifics)
Field(&SynchronizationPackage::updatedPropertyEditorQmlPathSourceIds,
ElementsAre(qtQuickDirectoryId, controlsDirectoryId)))));
updater.update({}, {}, propertyEditorQmlPath, {});
updater.update({.propertyEditorResourcesPath = propertyEditorQmlPath});
}
TEST_F(ProjectStorageUpdater, update_property_editor_panes_is_empty_if_directory_has_not_changed)
{
updater.update({}, {}, propertyEditorQmlPath, {});
updater.update({{}, {}, propertyEditorQmlPath, {}});
ON_CALL(fileSystemMock, fileStatus(_)).WillByDefault([](SourceId sourceId) {
return FileStatus{sourceId, 1, 21};
});
@@ -3800,7 +3802,7 @@ TEST_F(ProjectStorageUpdater, update_property_editor_panes_is_empty_if_directory
EXPECT_CALL(projectStorageMock, synchronize(PackageIsEmpty()));
updater.update({}, {}, propertyEditorQmlPath, {});
updater.update({.propertyEditorResourcesPath = propertyEditorQmlPath});
}
TEST_F(ProjectStorageUpdater, update_type_annotations)
@@ -3836,7 +3838,7 @@ TEST_F(ProjectStorageUpdater, update_type_annotations)
Field(&SynchronizationPackage::updatedTypeAnnotationSourceIds,
IsSupersetOf({itemSourceId, buttonSourceId})))));
updater.update({}, {}, {}, {itemLibraryPath});
updater.update({.typeAnnotationPaths = {itemLibraryPath}});
}
TEST_F(ProjectStorageUpdater, update_changed_type_annotation)
@@ -3873,7 +3875,7 @@ TEST_F(ProjectStorageUpdater, update_changed_type_annotation)
Field(&SynchronizationPackage::updatedTypeAnnotationSourceIds,
IsSupersetOf({itemSourceId, buttonSourceId})))));
updater.update({}, {}, {}, {itemLibraryPath});
updater.update({.typeAnnotationPaths = {itemLibraryPath}});
}
TEST_F(ProjectStorageUpdater, update_type_annotations_removed_meta_info_file)
@@ -3900,7 +3902,7 @@ TEST_F(ProjectStorageUpdater, update_type_annotations_removed_meta_info_file)
Field(&SynchronizationPackage::updatedTypeAnnotationSourceIds,
IsSupersetOf({itemSourceId, buttonSourceId})))));
updater.update({}, {}, {}, {itemLibraryPath});
updater.update({.typeAnnotationPaths = {itemLibraryPath}});
}
TEST_F(ProjectStorageUpdater, update_type_annotations_removed_directory)
@@ -3928,7 +3930,7 @@ TEST_F(ProjectStorageUpdater, update_type_annotations_removed_directory)
Field(&SynchronizationPackage::updatedTypeAnnotationSourceIds,
IsSupersetOf({buttonSourceId, itemSourceId})))));
updater.update({}, {}, {}, {itemLibraryPath});
updater.update({.typeAnnotationPaths = {itemLibraryPath}});
}
} // namespace