forked from qt-creator/qt-creator
QmlDesigner: Rename SourceName and SourceContext into FileName and DirectoryPath
Change-Id: I7851b7f065498e4d21f2ea3c68fe46c135949291 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -11,8 +11,8 @@ enum class ProjectStorageIdType {
|
|||||||
Type,
|
Type,
|
||||||
PropertyType,
|
PropertyType,
|
||||||
PropertyDeclaration,
|
PropertyDeclaration,
|
||||||
SourceName,
|
FileName,
|
||||||
SourceContext,
|
DirectoryPath,
|
||||||
StorageCacheIndex,
|
StorageCacheIndex,
|
||||||
FunctionDeclaration,
|
FunctionDeclaration,
|
||||||
SignalDeclaration,
|
SignalDeclaration,
|
||||||
|
@@ -12,22 +12,22 @@
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
enum class SourcePathIdType {
|
enum class SourcePathIdType {
|
||||||
SourceName,
|
FileName,
|
||||||
SourceContext,
|
DirectoryPath,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using SourceContextId = Sqlite::BasicId<SourcePathIdType::SourceContext, int>;
|
using DirectoryPathId = Sqlite::BasicId<SourcePathIdType::DirectoryPath, int>;
|
||||||
using SourceContextIds = std::vector<SourceContextId>;
|
using DirectoryPathIds = std::vector<DirectoryPathId>;
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
using SmallSourceContextIds = QVarLengthArray<SourceContextId, size>;
|
using SmallDirectoryPathIds = QVarLengthArray<DirectoryPathId, size>;
|
||||||
|
|
||||||
using SourceNameId = Sqlite::BasicId<SourcePathIdType::SourceName, int>;
|
using FileNameId = Sqlite::BasicId<SourcePathIdType::FileName, int>;
|
||||||
using SourceNameIds = std::vector<SourceNameId>;
|
using FileNameIds = std::vector<FileNameId>;
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
using SmallSourceNameIds = QVarLengthArray<SourceNameId, size>;
|
using SmallFileNameIds = QVarLengthArray<FileNameId, size>;
|
||||||
|
|
||||||
using SourceId = Sqlite::CompoundBasicId<SourcePathIdType::SourceName, SourcePathIdType::SourceContext>;
|
using SourceId = Sqlite::CompoundBasicId<SourcePathIdType::FileName, SourcePathIdType::DirectoryPath>;
|
||||||
using SourceIds = std::vector<SourceId>;
|
using SourceIds = std::vector<SourceId>;
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
using SmallSourceIds = QVarLengthArray<SourceId, size>;
|
using SmallSourceIds = QVarLengthArray<SourceId, size>;
|
||||||
|
@@ -22,26 +22,26 @@ public:
|
|||||||
|
|
||||||
~DirectoryPathCompressor() = default;
|
~DirectoryPathCompressor() = default;
|
||||||
|
|
||||||
void addSourceContextId(SourceContextId sourceContextId)
|
void addDirectoryPathId(DirectoryPathId directoryPathId)
|
||||||
{
|
{
|
||||||
auto found = std::ranges::lower_bound(m_sourceContextIds, sourceContextId);
|
auto found = std::ranges::lower_bound(m_directoryPathIds, directoryPathId);
|
||||||
|
|
||||||
if (found == m_sourceContextIds.end() || *found != sourceContextId)
|
if (found == m_directoryPathIds.end() || *found != directoryPathId)
|
||||||
m_sourceContextIds.insert(found, sourceContextId);
|
m_directoryPathIds.insert(found, directoryPathId);
|
||||||
|
|
||||||
restartTimer();
|
restartTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
const SourceContextIds &sourceContextIds() { return m_sourceContextIds; }
|
const DirectoryPathIds &directoryPathIds() { return m_directoryPathIds; }
|
||||||
|
|
||||||
virtual void setCallback(std::function<void(const QmlDesigner::SourceContextIds &)> &&callback)
|
virtual void setCallback(std::function<void(const QmlDesigner::DirectoryPathIds &)> &&callback)
|
||||||
{
|
{
|
||||||
if (connection)
|
if (connection)
|
||||||
QObject::disconnect(connection);
|
QObject::disconnect(connection);
|
||||||
connection = QObject::connect(&m_timer, &Timer::timeout, [this, callback = std::move(callback)] {
|
connection = QObject::connect(&m_timer, &Timer::timeout, [this, callback = std::move(callback)] {
|
||||||
try {
|
try {
|
||||||
callback(m_sourceContextIds);
|
callback(m_directoryPathIds);
|
||||||
m_sourceContextIds.clear();
|
m_directoryPathIds.clear();
|
||||||
} catch (const std::exception &) {
|
} catch (const std::exception &) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -70,7 +70,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SourceContextIds m_sourceContextIds;
|
DirectoryPathIds m_directoryPathIds;
|
||||||
QMetaObject::Connection connection;
|
QMetaObject::Connection connection;
|
||||||
ConnectionGuard connectionGuard{connection};
|
ConnectionGuard connectionGuard{connection};
|
||||||
Timer m_timer;
|
Timer m_timer;
|
||||||
|
@@ -51,7 +51,7 @@ long long FileSystem::lastModified(SourceId sourceId) const
|
|||||||
FileStatus FileSystem::fileStatus(SourceId sourceId) const
|
FileStatus FileSystem::fileStatus(SourceId sourceId) const
|
||||||
{
|
{
|
||||||
auto path = sourceId.mainId() ? m_sourcePathCache.sourcePath(sourceId)
|
auto path = sourceId.mainId() ? m_sourcePathCache.sourcePath(sourceId)
|
||||||
: m_sourcePathCache.sourceContextPath(sourceId.contextId());
|
: m_sourcePathCache.directoryPath(sourceId.contextId());
|
||||||
QFileInfo fileInfo(QString{path});
|
QFileInfo fileInfo(QString{path});
|
||||||
|
|
||||||
fileInfo.refresh();
|
fileInfo.refresh();
|
||||||
|
@@ -1762,7 +1762,7 @@ Storage::Info::TypeHints ProjectStorage::typeHints(TypeId typeId) const
|
|||||||
return typeHints;
|
return typeHints;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallSourceIds<4> ProjectStorage::typeAnnotationSourceIds(SourceContextId directoryId) const
|
SmallSourceIds<4> ProjectStorage::typeAnnotationSourceIds(DirectoryPathId directoryId) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"get type annotaion source ids",
|
NanotraceHR::Tracer tracer{"get type annotaion source ids",
|
||||||
@@ -1777,13 +1777,13 @@ SmallSourceIds<4> ProjectStorage::typeAnnotationSourceIds(SourceContextId direct
|
|||||||
return sourceIds;
|
return sourceIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallSourceContextIds<64> ProjectStorage::typeAnnotationDirectoryIds() const
|
SmallDirectoryPathIds<64> ProjectStorage::typeAnnotationDirectoryIds() const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"get type annotaion source ids", projectStorageCategory()};
|
NanotraceHR::Tracer tracer{"get type annotaion source ids", projectStorageCategory()};
|
||||||
|
|
||||||
auto sourceIds = s->selectTypeAnnotationDirectoryIdsStatement
|
auto sourceIds = s->selectTypeAnnotationDirectoryIdsStatement
|
||||||
.valuesWithTransaction<SmallSourceContextIds<64>>();
|
.valuesWithTransaction<SmallDirectoryPathIds<64>>();
|
||||||
|
|
||||||
tracer.end(keyValue("source ids", sourceIds));
|
tracer.end(keyValue("source ids", sourceIds));
|
||||||
|
|
||||||
@@ -2226,7 +2226,7 @@ std::optional<Storage::Synchronization::DirectoryInfo> ProjectStorage::fetchDire
|
|||||||
return directoryInfo;
|
return directoryInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(SourceContextId directoryId) const
|
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(DirectoryPathId directoryId) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch directory infos by directory id",
|
NanotraceHR::Tracer tracer{"fetch directory infos by directory id",
|
||||||
@@ -2243,7 +2243,7 @@ Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(Sou
|
|||||||
}
|
}
|
||||||
|
|
||||||
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
||||||
SourceContextId directoryId, Storage::Synchronization::FileType fileType) const
|
DirectoryPathId directoryId, Storage::Synchronization::FileType fileType) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch directory infos by source id and file type",
|
NanotraceHR::Tracer tracer{"fetch directory infos by source id and file type",
|
||||||
@@ -2261,7 +2261,7 @@ Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
||||||
const SourceContextIds &directoryIds) const
|
const DirectoryPathIds &directoryIds) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch directory infos by source ids",
|
NanotraceHR::Tracer tracer{"fetch directory infos by source ids",
|
||||||
@@ -2277,7 +2277,7 @@ Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
|||||||
return directoryInfos;
|
return directoryInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallSourceContextIds<32> ProjectStorage::fetchSubdirectoryIds(SourceContextId directoryId) const
|
SmallDirectoryPathIds<32> ProjectStorage::fetchSubdirectoryIds(DirectoryPathId directoryId) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch subdirectory source ids",
|
NanotraceHR::Tracer tracer{"fetch subdirectory source ids",
|
||||||
@@ -2288,7 +2288,7 @@ SmallSourceContextIds<32> ProjectStorage::fetchSubdirectoryIds(SourceContextId d
|
|||||||
.rangeWithTransaction<SourceId>(directoryId,
|
.rangeWithTransaction<SourceId>(directoryId,
|
||||||
Storage::Synchronization::FileType::Directory);
|
Storage::Synchronization::FileType::Directory);
|
||||||
|
|
||||||
SmallSourceContextIds<32> directoryIds;
|
SmallDirectoryPathIds<32> directoryIds;
|
||||||
for (SourceId sourceId : sourceIds)
|
for (SourceId sourceId : sourceIds)
|
||||||
directoryIds.push_back(sourceId.contextId());
|
directoryIds.push_back(sourceId.contextId());
|
||||||
|
|
||||||
@@ -2609,7 +2609,7 @@ void ProjectStorage::synchronizeTypes(Storage::Synchronization::Types &types,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProjectStorage::synchronizeDirectoryInfos(Storage::Synchronization::DirectoryInfos &directoryInfos,
|
void ProjectStorage::synchronizeDirectoryInfos(Storage::Synchronization::DirectoryInfos &directoryInfos,
|
||||||
const SourceContextIds &updatedDirectoryInfoDirectoryIds)
|
const DirectoryPathIds &updatedDirectoryInfoDirectoryIds)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"synchronize directory infos", projectStorageCategory()};
|
NanotraceHR::Tracer tracer{"synchronize directory infos", projectStorageCategory()};
|
||||||
|
|
||||||
@@ -4057,13 +4057,13 @@ void ProjectStorage::addTypeIdToPropertyEditorQmlPaths(
|
|||||||
|
|
||||||
void ProjectStorage::synchronizePropertyEditorPaths(
|
void ProjectStorage::synchronizePropertyEditorPaths(
|
||||||
Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
||||||
SourceContextIds updatedPropertyEditorQmlPathsSourceContextIds)
|
DirectoryPathIds updatedPropertyEditorQmlPathsDirectoryPathIds)
|
||||||
{
|
{
|
||||||
using Storage::Synchronization::PropertyEditorQmlPath;
|
using Storage::Synchronization::PropertyEditorQmlPath;
|
||||||
std::ranges::sort(paths, {}, &PropertyEditorQmlPath::typeId);
|
std::ranges::sort(paths, {}, &PropertyEditorQmlPath::typeId);
|
||||||
|
|
||||||
auto range = s->selectPropertyEditorPathsForForSourceIdsStatement.range<PropertyEditorQmlPathView>(
|
auto range = s->selectPropertyEditorPathsForForSourceIdsStatement.range<PropertyEditorQmlPathView>(
|
||||||
toIntegers(updatedPropertyEditorQmlPathsSourceContextIds));
|
toIntegers(updatedPropertyEditorQmlPathsDirectoryPathIds));
|
||||||
|
|
||||||
auto compareKey = [](const PropertyEditorQmlPathView &view, const PropertyEditorQmlPath &value) {
|
auto compareKey = [](const PropertyEditorQmlPathView &view, const PropertyEditorQmlPath &value) {
|
||||||
return view.typeId <=> value.typeId;
|
return view.typeId <=> value.typeId;
|
||||||
@@ -4110,7 +4110,7 @@ void ProjectStorage::synchronizePropertyEditorPaths(
|
|||||||
|
|
||||||
void ProjectStorage::synchronizePropertyEditorQmlPaths(
|
void ProjectStorage::synchronizePropertyEditorQmlPaths(
|
||||||
Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
||||||
SourceContextIds updatedPropertyEditorQmlPathsSourceIds)
|
DirectoryPathIds updatedPropertyEditorQmlPathsSourceIds)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"synchronize property editor qml paths", projectStorageCategory()};
|
NanotraceHR::Tracer tracer{"synchronize property editor qml paths", projectStorageCategory()};
|
||||||
|
|
||||||
|
@@ -105,9 +105,9 @@ public:
|
|||||||
|
|
||||||
Storage::Info::TypeHints typeHints(TypeId typeId) const override;
|
Storage::Info::TypeHints typeHints(TypeId typeId) const override;
|
||||||
|
|
||||||
SmallSourceIds<4> typeAnnotationSourceIds(SourceContextId directoryId) const override;
|
SmallSourceIds<4> typeAnnotationSourceIds(DirectoryPathId directoryId) const override;
|
||||||
|
|
||||||
SmallSourceContextIds<64> typeAnnotationDirectoryIds() const override;
|
SmallDirectoryPathIds<64> typeAnnotationDirectoryIds() const override;
|
||||||
|
|
||||||
Storage::Info::ItemLibraryEntries itemLibraryEntries(TypeId typeId) const override;
|
Storage::Info::ItemLibraryEntries itemLibraryEntries(TypeId typeId) const override;
|
||||||
Storage::Info::ItemLibraryEntries itemLibraryEntries(ImportId importId) const;
|
Storage::Info::ItemLibraryEntries itemLibraryEntries(ImportId importId) const;
|
||||||
@@ -220,11 +220,11 @@ public:
|
|||||||
|
|
||||||
std::optional<Storage::Synchronization::DirectoryInfo> fetchDirectoryInfo(SourceId sourceId) const override;
|
std::optional<Storage::Synchronization::DirectoryInfo> fetchDirectoryInfo(SourceId sourceId) const override;
|
||||||
|
|
||||||
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(SourceContextId directoryId) const override;
|
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(DirectoryPathId directoryId) const override;
|
||||||
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(
|
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(
|
||||||
SourceContextId directoryId, Storage::Synchronization::FileType fileType) const override;
|
DirectoryPathId directoryId, Storage::Synchronization::FileType fileType) const override;
|
||||||
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(const SourceContextIds &directoryIds) const;
|
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(const DirectoryPathIds &directoryIds) const;
|
||||||
SmallSourceContextIds<32> fetchSubdirectoryIds(SourceContextId directoryId) const override;
|
SmallDirectoryPathIds<32> fetchSubdirectoryIds(DirectoryPathId directoryId) const override;
|
||||||
|
|
||||||
void setPropertyEditorPathId(TypeId typeId, SourceId pathId);
|
void setPropertyEditorPathId(TypeId typeId, SourceId pathId);
|
||||||
|
|
||||||
@@ -574,7 +574,7 @@ private:
|
|||||||
const SourceIds &updatedSourceIds);
|
const SourceIds &updatedSourceIds);
|
||||||
|
|
||||||
void synchronizeDirectoryInfos(Storage::Synchronization::DirectoryInfos &directoryInfos,
|
void synchronizeDirectoryInfos(Storage::Synchronization::DirectoryInfos &directoryInfos,
|
||||||
const SourceContextIds &updatedDirectoryInfoDirectoryIds);
|
const DirectoryPathIds &updatedDirectoryInfoDirectoryIds);
|
||||||
|
|
||||||
void synchronizeFileStatuses(FileStatuses &fileStatuses, const SourceIds &updatedSourceIds);
|
void synchronizeFileStatuses(FileStatuses &fileStatuses, const SourceIds &updatedSourceIds);
|
||||||
|
|
||||||
@@ -789,7 +789,7 @@ private:
|
|||||||
class PropertyEditorQmlPathView
|
class PropertyEditorQmlPathView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PropertyEditorQmlPathView(TypeId typeId, SourceId pathId, SourceContextId directoryId)
|
PropertyEditorQmlPathView(TypeId typeId, SourceId pathId, DirectoryPathId directoryId)
|
||||||
: typeId{typeId}
|
: typeId{typeId}
|
||||||
, pathId{pathId}
|
, pathId{pathId}
|
||||||
, directoryId{directoryId}
|
, directoryId{directoryId}
|
||||||
@@ -811,14 +811,14 @@ private:
|
|||||||
public:
|
public:
|
||||||
TypeId typeId;
|
TypeId typeId;
|
||||||
SourceId pathId;
|
SourceId pathId;
|
||||||
SourceContextId directoryId;
|
DirectoryPathId directoryId;
|
||||||
};
|
};
|
||||||
|
|
||||||
void synchronizePropertyEditorPaths(Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
void synchronizePropertyEditorPaths(Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
||||||
SourceContextIds updatedPropertyEditorQmlPathsSourceContextIds);
|
DirectoryPathIds updatedPropertyEditorQmlPathsDirectoryPathIds);
|
||||||
|
|
||||||
void synchronizePropertyEditorQmlPaths(Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
void synchronizePropertyEditorQmlPaths(Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
||||||
SourceContextIds updatedPropertyEditorQmlPathsSourceIds);
|
DirectoryPathIds updatedPropertyEditorQmlPathsSourceIds);
|
||||||
|
|
||||||
void synchronizeFunctionDeclarations(
|
void synchronizeFunctionDeclarations(
|
||||||
TypeId typeId, Storage::Synchronization::FunctionDeclarations &functionsDeclarations);
|
TypeId typeId, Storage::Synchronization::FunctionDeclarations &functionsDeclarations);
|
||||||
|
@@ -58,8 +58,8 @@ public:
|
|||||||
= 0;
|
= 0;
|
||||||
virtual PropertyDeclarationId defaultPropertyDeclarationId(TypeId typeId) const = 0;
|
virtual PropertyDeclarationId defaultPropertyDeclarationId(TypeId typeId) const = 0;
|
||||||
virtual std::optional<Storage::Info::Type> type(TypeId typeId) const = 0;
|
virtual std::optional<Storage::Info::Type> type(TypeId typeId) const = 0;
|
||||||
virtual SmallSourceIds<4> typeAnnotationSourceIds(SourceContextId directoryId) const = 0;
|
virtual SmallSourceIds<4> typeAnnotationSourceIds(DirectoryPathId directoryId) const = 0;
|
||||||
virtual SmallSourceContextIds<64> typeAnnotationDirectoryIds() const = 0;
|
virtual SmallDirectoryPathIds<64> typeAnnotationDirectoryIds() const = 0;
|
||||||
virtual Utils::PathString typeIconPath(TypeId typeId) const = 0;
|
virtual Utils::PathString typeIconPath(TypeId typeId) const = 0;
|
||||||
virtual Storage::Info::TypeHints typeHints(TypeId typeId) const = 0;
|
virtual Storage::Info::TypeHints typeHints(TypeId typeId) const = 0;
|
||||||
virtual Storage::Info::ItemLibraryEntries itemLibraryEntries(TypeId typeId) const = 0;
|
virtual Storage::Info::ItemLibraryEntries itemLibraryEntries(TypeId typeId) const = 0;
|
||||||
@@ -82,13 +82,13 @@ public:
|
|||||||
virtual bool isBasedOn(TypeId, TypeId, TypeId, TypeId, TypeId, TypeId, TypeId, TypeId) const = 0;
|
virtual bool isBasedOn(TypeId, TypeId, TypeId, TypeId, TypeId, TypeId, TypeId, TypeId) const = 0;
|
||||||
|
|
||||||
virtual FileStatus fetchFileStatus(SourceId sourceId) const = 0;
|
virtual FileStatus fetchFileStatus(SourceId sourceId) const = 0;
|
||||||
virtual Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(SourceContextId directoryId) const = 0;
|
virtual Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(DirectoryPathId directoryId) const = 0;
|
||||||
virtual Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(
|
virtual Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(
|
||||||
SourceContextId directoryId, Storage::Synchronization::FileType) const
|
DirectoryPathId directoryId, Storage::Synchronization::FileType) const
|
||||||
= 0;
|
= 0;
|
||||||
virtual std::optional<Storage::Synchronization::DirectoryInfo>
|
virtual std::optional<Storage::Synchronization::DirectoryInfo>
|
||||||
fetchDirectoryInfo(SourceId sourceId) const = 0;
|
fetchDirectoryInfo(SourceId sourceId) const = 0;
|
||||||
virtual SmallSourceContextIds<32> fetchSubdirectoryIds(SourceContextId directoryId) const = 0;
|
virtual SmallDirectoryPathIds<32> fetchSubdirectoryIds(DirectoryPathId directoryId) const = 0;
|
||||||
|
|
||||||
virtual SourceId propertyEditorPathId(TypeId typeId) const = 0;
|
virtual SourceId propertyEditorPathId(TypeId typeId) const = 0;
|
||||||
virtual const Storage::Info::CommonTypeCache<ProjectStorageType> &commonTypeCache() const = 0;
|
virtual const Storage::Info::CommonTypeCache<ProjectStorageType> &commonTypeCache() const = 0;
|
||||||
|
@@ -36,8 +36,8 @@ public:
|
|||||||
[&](const QString &path) { compressChangedDirectoryPath(path); });
|
[&](const QString &path) { compressChangedDirectoryPath(path); });
|
||||||
|
|
||||||
m_directoryPathCompressor.setCallback(
|
m_directoryPathCompressor.setCallback(
|
||||||
[&](const QmlDesigner::SourceContextIds &sourceContextIds) {
|
[&](const QmlDesigner::DirectoryPathIds &directoryPathIds) {
|
||||||
addChangedPathForFilePath(sourceContextIds);
|
addChangedPathForFilePath(directoryPathIds);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateContextIdPaths(const std::vector<IdPaths> &idPaths,
|
void updateContextIdPaths(const std::vector<IdPaths> &idPaths,
|
||||||
const SourceContextIds &sourceContextIds) override
|
const DirectoryPathIds &directoryPathIds) override
|
||||||
{
|
{
|
||||||
const auto &[entires, ids] = convertIdPathsToWatcherEntriesAndIds(idPaths);
|
const auto &[entires, ids] = convertIdPathsToWatcherEntriesAndIds(idPaths);
|
||||||
|
|
||||||
@@ -62,19 +62,19 @@ public:
|
|||||||
|
|
||||||
auto notContainsId = [&, &ids = ids](WatcherEntry entry) {
|
auto notContainsId = [&, &ids = ids](WatcherEntry entry) {
|
||||||
return !std::ranges::binary_search(ids, entry.id)
|
return !std::ranges::binary_search(ids, entry.id)
|
||||||
|| !std::ranges::binary_search(sourceContextIds, entry.sourceContextId);
|
|| !std::ranges::binary_search(directoryPathIds, entry.directoryPathId);
|
||||||
};
|
};
|
||||||
|
|
||||||
removeUnusedEntries(entires, notContainsId);
|
removeUnusedEntries(entires, notContainsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkForChangeInDirectory(SourceContextIds sourceContextIds) override
|
void checkForChangeInDirectory(DirectoryPathIds directoryPathIds) override
|
||||||
{
|
{
|
||||||
std::ranges::sort(sourceContextIds);
|
std::ranges::sort(directoryPathIds);
|
||||||
auto removed = std::ranges::unique(sourceContextIds);
|
auto removed = std::ranges::unique(directoryPathIds);
|
||||||
sourceContextIds.erase(removed.begin(), removed.end());
|
directoryPathIds.erase(removed.begin(), removed.end());
|
||||||
|
|
||||||
addChangedPathForFilePath(sourceContextIds);
|
addChangedPathForFilePath(directoryPathIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeIds(const ProjectPartIds &ids) override
|
void removeIds(const ProjectPartIds &ids) override
|
||||||
@@ -158,23 +158,23 @@ public:
|
|||||||
|
|
||||||
FileSystemWatcher &fileSystemWatcher() { return m_fileSystemWatcher; }
|
FileSystemWatcher &fileSystemWatcher() { return m_fileSystemWatcher; }
|
||||||
|
|
||||||
QStringList convertWatcherEntriesToDirectoryPathList(const SourceContextIds &sourceContextIds) const
|
QStringList convertWatcherEntriesToDirectoryPathList(const DirectoryPathIds &directoryPathIds) const
|
||||||
{
|
{
|
||||||
return Utils::transform<QStringList>(sourceContextIds, [&](SourceContextId id) {
|
return Utils::transform<QStringList>(directoryPathIds, [&](DirectoryPathId id) {
|
||||||
return QString(m_pathCache.sourceContextPath(id));
|
return QString(m_pathCache.directoryPath(id));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList convertWatcherEntriesToDirectoryPathList(const WatcherEntries &watcherEntries) const
|
QStringList convertWatcherEntriesToDirectoryPathList(const WatcherEntries &watcherEntries) const
|
||||||
{
|
{
|
||||||
SourceContextIds sourceContextIds = Utils::transform<SourceContextIds>(
|
DirectoryPathIds directoryPathIds = Utils::transform<DirectoryPathIds>(
|
||||||
watcherEntries, &WatcherEntry::sourceContextId);
|
watcherEntries, &WatcherEntry::directoryPathId);
|
||||||
|
|
||||||
std::ranges::sort(sourceContextIds);
|
std::ranges::sort(directoryPathIds);
|
||||||
auto removed = std::ranges::unique(sourceContextIds);
|
auto removed = std::ranges::unique(directoryPathIds);
|
||||||
sourceContextIds.erase(removed.begin(), removed.end());
|
directoryPathIds.erase(removed.begin(), removed.end());
|
||||||
|
|
||||||
return convertWatcherEntriesToDirectoryPathList(sourceContextIds);
|
return convertWatcherEntriesToDirectoryPathList(directoryPathIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
WatcherEntries notWatchedEntries(const WatcherEntries &entries) const
|
WatcherEntries notWatchedEntries(const WatcherEntries &entries) const
|
||||||
@@ -187,9 +187,9 @@ public:
|
|||||||
return notWatchedEntries;
|
return notWatchedEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceContextIds notWatchedPaths(const SourceContextIds &ids) const
|
DirectoryPathIds notWatchedPaths(const DirectoryPathIds &ids) const
|
||||||
{
|
{
|
||||||
SourceContextIds notWatchedDirectoryIds;
|
DirectoryPathIds notWatchedDirectoryIds;
|
||||||
notWatchedDirectoryIds.reserve(ids.size());
|
notWatchedDirectoryIds.reserve(ids.size());
|
||||||
|
|
||||||
std::ranges::set_difference(ids, m_watchedEntries, std::back_inserter(notWatchedDirectoryIds));
|
std::ranges::set_difference(ids, m_watchedEntries, std::back_inserter(notWatchedDirectoryIds));
|
||||||
@@ -231,20 +231,20 @@ public:
|
|||||||
m_watchedEntries = std::move(newWatchedEntries);
|
m_watchedEntries = std::move(newWatchedEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SourceContextIds uniquePaths(const WatcherEntries &pathEntries)
|
static DirectoryPathIds uniquePaths(const WatcherEntries &pathEntries)
|
||||||
{
|
{
|
||||||
SourceContextIds uniqueDirectoryIds;
|
DirectoryPathIds uniqueDirectoryIds;
|
||||||
uniqueDirectoryIds.reserve(pathEntries.size());
|
uniqueDirectoryIds.reserve(pathEntries.size());
|
||||||
|
|
||||||
std::ranges::unique_copy(pathEntries,
|
std::ranges::unique_copy(pathEntries,
|
||||||
std::back_inserter(uniqueDirectoryIds),
|
std::back_inserter(uniqueDirectoryIds),
|
||||||
{},
|
{},
|
||||||
&WatcherEntry::sourceContextId);
|
&WatcherEntry::directoryPathId);
|
||||||
|
|
||||||
return uniqueDirectoryIds;
|
return uniqueDirectoryIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceContextIds filterNotWatchedPaths(const WatcherEntries &entries) const
|
DirectoryPathIds filterNotWatchedPaths(const WatcherEntries &entries) const
|
||||||
{
|
{
|
||||||
return notWatchedPaths(uniquePaths(entries));
|
return notWatchedPaths(uniquePaths(entries));
|
||||||
}
|
}
|
||||||
@@ -278,18 +278,18 @@ public:
|
|||||||
|
|
||||||
void compressChangedDirectoryPath(const QString &path)
|
void compressChangedDirectoryPath(const QString &path)
|
||||||
{
|
{
|
||||||
m_directoryPathCompressor.addSourceContextId(
|
m_directoryPathCompressor.addDirectoryPathId(
|
||||||
m_pathCache.sourceContextId(Utils::PathString{path}));
|
m_pathCache.directoryPathId(Utils::PathString{path}));
|
||||||
}
|
}
|
||||||
|
|
||||||
WatcherEntries watchedEntriesForPaths(const QmlDesigner::SourceContextIds &sourceContextIds)
|
WatcherEntries watchedEntriesForPaths(const QmlDesigner::DirectoryPathIds &directoryPathIds)
|
||||||
{
|
{
|
||||||
WatcherEntries foundEntries;
|
WatcherEntries foundEntries;
|
||||||
foundEntries.reserve(m_watchedEntries.size());
|
foundEntries.reserve(m_watchedEntries.size());
|
||||||
|
|
||||||
Utils::set_greedy_intersection(
|
Utils::set_greedy_intersection(
|
||||||
m_watchedEntries,
|
m_watchedEntries,
|
||||||
sourceContextIds,
|
directoryPathIds,
|
||||||
[&](WatcherEntry &entry) {
|
[&](WatcherEntry &entry) {
|
||||||
m_fileStatusCache.update(entry.sourceId);
|
m_fileStatusCache.update(entry.sourceId);
|
||||||
auto fileStatus = m_fileStatusCache.find(entry.sourceId);
|
auto fileStatus = m_fileStatusCache.find(entry.sourceId);
|
||||||
@@ -300,7 +300,7 @@ public:
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
&WatcherEntry::sourceContextId);
|
&WatcherEntry::directoryPathId);
|
||||||
|
|
||||||
return foundEntries;
|
return foundEntries;
|
||||||
}
|
}
|
||||||
@@ -339,10 +339,10 @@ public:
|
|||||||
return idPaths;
|
return idPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addChangedPathForFilePath(const SourceContextIds &sourceContextIds)
|
void addChangedPathForFilePath(const DirectoryPathIds &directoryPathIds)
|
||||||
{
|
{
|
||||||
if (m_notifier) {
|
if (m_notifier) {
|
||||||
WatcherEntries foundEntries = watchedEntriesForPaths(sourceContextIds);
|
WatcherEntries foundEntries = watchedEntriesForPaths(directoryPathIds);
|
||||||
|
|
||||||
SourceIds watchedSourceIds = watchedPaths(foundEntries);
|
SourceIds watchedSourceIds = watchedPaths(foundEntries);
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ public:
|
|||||||
|
|
||||||
virtual void updateIdPaths(const std::vector<IdPaths> &idPaths) = 0;
|
virtual void updateIdPaths(const std::vector<IdPaths> &idPaths) = 0;
|
||||||
virtual void updateContextIdPaths(const std::vector<IdPaths> &idPaths,
|
virtual void updateContextIdPaths(const std::vector<IdPaths> &idPaths,
|
||||||
const SourceContextIds &sourceContextIds)
|
const DirectoryPathIds &directoryPathIds)
|
||||||
= 0;
|
= 0;
|
||||||
virtual void removeIds(const ProjectPartIds &ids) = 0;
|
virtual void removeIds(const ProjectPartIds &ids) = 0;
|
||||||
|
|
||||||
|
@@ -100,26 +100,26 @@ class WatcherEntry
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProjectChunkId id;
|
ProjectChunkId id;
|
||||||
SourceContextId sourceContextId;
|
DirectoryPathId directoryPathId;
|
||||||
SourceId sourceId;
|
SourceId sourceId;
|
||||||
long long lastModified = -1;
|
long long lastModified = -1;
|
||||||
long long size = -1;
|
long long size = -1;
|
||||||
|
|
||||||
friend bool operator==(WatcherEntry first, WatcherEntry second)
|
friend bool operator==(WatcherEntry first, WatcherEntry second)
|
||||||
{
|
{
|
||||||
return first.id == second.id && first.sourceContextId == second.sourceContextId
|
return first.id == second.id && first.directoryPathId == second.directoryPathId
|
||||||
&& first.sourceId == second.sourceId;
|
&& first.sourceId == second.sourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend std::weak_ordering operator<=>(const WatcherEntry &first, const WatcherEntry &second)
|
friend std::weak_ordering operator<=>(const WatcherEntry &first, const WatcherEntry &second)
|
||||||
{
|
{
|
||||||
return std::tie(first.sourceContextId, first.sourceId, first.id)
|
return std::tie(first.directoryPathId, first.sourceId, first.id)
|
||||||
<=> std::tie(second.sourceContextId, second.sourceId, second.id);
|
<=> std::tie(second.directoryPathId, second.sourceId, second.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
operator SourceId() const { return sourceId; }
|
operator SourceId() const { return sourceId; }
|
||||||
|
|
||||||
operator SourceContextId() const { return sourceContextId; }
|
operator DirectoryPathId() const { return directoryPathId; }
|
||||||
};
|
};
|
||||||
|
|
||||||
using WatcherEntries = std::vector<WatcherEntry>;
|
using WatcherEntries = std::vector<WatcherEntry>;
|
||||||
|
@@ -14,7 +14,7 @@ public:
|
|||||||
ProjectStorageTriggerUpdateInterface(const ProjectStorageTriggerUpdateInterface &) = delete;
|
ProjectStorageTriggerUpdateInterface(const ProjectStorageTriggerUpdateInterface &) = delete;
|
||||||
ProjectStorageTriggerUpdateInterface &operator=(const ProjectStorageTriggerUpdateInterface &) = delete;
|
ProjectStorageTriggerUpdateInterface &operator=(const ProjectStorageTriggerUpdateInterface &) = delete;
|
||||||
|
|
||||||
virtual void checkForChangeInDirectory(SourceContextIds sourceContextIds) = 0;
|
virtual void checkForChangeInDirectory(DirectoryPathIds directoryPathIds) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~ProjectStorageTriggerUpdateInterface() = default;
|
~ProjectStorageTriggerUpdateInterface() = default;
|
||||||
|
@@ -1154,7 +1154,7 @@ public:
|
|||||||
PropertyEditorQmlPath(ModuleId moduleId,
|
PropertyEditorQmlPath(ModuleId moduleId,
|
||||||
TypeNameString typeName,
|
TypeNameString typeName,
|
||||||
SourceId pathId,
|
SourceId pathId,
|
||||||
SourceContextId directoryId)
|
DirectoryPathId directoryId)
|
||||||
: typeName{typeName}
|
: typeName{typeName}
|
||||||
, pathId{pathId}
|
, pathId{pathId}
|
||||||
, directoryId{directoryId}
|
, directoryId{directoryId}
|
||||||
@@ -1179,7 +1179,7 @@ public:
|
|||||||
TypeNameString typeName;
|
TypeNameString typeName;
|
||||||
TypeId typeId;
|
TypeId typeId;
|
||||||
SourceId pathId;
|
SourceId pathId;
|
||||||
SourceContextId directoryId;
|
DirectoryPathId directoryId;
|
||||||
ModuleId moduleId;
|
ModuleId moduleId;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1188,7 +1188,7 @@ using PropertyEditorQmlPaths = std::vector<class PropertyEditorQmlPath>;
|
|||||||
class DirectoryInfo
|
class DirectoryInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DirectoryInfo(SourceContextId directoryId, SourceId sourceId, ModuleId moduleId, FileType fileType)
|
DirectoryInfo(DirectoryPathId directoryId, SourceId sourceId, ModuleId moduleId, FileType fileType)
|
||||||
: directoryId{directoryId}
|
: directoryId{directoryId}
|
||||||
, sourceId{sourceId}
|
, sourceId{sourceId}
|
||||||
, moduleId{moduleId}
|
, moduleId{moduleId}
|
||||||
@@ -1216,7 +1216,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SourceContextId directoryId;
|
DirectoryPathId directoryId;
|
||||||
SourceId sourceId;
|
SourceId sourceId;
|
||||||
ModuleId moduleId;
|
ModuleId moduleId;
|
||||||
FileType fileType;
|
FileType fileType;
|
||||||
@@ -1227,13 +1227,13 @@ using DirectoryInfos = std::vector<DirectoryInfo>;
|
|||||||
class TypeAnnotation
|
class TypeAnnotation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TypeAnnotation(SourceId sourceId, SourceContextId directoryId)
|
TypeAnnotation(SourceId sourceId, DirectoryPathId directoryId)
|
||||||
: sourceId{sourceId}
|
: sourceId{sourceId}
|
||||||
, directoryId{directoryId}
|
, directoryId{directoryId}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
TypeAnnotation(SourceId sourceId,
|
TypeAnnotation(SourceId sourceId,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
Utils::SmallStringView typeName,
|
Utils::SmallStringView typeName,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Utils::SmallStringView iconPath,
|
Utils::SmallStringView iconPath,
|
||||||
@@ -1274,7 +1274,7 @@ public:
|
|||||||
SourceId sourceId;
|
SourceId sourceId;
|
||||||
ModuleId moduleId;
|
ModuleId moduleId;
|
||||||
TypeTraits traits;
|
TypeTraits traits;
|
||||||
SourceContextId directoryId;
|
DirectoryPathId directoryId;
|
||||||
};
|
};
|
||||||
|
|
||||||
using TypeAnnotations = std::vector<TypeAnnotation>;
|
using TypeAnnotations = std::vector<TypeAnnotation>;
|
||||||
@@ -1314,7 +1314,7 @@ public:
|
|||||||
, fileStatuses(std::move(fileStatuses))
|
, fileStatuses(std::move(fileStatuses))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SynchronizationPackage(SourceContextIds updatedDirectoryInfoDirectoryIds,
|
SynchronizationPackage(DirectoryPathIds updatedDirectoryInfoDirectoryIds,
|
||||||
DirectoryInfos directoryInfos)
|
DirectoryInfos directoryInfos)
|
||||||
: directoryInfos(std::move(directoryInfos))
|
: directoryInfos(std::move(directoryInfos))
|
||||||
, updatedDirectoryInfoDirectoryIds(std::move(updatedDirectoryInfoDirectoryIds))
|
, updatedDirectoryInfoDirectoryIds(std::move(updatedDirectoryInfoDirectoryIds))
|
||||||
@@ -1327,13 +1327,13 @@ public:
|
|||||||
SourceIds updatedFileStatusSourceIds;
|
SourceIds updatedFileStatusSourceIds;
|
||||||
FileStatuses fileStatuses;
|
FileStatuses fileStatuses;
|
||||||
DirectoryInfos directoryInfos;
|
DirectoryInfos directoryInfos;
|
||||||
SourceContextIds updatedDirectoryInfoDirectoryIds;
|
DirectoryPathIds updatedDirectoryInfoDirectoryIds;
|
||||||
Imports moduleDependencies;
|
Imports moduleDependencies;
|
||||||
SourceIds updatedModuleDependencySourceIds;
|
SourceIds updatedModuleDependencySourceIds;
|
||||||
ModuleExportedImports moduleExportedImports;
|
ModuleExportedImports moduleExportedImports;
|
||||||
ModuleIds updatedModuleIds;
|
ModuleIds updatedModuleIds;
|
||||||
PropertyEditorQmlPaths propertyEditorQmlPaths;
|
PropertyEditorQmlPaths propertyEditorQmlPaths;
|
||||||
SourceContextIds updatedPropertyEditorQmlPathDirectoryIds;
|
DirectoryPathIds updatedPropertyEditorQmlPathDirectoryIds;
|
||||||
TypeAnnotations typeAnnotations;
|
TypeAnnotations typeAnnotations;
|
||||||
SourceIds updatedTypeAnnotationSourceIds;
|
SourceIds updatedTypeAnnotationSourceIds;
|
||||||
};
|
};
|
||||||
|
@@ -417,8 +417,8 @@ void ProjectStorageUpdater::updateDirectoryChanged(Utils::SmallStringView direct
|
|||||||
FileState annotationDirectoryState,
|
FileState annotationDirectoryState,
|
||||||
SourcePath qmldirSourcePath,
|
SourcePath qmldirSourcePath,
|
||||||
SourceId qmldirSourceId,
|
SourceId qmldirSourceId,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
SourceContextId annotationDirectoryId,
|
DirectoryPathId annotationDirectoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &WatchedSourceIds,
|
WatchedSourceIds &WatchedSourceIds,
|
||||||
@@ -513,9 +513,9 @@ void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProjectStorageUpdater::updateSubdirectories(const Utils::PathString &directoryPath,
|
void ProjectStorageUpdater::updateSubdirectories(const Utils::PathString &directoryPath,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
FileState directoryState,
|
FileState directoryState,
|
||||||
const SourceContextIds &subdirectoriesToIgnore,
|
const DirectoryPathIds &subdirectoriesToIgnore,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &WatchedSourceIds,
|
WatchedSourceIds &WatchedSourceIds,
|
||||||
@@ -523,35 +523,35 @@ void ProjectStorageUpdater::updateSubdirectories(const Utils::PathString &direct
|
|||||||
{
|
{
|
||||||
struct Directory
|
struct Directory
|
||||||
{
|
{
|
||||||
Directory(Utils::SmallStringView path, SourceContextId sourceContextId)
|
Directory(Utils::SmallStringView path, DirectoryPathId directoryPathId)
|
||||||
: path{path}
|
: path{path}
|
||||||
, sourceContextId{sourceContextId}
|
, directoryPathId{directoryPathId}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Utils::PathString path;
|
Utils::PathString path;
|
||||||
SourceContextId sourceContextId;
|
DirectoryPathId directoryPathId;
|
||||||
};
|
};
|
||||||
|
|
||||||
using Directories = QVarLengthArray<Directory, 32>;
|
using Directories = QVarLengthArray<Directory, 32>;
|
||||||
|
|
||||||
auto subdirectoryIds = m_projectStorage.fetchSubdirectoryIds(directoryId);
|
auto subdirectoryIds = m_projectStorage.fetchSubdirectoryIds(directoryId);
|
||||||
auto subdirectories = Utils::transform<Directories>(
|
auto subdirectories = Utils::transform<Directories>(
|
||||||
subdirectoryIds, [&](SourceContextId sourceContextId) -> Directory {
|
subdirectoryIds, [&](DirectoryPathId directoryPathId) -> Directory {
|
||||||
auto subdirectoryPath = m_pathCache.sourceContextPath(sourceContextId);
|
auto subdirectoryPath = m_pathCache.directoryPath(directoryPathId);
|
||||||
return {subdirectoryPath, sourceContextId};
|
return {subdirectoryPath, directoryPathId};
|
||||||
});
|
});
|
||||||
|
|
||||||
auto exisitingSubdirectoryPaths = m_fileSystem.subdirectories(directoryPath.toQString());
|
auto exisitingSubdirectoryPaths = m_fileSystem.subdirectories(directoryPath.toQString());
|
||||||
Directories existingSubdirecories;
|
Directories existingSubdirecories;
|
||||||
|
|
||||||
auto skipDirectory = [&](std::string_view subdirectoryPath, SourceContextId sourceContextId) {
|
auto skipDirectory = [&](std::string_view subdirectoryPath, DirectoryPathId directoryPathId) {
|
||||||
if (subdirectoryPath.ends_with("designer"))
|
if (subdirectoryPath.ends_with("designer"))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (isInsideProject == IsInsideProject::Yes) {
|
if (isInsideProject == IsInsideProject::Yes) {
|
||||||
static SourceNameId ignoreInQdsSourceNameId = m_pathCache.sourceNameId("ignore-in-qds");
|
static FileNameId ignoreInQdsFileNameId = m_pathCache.fileNameId("ignore-in-qds");
|
||||||
|
|
||||||
SourceId ignoreInQdsSourceId = SourceId::create(ignoreInQdsSourceNameId, sourceContextId);
|
SourceId ignoreInQdsSourceId = SourceId::create(ignoreInQdsFileNameId, directoryPathId);
|
||||||
|
|
||||||
auto ignoreInQdsState = fileState(ignoreInQdsSourceId, package, notUpdatedSourceIds);
|
auto ignoreInQdsState = fileState(ignoreInQdsSourceId, package, notUpdatedSourceIds);
|
||||||
|
|
||||||
@@ -567,17 +567,17 @@ void ProjectStorageUpdater::updateSubdirectories(const Utils::PathString &direct
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (Utils::PathString subdirectoryPath : exisitingSubdirectoryPaths) {
|
for (Utils::PathString subdirectoryPath : exisitingSubdirectoryPaths) {
|
||||||
SourceContextId sourceContextId = m_pathCache.sourceContextId(subdirectoryPath);
|
DirectoryPathId directoryPathId = m_pathCache.directoryPathId(subdirectoryPath);
|
||||||
|
|
||||||
if (skipDirectory(subdirectoryPath, sourceContextId))
|
if (skipDirectory(subdirectoryPath, directoryPathId))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
subdirectories.emplace_back(subdirectoryPath, sourceContextId);
|
subdirectories.emplace_back(subdirectoryPath, directoryPathId);
|
||||||
existingSubdirecories.emplace_back(subdirectoryPath, sourceContextId);
|
existingSubdirecories.emplace_back(subdirectoryPath, directoryPathId);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ranges::sort(subdirectories, {}, &Directory::sourceContextId);
|
std::ranges::sort(subdirectories, {}, &Directory::directoryPathId);
|
||||||
auto removed = std::ranges::unique(subdirectories, {}, &Directory::sourceContextId);
|
auto removed = std::ranges::unique(subdirectories, {}, &Directory::directoryPathId);
|
||||||
subdirectories.erase(removed.begin(), removed.end());
|
subdirectories.erase(removed.begin(), removed.end());
|
||||||
|
|
||||||
auto updateDirectory = [&](const Directory &subdirectory) {
|
auto updateDirectory = [&](const Directory &subdirectory) {
|
||||||
@@ -593,12 +593,12 @@ void ProjectStorageUpdater::updateSubdirectories(const Utils::PathString &direct
|
|||||||
subdirectoriesToIgnore,
|
subdirectoriesToIgnore,
|
||||||
updateDirectory,
|
updateDirectory,
|
||||||
{},
|
{},
|
||||||
&Directory::sourceContextId);
|
&Directory::directoryPathId);
|
||||||
|
|
||||||
if (isChangedOrAdded(directoryState)) {
|
if (isChangedOrAdded(directoryState)) {
|
||||||
for (const auto &[subdirectoryPath, subdirectoryId] : existingSubdirecories) {
|
for (const auto &[subdirectoryPath, subdirectoryId] : existingSubdirecories) {
|
||||||
package.directoryInfos.emplace_back(directoryId,
|
package.directoryInfos.emplace_back(directoryId,
|
||||||
SourceId::create(SourceNameId{}, subdirectoryId),
|
SourceId::create(FileNameId{}, subdirectoryId),
|
||||||
ModuleId{},
|
ModuleId{},
|
||||||
Storage::Synchronization::FileType::Directory);
|
Storage::Synchronization::FileType::Directory);
|
||||||
}
|
}
|
||||||
@@ -607,8 +607,8 @@ void ProjectStorageUpdater::updateSubdirectories(const Utils::PathString &direct
|
|||||||
|
|
||||||
void ProjectStorageUpdater::annotationDirectoryChanged(
|
void ProjectStorageUpdater::annotationDirectoryChanged(
|
||||||
Utils::SmallStringView directoryPath,
|
Utils::SmallStringView directoryPath,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
SourceContextId annotationDirectoryId,
|
DirectoryPathId annotationDirectoryId,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package)
|
Storage::Synchronization::SynchronizationPackage &package)
|
||||||
{
|
{
|
||||||
@@ -624,7 +624,7 @@ void ProjectStorageUpdater::annotationDirectoryChanged(
|
|||||||
|
|
||||||
void ProjectStorageUpdater::updatePropertyEditorFiles(
|
void ProjectStorageUpdater::updatePropertyEditorFiles(
|
||||||
Utils::SmallStringView directoryPath,
|
Utils::SmallStringView directoryPath,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package)
|
Storage::Synchronization::SynchronizationPackage &package)
|
||||||
{
|
{
|
||||||
@@ -643,7 +643,7 @@ void ProjectStorageUpdater::updatePropertyEditorFiles(
|
|||||||
|
|
||||||
void ProjectStorageUpdater::updatePropertyEditorFile(
|
void ProjectStorageUpdater::updatePropertyEditorFile(
|
||||||
const QString &fileName,
|
const QString &fileName,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package)
|
Storage::Synchronization::SynchronizationPackage &package)
|
||||||
{
|
{
|
||||||
@@ -659,7 +659,7 @@ void ProjectStorageUpdater::updatePropertyEditorFile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPath,
|
void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPath,
|
||||||
const SourceContextIds &subdirectoriesToIgnore,
|
const DirectoryPathIds &subdirectoriesToIgnore,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &WatchedSourceIds,
|
WatchedSourceIds &WatchedSourceIds,
|
||||||
@@ -669,18 +669,18 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
|
|||||||
|
|
||||||
SourcePath qmldirPath{directoryPath + "/qmldir"};
|
SourcePath qmldirPath{directoryPath + "/qmldir"};
|
||||||
SourceId qmldirSourceId = m_pathCache.sourceId(qmldirPath);
|
SourceId qmldirSourceId = m_pathCache.sourceId(qmldirPath);
|
||||||
SourceContextId directoryId = qmldirSourceId.contextId();
|
DirectoryPathId directoryId = qmldirSourceId.contextId();
|
||||||
|
|
||||||
auto directoryState = fileState(directoryId, package, notUpdatedSourceIds);
|
auto directoryState = fileState(directoryId, package, notUpdatedSourceIds);
|
||||||
if (isExisting(directoryState))
|
if (isExisting(directoryState))
|
||||||
WatchedSourceIds.directoryIds.push_back(SourceId::create(SourceNameId{}, directoryId));
|
WatchedSourceIds.directoryIds.push_back(SourceId::create(FileNameId{}, directoryId));
|
||||||
|
|
||||||
auto qmldirState = fileState(qmldirSourceId, package, notUpdatedSourceIds);
|
auto qmldirState = fileState(qmldirSourceId, package, notUpdatedSourceIds);
|
||||||
if (isExisting(qmldirState))
|
if (isExisting(qmldirState))
|
||||||
WatchedSourceIds.qmldirSourceIds.push_back(qmldirSourceId);
|
WatchedSourceIds.qmldirSourceIds.push_back(qmldirSourceId);
|
||||||
|
|
||||||
SourcePath annotationDirectoryPath{directoryPath + "/designer"};
|
SourcePath annotationDirectoryPath{directoryPath + "/designer"};
|
||||||
auto annotationDirectoryId = m_pathCache.sourceContextId(annotationDirectoryPath);
|
auto annotationDirectoryId = m_pathCache.directoryPathId(annotationDirectoryPath);
|
||||||
auto annotationDirectoryState = fileState(annotationDirectoryId, package, notUpdatedSourceIds);
|
auto annotationDirectoryState = fileState(annotationDirectoryId, package, notUpdatedSourceIds);
|
||||||
|
|
||||||
switch (combineState(directoryState, qmldirState, annotationDirectoryState)) {
|
switch (combineState(directoryState, qmldirState, annotationDirectoryState)) {
|
||||||
@@ -765,7 +765,7 @@ void ProjectStorageUpdater::updatePropertyEditorPaths(
|
|||||||
while (dirIterator.hasNext()) {
|
while (dirIterator.hasNext()) {
|
||||||
auto pathInfo = dirIterator.nextFileInfo();
|
auto pathInfo = dirIterator.nextFileInfo();
|
||||||
|
|
||||||
SourceContextId directoryId = m_pathCache.sourceContextId(
|
DirectoryPathId directoryId = m_pathCache.directoryPathId(
|
||||||
Utils::PathString{pathInfo.filePath()});
|
Utils::PathString{pathInfo.filePath()});
|
||||||
|
|
||||||
auto state = fileState(directoryId, package, notUpdatedSourceIds);
|
auto state = fileState(directoryId, package, notUpdatedSourceIds);
|
||||||
@@ -798,9 +798,9 @@ void ProjectStorageUpdater::updateTypeAnnotations(const QStringList &directoryPa
|
|||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer("update type annotations", category());
|
NanotraceHR::Tracer tracer("update type annotations", category());
|
||||||
|
|
||||||
std::map<SourceContextId, SmallSourceIds<16>> updatedSourceIdsDictonary;
|
std::map<DirectoryPathId, SmallSourceIds<16>> updatedSourceIdsDictonary;
|
||||||
|
|
||||||
for (SourceContextId directoryId : m_projectStorage.typeAnnotationDirectoryIds())
|
for (DirectoryPathId directoryId : m_projectStorage.typeAnnotationDirectoryIds())
|
||||||
updatedSourceIdsDictonary[directoryId] = {};
|
updatedSourceIdsDictonary[directoryId] = {};
|
||||||
|
|
||||||
for (const auto &directoryPath : directoryPaths)
|
for (const auto &directoryPath : directoryPaths)
|
||||||
@@ -813,7 +813,7 @@ void ProjectStorageUpdater::updateTypeAnnotations(
|
|||||||
const QString &rootDirectoryPath,
|
const QString &rootDirectoryPath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
std::map<SourceContextId, SmallSourceIds<16>> &updatedSourceIdsDictonary)
|
std::map<DirectoryPathId, SmallSourceIds<16>> &updatedSourceIdsDictonary)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer("update type annotation directory",
|
NanotraceHR::Tracer tracer("update type annotation directory",
|
||||||
category(),
|
category(),
|
||||||
@@ -834,7 +834,7 @@ void ProjectStorageUpdater::updateTypeAnnotations(
|
|||||||
|
|
||||||
auto directoryPath = fileInfo.canonicalPath();
|
auto directoryPath = fileInfo.canonicalPath();
|
||||||
|
|
||||||
SourceContextId directoryId = m_pathCache.sourceContextId(Utils::PathString{directoryPath});
|
DirectoryPathId directoryId = m_pathCache.directoryPathId(Utils::PathString{directoryPath});
|
||||||
|
|
||||||
auto state = fileState(sourceId, package, notUpdatedSourceIds);
|
auto state = fileState(sourceId, package, notUpdatedSourceIds);
|
||||||
if (isChangedOrAdded(state))
|
if (isChangedOrAdded(state))
|
||||||
@@ -848,7 +848,7 @@ void ProjectStorageUpdater::updateTypeAnnotations(
|
|||||||
void ProjectStorageUpdater::updateTypeAnnotationDirectories(
|
void ProjectStorageUpdater::updateTypeAnnotationDirectories(
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
std::map<SourceContextId, SmallSourceIds<16>> &updatedSourceIdsDictonary)
|
std::map<DirectoryPathId, SmallSourceIds<16>> &updatedSourceIdsDictonary)
|
||||||
{
|
{
|
||||||
for (auto &[directoryId, updatedSourceIds] : updatedSourceIdsDictonary) {
|
for (auto &[directoryId, updatedSourceIds] : updatedSourceIdsDictonary) {
|
||||||
auto directoryState = fileState(directoryId, package, notUpdatedSourceIds);
|
auto directoryState = fileState(directoryId, package, notUpdatedSourceIds);
|
||||||
@@ -886,7 +886,7 @@ QString contentFromFile(const QString &path)
|
|||||||
void ProjectStorageUpdater::updateTypeAnnotation(const QString &directoryPath,
|
void ProjectStorageUpdater::updateTypeAnnotation(const QString &directoryPath,
|
||||||
const QString &filePath,
|
const QString &filePath,
|
||||||
SourceId sourceId,
|
SourceId sourceId,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package)
|
Storage::Synchronization::SynchronizationPackage &package)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"update type annotation path",
|
NanotraceHR::Tracer tracer{"update type annotation path",
|
||||||
@@ -909,7 +909,7 @@ void ProjectStorageUpdater::updateTypeAnnotation(const QString &directoryPath,
|
|||||||
void ProjectStorageUpdater::updatePropertyEditorPath(
|
void ProjectStorageUpdater::updatePropertyEditorPath(
|
||||||
const QString &directoryPath,
|
const QString &directoryPath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
long long pathOffset)
|
long long pathOffset)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"update property editor path",
|
NanotraceHR::Tracer tracer{"update property editor path",
|
||||||
@@ -929,7 +929,7 @@ void ProjectStorageUpdater::updatePropertyEditorPath(
|
|||||||
void ProjectStorageUpdater::updatePropertyEditorFilePath(
|
void ProjectStorageUpdater::updatePropertyEditorFilePath(
|
||||||
const QString &path,
|
const QString &path,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
long long pathOffset)
|
long long pathOffset)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"update property editor file path",
|
NanotraceHR::Tracer tracer{"update property editor file path",
|
||||||
@@ -960,15 +960,15 @@ void ProjectStorageUpdater::updatePropertyEditorFilePath(
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
SourceContextIds filterUniqueSourceContextIds(const SourceIds &sourceIds)
|
DirectoryPathIds filterUniqueDirectoryPathIds(const SourceIds &sourceIds)
|
||||||
{
|
{
|
||||||
auto sourceContextIds = Utils::transform(sourceIds, &SourceId::contextId);
|
auto directoryPathIds = Utils::transform(sourceIds, &SourceId::contextId);
|
||||||
|
|
||||||
std::sort(sourceContextIds.begin(), sourceContextIds.end());
|
std::sort(directoryPathIds.begin(), directoryPathIds.end());
|
||||||
auto newEnd = std::unique(sourceContextIds.begin(), sourceContextIds.end());
|
auto newEnd = std::unique(directoryPathIds.begin(), directoryPathIds.end());
|
||||||
sourceContextIds.erase(newEnd, sourceContextIds.end());
|
directoryPathIds.erase(newEnd, directoryPathIds.end());
|
||||||
|
|
||||||
return sourceContextIds;
|
return directoryPathIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceIds filterUniqueSourceIds(SourceIds sourceIds)
|
SourceIds filterUniqueSourceIds(SourceIds sourceIds)
|
||||||
@@ -1049,9 +1049,9 @@ void ProjectStorageUpdater::pathsWithIdsChanged(const std::vector<IdPaths> &chan
|
|||||||
|
|
||||||
auto updateDirectory = [&](const SourceIds &directorySourceIds,
|
auto updateDirectory = [&](const SourceIds &directorySourceIds,
|
||||||
WatchedSourceIds &watchedSourceIds) {
|
WatchedSourceIds &watchedSourceIds) {
|
||||||
auto directoryIds = filterUniqueSourceContextIds(directorySourceIds);
|
auto directoryIds = filterUniqueDirectoryPathIds(directorySourceIds);
|
||||||
for (auto directoryId : directoryIds) {
|
for (auto directoryId : directoryIds) {
|
||||||
Utils::PathString directory = m_pathCache.sourceContextPath(directoryId);
|
Utils::PathString directory = m_pathCache.directoryPath(directoryId);
|
||||||
this->updateDirectory(directory,
|
this->updateDirectory(directory,
|
||||||
directoryIds,
|
directoryIds,
|
||||||
package,
|
package,
|
||||||
@@ -1067,7 +1067,7 @@ void ProjectStorageUpdater::pathsWithIdsChanged(const std::vector<IdPaths> &chan
|
|||||||
auto projectDirectoryIds = updateDirectory(project.directory, watchedProjectSourceIds);
|
auto projectDirectoryIds = updateDirectory(project.directory, watchedProjectSourceIds);
|
||||||
|
|
||||||
auto parseQmlComponent = [&](SourceIds qmlDocumentSourceIds,
|
auto parseQmlComponent = [&](SourceIds qmlDocumentSourceIds,
|
||||||
const SourceContextIds &directoryIds,
|
const DirectoryPathIds &directoryIds,
|
||||||
IsInsideProject isInsideProject) {
|
IsInsideProject isInsideProject) {
|
||||||
for (SourceId sourceId : filterUniqueSourceIds(std::move(qmlDocumentSourceIds))) {
|
for (SourceId sourceId : filterUniqueSourceIds(std::move(qmlDocumentSourceIds))) {
|
||||||
if (!contains(directoryIds, sourceId.contextId()))
|
if (!contains(directoryIds, sourceId.contextId()))
|
||||||
@@ -1079,7 +1079,7 @@ void ProjectStorageUpdater::pathsWithIdsChanged(const std::vector<IdPaths> &chan
|
|||||||
parseQmlComponent(std::move(project.qmlDocument), projectDirectoryIds, IsInsideProject::Yes);
|
parseQmlComponent(std::move(project.qmlDocument), projectDirectoryIds, IsInsideProject::Yes);
|
||||||
|
|
||||||
auto parseTypeInfo = [&](SourceIds qmltypesSourceIds,
|
auto parseTypeInfo = [&](SourceIds qmltypesSourceIds,
|
||||||
const SourceContextIds &directoryIds,
|
const DirectoryPathIds &directoryIds,
|
||||||
IsInsideProject isInsideProject) {
|
IsInsideProject isInsideProject) {
|
||||||
for (SourceId sourceId : filterUniqueSourceIds(std::move(qmltypesSourceIds))) {
|
for (SourceId sourceId : filterUniqueSourceIds(std::move(qmltypesSourceIds))) {
|
||||||
if (!contains(directoryIds, sourceId.contextId())) {
|
if (!contains(directoryIds, sourceId.contextId())) {
|
||||||
@@ -1116,7 +1116,7 @@ void ProjectStorageUpdater::pathsWithIdsChanged(const std::vector<IdPaths> &chan
|
|||||||
|
|
||||||
auto directoryIdsSize = projectDirectoryIds.size() + qtDirectoryIds.size();
|
auto directoryIdsSize = projectDirectoryIds.size() + qtDirectoryIds.size();
|
||||||
if (directoryIdsSize > 0) {
|
if (directoryIdsSize > 0) {
|
||||||
SourceContextIds directoryIds;
|
DirectoryPathIds directoryIds;
|
||||||
std::vector<IdPaths> newIdPaths;
|
std::vector<IdPaths> newIdPaths;
|
||||||
idPaths.reserve(8);
|
idPaths.reserve(8);
|
||||||
appendIdPaths(std::move(watchedQtSourceIds), m_qtPartId, newIdPaths);
|
appendIdPaths(std::move(watchedQtSourceIds), m_qtPartId, newIdPaths);
|
||||||
@@ -1135,7 +1135,7 @@ void ProjectStorageUpdater::pathsChanged(const SourceIds &) {}
|
|||||||
void ProjectStorageUpdater::parseTypeInfos(const QStringList &typeInfos,
|
void ProjectStorageUpdater::parseTypeInfos(const QStringList &typeInfos,
|
||||||
const std::vector<Utils::PathString> &qmldirDependencies,
|
const std::vector<Utils::PathString> &qmldirDependencies,
|
||||||
const std::vector<Utils::PathString> &qmldirImports,
|
const std::vector<Utils::PathString> &qmldirImports,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
const QString &directoryPath,
|
const QString &directoryPath,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
@@ -1258,7 +1258,7 @@ auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::Direct
|
|||||||
void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFilePath,
|
void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFilePath,
|
||||||
Utils::SmallStringView directoryPath,
|
Utils::SmallStringView directoryPath,
|
||||||
Storage::Synchronization::ExportedTypes exportedTypes,
|
Storage::Synchronization::ExportedTypes exportedTypes,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &watchedSourceIds,
|
WatchedSourceIds &watchedSourceIds,
|
||||||
@@ -1426,7 +1426,7 @@ Storage::Synchronization::ExportedTypes createExportedTypes(ProjectStorageUpdate
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void ProjectStorageUpdater::parseQmlComponents(Components components,
|
void ProjectStorageUpdater::parseQmlComponents(Components components,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &WatchedSourceIds,
|
WatchedSourceIds &WatchedSourceIds,
|
||||||
@@ -1442,7 +1442,7 @@ void ProjectStorageUpdater::parseQmlComponents(Components components,
|
|||||||
std::ranges::sort(components,
|
std::ranges::sort(components,
|
||||||
[](auto &&first, auto &&second) { return first.fileName < second.fileName; });
|
[](auto &&first, auto &&second) { return first.fileName < second.fileName; });
|
||||||
|
|
||||||
auto directoryPath = m_pathCache.sourceContextPath(directoryId);
|
auto directoryPath = m_pathCache.directoryPath(directoryId);
|
||||||
|
|
||||||
auto callback = [&](ComponentRange componentsWithSameFileName) {
|
auto callback = [&](ComponentRange componentsWithSameFileName) {
|
||||||
const auto &firstComponent = *componentsWithSameFileName.begin();
|
const auto &firstComponent = *componentsWithSameFileName.begin();
|
||||||
@@ -1511,11 +1511,11 @@ ProjectStorageUpdater::FileState ProjectStorageUpdater::fileState(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProjectStorageUpdater::FileState ProjectStorageUpdater::fileState(
|
ProjectStorageUpdater::FileState ProjectStorageUpdater::fileState(
|
||||||
SourceContextId sourceContextId,
|
DirectoryPathId directoryPathId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds) const
|
NotUpdatedSourceIds ¬UpdatedSourceIds) const
|
||||||
{
|
{
|
||||||
auto sourceId = SourceId::create(SourceNameId{}, sourceContextId);
|
auto sourceId = SourceId::create(FileNameId{}, directoryPathId);
|
||||||
return fileState(sourceId, package, notUpdatedSourceIds);
|
return fileState(sourceId, package, notUpdatedSourceIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -142,15 +142,15 @@ private:
|
|||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &WatchedSourceIds);
|
WatchedSourceIds &WatchedSourceIds);
|
||||||
void updateDirectory(const Utils::PathString &directory,
|
void updateDirectory(const Utils::PathString &directory,
|
||||||
const SourceContextIds &subdirecoriesToIgnore,
|
const DirectoryPathIds &subdirecoriesToIgnore,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &WatchedSourceIds,
|
WatchedSourceIds &WatchedSourceIds,
|
||||||
IsInsideProject isInsideProject);
|
IsInsideProject isInsideProject);
|
||||||
void updateSubdirectories(const Utils::PathString &directory,
|
void updateSubdirectories(const Utils::PathString &directory,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
FileState directoryFileState,
|
FileState directoryFileState,
|
||||||
const SourceContextIds &subdirecoriesToIgnore,
|
const DirectoryPathIds &subdirecoriesToIgnore,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &WatchedSourceIds,
|
WatchedSourceIds &WatchedSourceIds,
|
||||||
@@ -161,24 +161,24 @@ private:
|
|||||||
FileState annotationDirectoryState,
|
FileState annotationDirectoryState,
|
||||||
SourcePath qmldirSourcePath,
|
SourcePath qmldirSourcePath,
|
||||||
SourceId qmldirSourceId,
|
SourceId qmldirSourceId,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
SourceContextId annotationDirectoryId,
|
DirectoryPathId annotationDirectoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &WatchedSourceIds,
|
WatchedSourceIds &WatchedSourceIds,
|
||||||
IsInsideProject isInsideProject,
|
IsInsideProject isInsideProject,
|
||||||
ProjectStorageTracing::Category::TracerType &tracer);
|
ProjectStorageTracing::Category::TracerType &tracer);
|
||||||
void annotationDirectoryChanged(Utils::SmallStringView directoryPath,
|
void annotationDirectoryChanged(Utils::SmallStringView directoryPath,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
SourceContextId annotationDirectoryId,
|
DirectoryPathId annotationDirectoryId,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package);
|
Storage::Synchronization::SynchronizationPackage &package);
|
||||||
void updatePropertyEditorFiles(Utils::SmallStringView directyPath,
|
void updatePropertyEditorFiles(Utils::SmallStringView directyPath,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package);
|
Storage::Synchronization::SynchronizationPackage &package);
|
||||||
void updatePropertyEditorFile(const QString &fileName,
|
void updatePropertyEditorFile(const QString &fileName,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package);
|
Storage::Synchronization::SynchronizationPackage &package);
|
||||||
void updatePropertyEditorPaths(const QString &propertyEditorResourcesPath,
|
void updatePropertyEditorPaths(const QString &propertyEditorResourcesPath,
|
||||||
@@ -187,31 +187,31 @@ private:
|
|||||||
void updateTypeAnnotations(const QString &directoryPath,
|
void updateTypeAnnotations(const QString &directoryPath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
std::map<SourceContextId, SmallSourceIds<16>> &updatedSourceIdsDictonary);
|
std::map<DirectoryPathId, SmallSourceIds<16>> &updatedSourceIdsDictonary);
|
||||||
void updateTypeAnnotationDirectories(
|
void updateTypeAnnotationDirectories(
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
std::map<SourceContextId, SmallSourceIds<16>> &updatedSourceIdsDictonary);
|
std::map<DirectoryPathId, SmallSourceIds<16>> &updatedSourceIdsDictonary);
|
||||||
void updateTypeAnnotations(const QStringList &directoryPath,
|
void updateTypeAnnotations(const QStringList &directoryPath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds);
|
NotUpdatedSourceIds ¬UpdatedSourceIds);
|
||||||
void updateTypeAnnotation(const QString &directoryPath,
|
void updateTypeAnnotation(const QString &directoryPath,
|
||||||
const QString &filePath,
|
const QString &filePath,
|
||||||
SourceId sourceId,
|
SourceId sourceId,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package);
|
Storage::Synchronization::SynchronizationPackage &package);
|
||||||
void updatePropertyEditorPath(const QString &path,
|
void updatePropertyEditorPath(const QString &path,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
long long pathOffset);
|
long long pathOffset);
|
||||||
void updatePropertyEditorFilePath(const QString &filePath,
|
void updatePropertyEditorFilePath(const QString &filePath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
long long pathOffset);
|
long long pathOffset);
|
||||||
void parseTypeInfos(const QStringList &typeInfos,
|
void parseTypeInfos(const QStringList &typeInfos,
|
||||||
const std::vector<Utils::PathString> &qmldirDependencies,
|
const std::vector<Utils::PathString> &qmldirDependencies,
|
||||||
const std::vector<Utils::PathString> &qmldirImports,
|
const std::vector<Utils::PathString> &qmldirImports,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
const QString &directoryPath,
|
const QString &directoryPath,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
@@ -229,7 +229,7 @@ private:
|
|||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
IsInsideProject isInsideProject);
|
IsInsideProject isInsideProject);
|
||||||
void parseQmlComponents(Components components,
|
void parseQmlComponents(Components components,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &WatchedSourceIds,
|
WatchedSourceIds &WatchedSourceIds,
|
||||||
@@ -239,7 +239,7 @@ private:
|
|||||||
void parseQmlComponent(Utils::SmallStringView fileName,
|
void parseQmlComponent(Utils::SmallStringView fileName,
|
||||||
Utils::SmallStringView directory,
|
Utils::SmallStringView directory,
|
||||||
Storage::Synchronization::ExportedTypes exportedTypes,
|
Storage::Synchronization::ExportedTypes exportedTypes,
|
||||||
SourceContextId directoryId,
|
DirectoryPathId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &WatchedSourceIds,
|
WatchedSourceIds &WatchedSourceIds,
|
||||||
@@ -254,7 +254,7 @@ private:
|
|||||||
FileState fileState(SourceId sourceId,
|
FileState fileState(SourceId sourceId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds) const;
|
NotUpdatedSourceIds ¬UpdatedSourceIds) const;
|
||||||
FileState fileState(SourceContextId sourceContextId,
|
FileState fileState(DirectoryPathId directoryPathId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds) const;
|
NotUpdatedSourceIds ¬UpdatedSourceIds) const;
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ constexpr auto extraFileElementName = "ExtraFile"_L1;
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Synchronization::TypeAnnotations TypeAnnotationReader::parseTypeAnnotation(
|
Synchronization::TypeAnnotations TypeAnnotationReader::parseTypeAnnotation(
|
||||||
const QString &content, const QString &directoryPath, SourceId sourceId, SourceContextId directoryId)
|
const QString &content, const QString &directoryPath, SourceId sourceId, DirectoryPathId directoryId)
|
||||||
{
|
{
|
||||||
m_sourceId = sourceId;
|
m_sourceId = sourceId;
|
||||||
m_directoryId = directoryId;
|
m_directoryId = directoryId;
|
||||||
|
@@ -50,7 +50,7 @@ public:
|
|||||||
Synchronization::TypeAnnotations parseTypeAnnotation(const QString &content,
|
Synchronization::TypeAnnotations parseTypeAnnotation(const QString &content,
|
||||||
const QString &directoryPath,
|
const QString &directoryPath,
|
||||||
SourceId sourceId,
|
SourceId sourceId,
|
||||||
SourceContextId directoryId);
|
DirectoryPathId directoryId);
|
||||||
|
|
||||||
QStringList errors();
|
QStringList errors();
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ private:
|
|||||||
json m_itemLibraryEntries;
|
json m_itemLibraryEntries;
|
||||||
Property m_currentProperty;
|
Property m_currentProperty;
|
||||||
SourceId m_sourceId;
|
SourceId m_sourceId;
|
||||||
SourceContextId m_directoryId;
|
DirectoryPathId m_directoryId;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner::Storage
|
} // namespace QmlDesigner::Storage
|
||||||
|
@@ -31,8 +31,8 @@ class SourcePathCache final : public SourcePathCacheInterface
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SourcePathCache(Storage &storage)
|
SourcePathCache(Storage &storage)
|
||||||
: m_sourceContextStorageAdapter{storage}
|
: m_directoryPathStorageAdapter{storage}
|
||||||
, m_sourceNameStorageAdapter{storage}
|
, m_fileNameStorageAdapter{storage}
|
||||||
|
|
||||||
{
|
{
|
||||||
populateIfEmpty();
|
populateIfEmpty();
|
||||||
@@ -43,44 +43,44 @@ public:
|
|||||||
|
|
||||||
void populateIfEmpty() override
|
void populateIfEmpty() override
|
||||||
{
|
{
|
||||||
if (m_sourceNameCache.isEmpty()) {
|
if (m_fileNameCache.isEmpty()) {
|
||||||
m_sourceContextPathCache.populate();
|
m_directoryPathCache.populate();
|
||||||
m_sourceNameCache.populate();
|
m_fileNameCache.populate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceId sourceId(SourcePathView sourcePath) const override
|
SourceId sourceId(SourcePathView sourcePath) const override
|
||||||
{
|
{
|
||||||
Utils::SmallStringView sourceContextPath = sourcePath.directory();
|
Utils::SmallStringView directoryPath = sourcePath.directory();
|
||||||
|
|
||||||
auto sourceContextId = m_sourceContextPathCache.id(sourceContextPath);
|
auto directoryPathId = m_directoryPathCache.id(directoryPath);
|
||||||
|
|
||||||
Utils::SmallStringView sourceName = sourcePath.name();
|
Utils::SmallStringView fileName = sourcePath.name();
|
||||||
|
|
||||||
auto sourceNameId = m_sourceNameCache.id(sourceName);
|
auto fileNameId = m_fileNameCache.id(fileName);
|
||||||
|
|
||||||
return SourceId::create(sourceNameId, sourceContextId);
|
return SourceId::create(fileNameId, directoryPathId);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceNameId sourceNameId(Utils::SmallStringView sourceName) const override
|
FileNameId fileNameId(Utils::SmallStringView fileName) const override
|
||||||
{
|
{
|
||||||
return m_sourceNameCache.id(sourceName);
|
return m_fileNameCache.id(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceId sourceId(SourceContextId sourceContextId, Utils::SmallStringView sourceName) const override
|
SourceId sourceId(DirectoryPathId directoryPathId, Utils::SmallStringView fileName) const override
|
||||||
{
|
{
|
||||||
SourceNameId sourceNameId = m_sourceNameCache.id(sourceName);
|
FileNameId fileNameId = m_fileNameCache.id(fileName);
|
||||||
|
|
||||||
return SourceId::create(sourceNameId, sourceContextId);
|
return SourceId::create(fileNameId, directoryPathId);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceContextId sourceContextId(Utils::SmallStringView sourceContextPath) const override
|
DirectoryPathId directoryPathId(Utils::SmallStringView directoryPath) const override
|
||||||
{
|
{
|
||||||
Utils::SmallStringView path = sourceContextPath.back() == '/'
|
Utils::SmallStringView path = directoryPath.back() == '/'
|
||||||
? sourceContextPath.substr(0, sourceContextPath.size() - 1)
|
? directoryPath.substr(0, directoryPath.size() - 1)
|
||||||
: sourceContextPath;
|
: directoryPath;
|
||||||
|
|
||||||
return m_sourceContextPathCache.id(path);
|
return m_directoryPathCache.id(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourcePath sourcePath(SourceId sourceId) const override
|
SourcePath sourcePath(SourceId sourceId) const override
|
||||||
@@ -88,61 +88,61 @@ public:
|
|||||||
if (!sourceId) [[unlikely]]
|
if (!sourceId) [[unlikely]]
|
||||||
throw NoSourcePathForInvalidSourceId();
|
throw NoSourcePathForInvalidSourceId();
|
||||||
|
|
||||||
auto sourceName = m_sourceNameCache.value(sourceId.mainId());
|
auto fileName = m_fileNameCache.value(sourceId.mainId());
|
||||||
|
|
||||||
Utils::PathString sourceContextPath = m_sourceContextPathCache.value(sourceId.contextId());
|
Utils::PathString directoryPath = m_directoryPathCache.value(sourceId.contextId());
|
||||||
|
|
||||||
return SourcePath{sourceContextPath, sourceName};
|
return SourcePath{directoryPath, fileName};
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::PathString sourceContextPath(SourceContextId sourceContextId) const override
|
Utils::PathString directoryPath(DirectoryPathId directoryPathId) const override
|
||||||
{
|
{
|
||||||
if (!sourceContextId) [[unlikely]]
|
if (!directoryPathId) [[unlikely]]
|
||||||
throw NoSourceContextPathForInvalidSourceContextId();
|
throw NoDirectoryPathForInvalidDirectoryPathId();
|
||||||
|
|
||||||
return m_sourceContextPathCache.value(sourceContextId);
|
return m_directoryPathCache.value(directoryPathId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::SmallString sourceName(SourceNameId sourceNameId) const override
|
Utils::SmallString fileName(FileNameId fileNameId) const override
|
||||||
{
|
{
|
||||||
if (!sourceNameId) [[unlikely]]
|
if (!fileNameId) [[unlikely]]
|
||||||
throw NoSourceNameForInvalidSourceNameId();
|
throw NoFileNameForInvalidFileNameId();
|
||||||
|
|
||||||
return m_sourceNameCache.value(sourceNameId);
|
return m_fileNameCache.value(fileNameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class SourceContextStorageAdapter
|
class DirectoryPathStorageAdapter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
auto fetchId(Utils::SmallStringView sourceContextPath)
|
auto fetchId(Utils::SmallStringView directoryPath)
|
||||||
{
|
{
|
||||||
return storage.fetchSourceContextId(sourceContextPath);
|
return storage.fetchDirectoryPathId(directoryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto fetchValue(SourceContextId id) { return storage.fetchSourceContextPath(id); }
|
auto fetchValue(DirectoryPathId id) { return storage.fetchDirectoryPath(id); }
|
||||||
|
|
||||||
auto fetchAll() { return storage.fetchAllSourceContexts(); }
|
auto fetchAll() { return storage.fetchAllDirectoryPaths(); }
|
||||||
|
|
||||||
Storage &storage;
|
Storage &storage;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SourceNameStorageAdapter
|
class FileNameStorageAdapter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
auto fetchId(Utils::SmallStringView sourceNameView)
|
auto fetchId(Utils::SmallStringView fileNameView)
|
||||||
{
|
{
|
||||||
return storage.fetchSourceNameId(sourceNameView);
|
return storage.fetchFileNameId(fileNameView);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto fetchValue(SourceNameId id) { return storage.fetchSourceName(id); }
|
auto fetchValue(FileNameId id) { return storage.fetchFileName(id); }
|
||||||
|
|
||||||
auto fetchAll() { return storage.fetchAllSourceNames(); }
|
auto fetchAll() { return storage.fetchAllFileNames(); }
|
||||||
|
|
||||||
Storage &storage;
|
Storage &storage;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SourceNameLess
|
struct FileNameLess
|
||||||
{
|
{
|
||||||
bool operator()(Utils::SmallStringView first, Utils::SmallStringView second) const noexcept
|
bool operator()(Utils::SmallStringView first, Utils::SmallStringView second) const noexcept
|
||||||
{
|
{
|
||||||
@@ -150,7 +150,7 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SourceContextLess
|
struct DirectoryPathLess
|
||||||
{
|
{
|
||||||
bool operator()(Utils::SmallStringView first, Utils::SmallStringView second) const noexcept
|
bool operator()(Utils::SmallStringView first, Utils::SmallStringView second) const noexcept
|
||||||
{
|
{
|
||||||
@@ -161,26 +161,26 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using SourceContextPathCache = StorageCache<Utils::PathString,
|
using DirectoryPathCache = StorageCache<Utils::PathString,
|
||||||
Utils::SmallStringView,
|
Utils::SmallStringView,
|
||||||
SourceContextId,
|
DirectoryPathId,
|
||||||
SourceContextStorageAdapter,
|
DirectoryPathStorageAdapter,
|
||||||
Mutex,
|
Mutex,
|
||||||
SourceContextLess,
|
DirectoryPathLess,
|
||||||
Cache::SourceContext>;
|
Cache::DirectoryPath>;
|
||||||
using SourceNameCache = StorageCache<Utils::SmallString,
|
using FileNameCache = StorageCache<Utils::SmallString,
|
||||||
Utils::SmallStringView,
|
Utils::SmallStringView,
|
||||||
SourceNameId,
|
FileNameId,
|
||||||
SourceNameStorageAdapter,
|
FileNameStorageAdapter,
|
||||||
Mutex,
|
Mutex,
|
||||||
SourceNameLess,
|
FileNameLess,
|
||||||
Cache::SourceName>;
|
Cache::FileName>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SourceContextStorageAdapter m_sourceContextStorageAdapter;
|
DirectoryPathStorageAdapter m_directoryPathStorageAdapter;
|
||||||
SourceNameStorageAdapter m_sourceNameStorageAdapter;
|
FileNameStorageAdapter m_fileNameStorageAdapter;
|
||||||
mutable SourceContextPathCache m_sourceContextPathCache{m_sourceContextStorageAdapter};
|
mutable DirectoryPathCache m_directoryPathCache{m_directoryPathStorageAdapter};
|
||||||
mutable SourceNameCache m_sourceNameCache{m_sourceNameStorageAdapter};
|
mutable FileNameCache m_fileNameCache{m_fileNameStorageAdapter};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
@@ -24,19 +24,19 @@ public:
|
|||||||
|
|
||||||
virtual SourceId sourceId(SourcePathView sourcePath) const = 0;
|
virtual SourceId sourceId(SourcePathView sourcePath) const = 0;
|
||||||
|
|
||||||
virtual SourceId sourceId(SourceContextId sourceContextId,
|
virtual SourceId sourceId(DirectoryPathId directoryPathId,
|
||||||
Utils::SmallStringView sourceName) const
|
Utils::SmallStringView fileName) const
|
||||||
= 0;
|
= 0;
|
||||||
|
|
||||||
virtual SourceNameId sourceNameId(Utils::SmallStringView sourceName) const = 0;
|
virtual FileNameId fileNameId(Utils::SmallStringView fileName) const = 0;
|
||||||
|
|
||||||
virtual SourceContextId sourceContextId(Utils::SmallStringView sourceContextPath) const = 0;
|
virtual DirectoryPathId directoryPathId(Utils::SmallStringView directoryPath) const = 0;
|
||||||
|
|
||||||
virtual SourcePath sourcePath(SourceId sourceId) const = 0;
|
virtual SourcePath sourcePath(SourceId sourceId) const = 0;
|
||||||
|
|
||||||
virtual Utils::PathString sourceContextPath(SourceContextId sourceContextId) const = 0;
|
virtual Utils::PathString directoryPath(DirectoryPathId directoryPathId) const = 0;
|
||||||
|
|
||||||
virtual Utils::SmallString sourceName(SourceNameId sourceNameId) const = 0;
|
virtual Utils::SmallString fileName(FileNameId fileNameId) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~SourcePathCacheInterface() = default;
|
~SourcePathCacheInterface() = default;
|
||||||
|
@@ -13,35 +13,35 @@
|
|||||||
namespace QmlDesigner::Cache {
|
namespace QmlDesigner::Cache {
|
||||||
|
|
||||||
|
|
||||||
class SourceContext
|
class DirectoryPath
|
||||||
: public StorageCacheEntry<Utils::PathString, Utils::SmallStringView, SourceContextId>
|
: public StorageCacheEntry<Utils::PathString, Utils::SmallStringView, DirectoryPathId>
|
||||||
{
|
{
|
||||||
using Base = StorageCacheEntry<Utils::PathString, Utils::SmallStringView, SourceContextId>;
|
using Base = StorageCacheEntry<Utils::PathString, Utils::SmallStringView, DirectoryPathId>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Base::Base;
|
using Base::Base;
|
||||||
|
|
||||||
friend bool operator==(const SourceContext &first, const SourceContext &second)
|
friend bool operator==(const DirectoryPath &first, const DirectoryPath &second)
|
||||||
{
|
{
|
||||||
return first.id == second.id && first.value == second.value;
|
return first.id == second.id && first.value == second.value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using SourceContexts = std::vector<SourceContext>;
|
using DirectoryPaths = std::vector<DirectoryPath>;
|
||||||
|
|
||||||
class SourceName : public StorageCacheEntry<Utils::PathString, Utils::SmallStringView, SourceNameId>
|
class FileName : public StorageCacheEntry<Utils::PathString, Utils::SmallStringView, FileNameId>
|
||||||
{
|
{
|
||||||
using Base = StorageCacheEntry<Utils::PathString, Utils::SmallStringView, SourceNameId>;
|
using Base = StorageCacheEntry<Utils::PathString, Utils::SmallStringView, FileNameId>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Base::Base;
|
using Base::Base;
|
||||||
|
|
||||||
friend bool operator==(const SourceName &first, const SourceName &second)
|
friend bool operator==(const FileName &first, const FileName &second)
|
||||||
{
|
{
|
||||||
return first.id == second.id && first.value == second.value;
|
return first.id == second.id && first.value == second.value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using SourceNames = std::vector<SourceName>;
|
using FileNames = std::vector<FileName>;
|
||||||
|
|
||||||
} // namespace QmlDesigner::Cache
|
} // namespace QmlDesigner::Cache
|
||||||
|
@@ -26,42 +26,42 @@ const char *NoSourcePathForInvalidSourceId::what() const noexcept
|
|||||||
return "You cannot get a file path for an invalid file path id!";
|
return "You cannot get a file path for an invalid file path id!";
|
||||||
}
|
}
|
||||||
|
|
||||||
NoSourceContextPathForInvalidSourceContextId::NoSourceContextPathForInvalidSourceContextId()
|
NoDirectoryPathForInvalidDirectoryPathId::NoDirectoryPathForInvalidDirectoryPathId()
|
||||||
{
|
{
|
||||||
category().threadEvent("NoSourceContextPathForInvalidSourceContextId");
|
category().threadEvent("NoDirectoryPathForInvalidDirectoryPathId");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *NoSourceContextPathForInvalidSourceContextId::what() const noexcept
|
const char *NoDirectoryPathForInvalidDirectoryPathId::what() const noexcept
|
||||||
{
|
{
|
||||||
return "You cannot get a directory path for an invalid directory path id!";
|
return "You cannot get a directory path for an invalid directory path id!";
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceContextIdDoesNotExists::SourceContextIdDoesNotExists()
|
DirectoryPathIdDoesNotExists::DirectoryPathIdDoesNotExists()
|
||||||
{
|
{
|
||||||
category().threadEvent("SourceContextIdDoesNotExists");
|
category().threadEvent("DirectoryPathIdDoesNotExists");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *SourceContextIdDoesNotExists::what() const noexcept
|
const char *DirectoryPathIdDoesNotExists::what() const noexcept
|
||||||
{
|
{
|
||||||
return "The source context id does not exist in the database!";
|
return "The source context id does not exist in the database!";
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceNameIdDoesNotExists::SourceNameIdDoesNotExists()
|
FileNameIdDoesNotExists::FileNameIdDoesNotExists()
|
||||||
{
|
{
|
||||||
category().threadEvent("SourceNameIdDoesNotExists");
|
category().threadEvent("FileNameIdDoesNotExists");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *SourceNameIdDoesNotExists::what() const noexcept
|
const char *FileNameIdDoesNotExists::what() const noexcept
|
||||||
{
|
{
|
||||||
return "The source id does not exist in the database!";
|
return "The source id does not exist in the database!";
|
||||||
}
|
}
|
||||||
|
|
||||||
NoSourceNameForInvalidSourceNameId::NoSourceNameForInvalidSourceNameId()
|
NoFileNameForInvalidFileNameId::NoFileNameForInvalidFileNameId()
|
||||||
{
|
{
|
||||||
category().threadEvent("NoSourceNameForInvalidSourceNameId");
|
category().threadEvent("NoFileNameForInvalidFileNameId");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *NoSourceNameForInvalidSourceNameId::what() const noexcept
|
const char *NoFileNameForInvalidFileNameId::what() const noexcept
|
||||||
{
|
{
|
||||||
return "You cannot get a source name for an invalid source name id!";
|
return "You cannot get a source name for an invalid source name id!";
|
||||||
}
|
}
|
||||||
|
@@ -27,31 +27,31 @@ public:
|
|||||||
const char *what() const noexcept override;
|
const char *what() const noexcept override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT NoSourceNameForInvalidSourceNameId : public SourcePathError
|
class QMLDESIGNERCORE_EXPORT NoFileNameForInvalidFileNameId : public SourcePathError
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NoSourceNameForInvalidSourceNameId();
|
NoFileNameForInvalidFileNameId();
|
||||||
const char *what() const noexcept override;
|
const char *what() const noexcept override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT NoSourceContextPathForInvalidSourceContextId : public SourcePathError
|
class QMLDESIGNERCORE_EXPORT NoDirectoryPathForInvalidDirectoryPathId : public SourcePathError
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NoSourceContextPathForInvalidSourceContextId();
|
NoDirectoryPathForInvalidDirectoryPathId();
|
||||||
const char *what() const noexcept override;
|
const char *what() const noexcept override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT SourceContextIdDoesNotExists : public SourcePathError
|
class QMLDESIGNERCORE_EXPORT DirectoryPathIdDoesNotExists : public SourcePathError
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SourceContextIdDoesNotExists();
|
DirectoryPathIdDoesNotExists();
|
||||||
const char *what() const noexcept override;
|
const char *what() const noexcept override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT SourceNameIdDoesNotExists : public SourcePathError
|
class QMLDESIGNERCORE_EXPORT FileNameIdDoesNotExists : public SourcePathError
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SourceNameIdDoesNotExists();
|
FileNameIdDoesNotExists();
|
||||||
const char *what() const noexcept override;
|
const char *what() const noexcept override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -18,24 +18,24 @@ struct SourcePathStorage::Statements
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Sqlite::Database &database;
|
Sqlite::Database &database;
|
||||||
mutable Sqlite::ReadStatement<1, 1> selectSourceContextIdFromSourceContextsBySourceContextPathStatement{
|
mutable Sqlite::ReadStatement<1, 1> selectDirectoryPathIdFromDirectoryPathsByDirectoryPathStatement{
|
||||||
"SELECT sourceContextId FROM sourceContexts WHERE sourceContextPath = ?", database};
|
"SELECT directoryPathId FROM directoryPaths WHERE directoryPath = ?", database};
|
||||||
mutable Sqlite::ReadStatement<1, 1> selectSourceContextPathFromSourceContextsBySourceContextIdStatement{
|
mutable Sqlite::ReadStatement<1, 1> selectDirectoryPathFromDirectoryPathsByDirectoryPathIdStatement{
|
||||||
"SELECT sourceContextPath FROM sourceContexts WHERE sourceContextId = ?", database};
|
"SELECT directoryPath FROM directoryPaths WHERE directoryPathId = ?", database};
|
||||||
mutable Sqlite::ReadStatement<2> selectAllSourceContextsStatement{
|
mutable Sqlite::ReadStatement<2> selectAllDirectoryPathsStatement{
|
||||||
"SELECT sourceContextPath, sourceContextId FROM sourceContexts", database};
|
"SELECT directoryPath, directoryPathId FROM directoryPaths", database};
|
||||||
Sqlite::WriteStatement<1> insertIntoSourceContextsStatement{
|
Sqlite::WriteStatement<1> insertIntoDirectoryPathsStatement{
|
||||||
"INSERT INTO sourceContexts(sourceContextPath) VALUES (?)", database};
|
"INSERT INTO directoryPaths(directoryPath) VALUES (?)", database};
|
||||||
mutable Sqlite::ReadStatement<1, 1> selectSourceNameIdFromSourceNamesBySourceNameStatement{
|
mutable Sqlite::ReadStatement<1, 1> selectFileNameIdFromFileNamesByFileNameStatement{
|
||||||
"SELECT sourceNameId FROM sourceNames WHERE sourceName = ?", database};
|
"SELECT fileNameId FROM fileNames WHERE fileName = ?", database};
|
||||||
mutable Sqlite::ReadStatement<1, 1> selectSourceNameFromSourceNamesBySourceNameIdStatement{
|
mutable Sqlite::ReadStatement<1, 1> selectFileNameFromFileNamesByFileNameIdStatement{
|
||||||
"SELECT sourceName FROM sourceNames WHERE sourceNameId = ?", database};
|
"SELECT fileName FROM fileNames WHERE fileNameId = ?", database};
|
||||||
Sqlite::WriteStatement<1> insertIntoSourcesStatement{
|
Sqlite::WriteStatement<1> insertIntoSourcesStatement{
|
||||||
"INSERT INTO sourceNames(sourceName) VALUES (?)", database};
|
"INSERT INTO fileNames(fileName) VALUES (?)", database};
|
||||||
mutable Sqlite::ReadStatement<2> selectAllSourcesStatement{
|
mutable Sqlite::ReadStatement<2> selectAllSourcesStatement{
|
||||||
"SELECT sourceName, sourceNameId FROM sourceNames", database};
|
"SELECT fileName, fileNameId FROM fileNames", database};
|
||||||
Sqlite::WriteStatement<0> deleteAllSourceNamesStatement{"DELETE FROM sourceNames", database};
|
Sqlite::WriteStatement<0> deleteAllFileNamesStatement{"DELETE FROM fileNames", database};
|
||||||
Sqlite::WriteStatement<0> deleteAllSourceContextsStatement{"DELETE FROM sourceContexts", database};
|
Sqlite::WriteStatement<0> deleteAllDirectoryPathsStatement{"DELETE FROM directoryPaths", database};
|
||||||
};
|
};
|
||||||
|
|
||||||
class SourcePathStorage::Initializer
|
class SourcePathStorage::Initializer
|
||||||
@@ -44,32 +44,32 @@ public:
|
|||||||
Initializer(Database &database, bool isInitialized)
|
Initializer(Database &database, bool isInitialized)
|
||||||
{
|
{
|
||||||
if (!isInitialized) {
|
if (!isInitialized) {
|
||||||
createSourceContextsTable(database);
|
createDirectoryPathsTable(database);
|
||||||
createSourceNamesTable(database);
|
createFileNamesTable(database);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void createSourceContextsTable(Database &database)
|
void createDirectoryPathsTable(Database &database)
|
||||||
{
|
{
|
||||||
Sqlite::Table table;
|
Sqlite::Table table;
|
||||||
table.setUseIfNotExists(true);
|
table.setUseIfNotExists(true);
|
||||||
table.setName("sourceContexts");
|
table.setName("directoryPaths");
|
||||||
table.addColumn("sourceContextId", Sqlite::ColumnType::Integer, {Sqlite::PrimaryKey{}});
|
table.addColumn("directoryPathId", Sqlite::ColumnType::Integer, {Sqlite::PrimaryKey{}});
|
||||||
const Sqlite::Column &sourceContextPathColumn = table.addColumn("sourceContextPath");
|
const Sqlite::Column &directoryPathColumn = table.addColumn("directoryPath");
|
||||||
|
|
||||||
table.addUniqueIndex({sourceContextPathColumn});
|
table.addUniqueIndex({directoryPathColumn});
|
||||||
|
|
||||||
table.initialize(database);
|
table.initialize(database);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createSourceNamesTable(Database &database)
|
void createFileNamesTable(Database &database)
|
||||||
{
|
{
|
||||||
Sqlite::StrictTable table;
|
Sqlite::StrictTable table;
|
||||||
table.setUseIfNotExists(true);
|
table.setUseIfNotExists(true);
|
||||||
table.setName("sourceNames");
|
table.setName("fileNames");
|
||||||
table.addColumn("sourceNameId", Sqlite::StrictColumnType::Integer, {Sqlite::PrimaryKey{}});
|
table.addColumn("fileNameId", Sqlite::StrictColumnType::Integer, {Sqlite::PrimaryKey{}});
|
||||||
const auto &sourceNameColumn = table.addColumn("sourceName", Sqlite::StrictColumnType::Text);
|
const auto &fileNameColumn = table.addColumn("fileName", Sqlite::StrictColumnType::Text);
|
||||||
table.addUniqueIndex({sourceNameColumn});
|
table.addUniqueIndex({fileNameColumn});
|
||||||
|
|
||||||
table.initialize(database);
|
table.initialize(database);
|
||||||
}
|
}
|
||||||
@@ -88,52 +88,52 @@ SourcePathStorage::SourcePathStorage(Database &database, bool isInitialized)
|
|||||||
|
|
||||||
SourcePathStorage::~SourcePathStorage() = default;
|
SourcePathStorage::~SourcePathStorage() = default;
|
||||||
|
|
||||||
SourceContextId SourcePathStorage::fetchSourceContextIdUnguarded(Utils::SmallStringView sourceContextPath)
|
DirectoryPathId SourcePathStorage::fetchDirectoryPathIdUnguarded(Utils::SmallStringView directoryPath)
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch source context id unguarded", category()};
|
NanotraceHR::Tracer tracer{"fetch source context id unguarded", category()};
|
||||||
|
|
||||||
auto sourceContextId = readSourceContextId(sourceContextPath);
|
auto directoryPathId = readDirectoryPathId(directoryPath);
|
||||||
|
|
||||||
return sourceContextId ? sourceContextId : writeSourceContextId(sourceContextPath);
|
return directoryPathId ? directoryPathId : writeDirectoryPathId(directoryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceContextId SourcePathStorage::fetchSourceContextId(Utils::SmallStringView sourceContextPath)
|
DirectoryPathId SourcePathStorage::fetchDirectoryPathId(Utils::SmallStringView directoryPath)
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch source context id",
|
NanotraceHR::Tracer tracer{"fetch source context id",
|
||||||
category(),
|
category(),
|
||||||
keyValue("source context path", sourceContextPath)};
|
keyValue("source context path", directoryPath)};
|
||||||
|
|
||||||
SourceContextId sourceContextId;
|
DirectoryPathId directoryPathId;
|
||||||
try {
|
try {
|
||||||
sourceContextId = Sqlite::withDeferredTransaction(database, [&] {
|
directoryPathId = Sqlite::withDeferredTransaction(database, [&] {
|
||||||
return fetchSourceContextIdUnguarded(sourceContextPath);
|
return fetchDirectoryPathIdUnguarded(directoryPath);
|
||||||
});
|
});
|
||||||
} catch (const Sqlite::ConstraintPreventsModification &) {
|
} catch (const Sqlite::ConstraintPreventsModification &) {
|
||||||
sourceContextId = fetchSourceContextId(sourceContextPath);
|
directoryPathId = fetchDirectoryPathId(directoryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
tracer.end(keyValue("source context id", sourceContextId));
|
tracer.end(keyValue("source context id", directoryPathId));
|
||||||
|
|
||||||
return sourceContextId;
|
return directoryPathId;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::PathString SourcePathStorage::fetchSourceContextPath(SourceContextId sourceContextId) const
|
Utils::PathString SourcePathStorage::fetchDirectoryPath(DirectoryPathId directoryPathId) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch source context path",
|
NanotraceHR::Tracer tracer{"fetch source context path",
|
||||||
category(),
|
category(),
|
||||||
keyValue("source context id", sourceContextId)};
|
keyValue("source context id", directoryPathId)};
|
||||||
|
|
||||||
auto path = Sqlite::withDeferredTransaction(database, [&] {
|
auto path = Sqlite::withDeferredTransaction(database, [&] {
|
||||||
auto optionalSourceContextPath = s->selectSourceContextPathFromSourceContextsBySourceContextIdStatement
|
auto optionalDirectoryPath = s->selectDirectoryPathFromDirectoryPathsByDirectoryPathIdStatement
|
||||||
.optionalValue<Utils::PathString>(sourceContextId);
|
.optionalValue<Utils::PathString>(directoryPathId);
|
||||||
|
|
||||||
if (!optionalSourceContextPath)
|
if (!optionalDirectoryPath)
|
||||||
throw SourceContextIdDoesNotExists();
|
throw DirectoryPathIdDoesNotExists();
|
||||||
|
|
||||||
return std::move(*optionalSourceContextPath);
|
return std::move(*optionalDirectoryPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
tracer.end(keyValue("source context path", path));
|
tracer.end(keyValue("source context path", path));
|
||||||
@@ -141,133 +141,133 @@ Utils::PathString SourcePathStorage::fetchSourceContextPath(SourceContextId sour
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache::SourceContexts SourcePathStorage::fetchAllSourceContexts() const
|
Cache::DirectoryPaths SourcePathStorage::fetchAllDirectoryPaths() const
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"fetch all source contexts", category()};
|
NanotraceHR::Tracer tracer{"fetch all source contexts", category()};
|
||||||
|
|
||||||
return s->selectAllSourceContextsStatement.valuesWithTransaction<Cache::SourceContext, 128>();
|
return s->selectAllDirectoryPathsStatement.valuesWithTransaction<Cache::DirectoryPath, 128>();
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceNameId SourcePathStorage::fetchSourceNameId(Utils::SmallStringView sourceName)
|
FileNameId SourcePathStorage::fetchFileNameId(Utils::SmallStringView fileName)
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch source id", category(), keyValue("source name", sourceName)};
|
NanotraceHR::Tracer tracer{"fetch source id", category(), keyValue("source name", fileName)};
|
||||||
|
|
||||||
auto sourceNameId = Sqlite::withDeferredTransaction(database, [&] {
|
auto fileNameId = Sqlite::withDeferredTransaction(database, [&] {
|
||||||
return fetchSourceNameIdUnguarded(sourceName);
|
return fetchFileNameIdUnguarded(fileName);
|
||||||
});
|
});
|
||||||
|
|
||||||
tracer.end(keyValue("source name id", sourceNameId));
|
tracer.end(keyValue("source name id", fileNameId));
|
||||||
|
|
||||||
return sourceNameId;
|
return fileNameId;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::SmallString SourcePathStorage::fetchSourceName(SourceNameId sourceNameId) const
|
Utils::SmallString SourcePathStorage::fetchFileName(FileNameId fileNameId) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch source name and source context id",
|
NanotraceHR::Tracer tracer{"fetch source name and source context id",
|
||||||
category(),
|
category(),
|
||||||
keyValue("source name id", sourceNameId)};
|
keyValue("source name id", fileNameId)};
|
||||||
|
|
||||||
auto sourceName = s->selectSourceNameFromSourceNamesBySourceNameIdStatement
|
auto fileName = s->selectFileNameFromFileNamesByFileNameIdStatement
|
||||||
.valueWithTransaction<Utils::SmallString>(sourceNameId);
|
.valueWithTransaction<Utils::SmallString>(fileNameId);
|
||||||
|
|
||||||
if (sourceName.empty())
|
if (fileName.empty())
|
||||||
throw SourceNameIdDoesNotExists();
|
throw FileNameIdDoesNotExists();
|
||||||
|
|
||||||
tracer.end(keyValue("source name", sourceName));
|
tracer.end(keyValue("source name", fileName));
|
||||||
|
|
||||||
return sourceName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourcePathStorage::clearSources()
|
void SourcePathStorage::clearSources()
|
||||||
{
|
{
|
||||||
Sqlite::withImmediateTransaction(database, [&] {
|
Sqlite::withImmediateTransaction(database, [&] {
|
||||||
s->deleteAllSourceContextsStatement.execute();
|
s->deleteAllDirectoryPathsStatement.execute();
|
||||||
s->deleteAllSourceNamesStatement.execute();
|
s->deleteAllFileNamesStatement.execute();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache::SourceNames SourcePathStorage::fetchAllSourceNames() const
|
Cache::FileNames SourcePathStorage::fetchAllFileNames() const
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"fetch all sources", category()};
|
NanotraceHR::Tracer tracer{"fetch all sources", category()};
|
||||||
|
|
||||||
return s->selectAllSourcesStatement.valuesWithTransaction<Cache::SourceName, 1024>();
|
return s->selectAllSourcesStatement.valuesWithTransaction<Cache::FileName, 1024>();
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceNameId SourcePathStorage::fetchSourceNameIdUnguarded(Utils::SmallStringView sourceName)
|
FileNameId SourcePathStorage::fetchFileNameIdUnguarded(Utils::SmallStringView fileName)
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch source id unguarded",
|
NanotraceHR::Tracer tracer{"fetch source id unguarded",
|
||||||
category(),
|
category(),
|
||||||
keyValue("source name", sourceName)};
|
keyValue("source name", fileName)};
|
||||||
|
|
||||||
auto sourceId = readSourceNameId(sourceName);
|
auto sourceId = readFileNameId(fileName);
|
||||||
|
|
||||||
if (!sourceId)
|
if (!sourceId)
|
||||||
sourceId = writeSourceNameId(sourceName);
|
sourceId = writeFileNameId(fileName);
|
||||||
|
|
||||||
tracer.end(keyValue("source id", sourceId));
|
tracer.end(keyValue("source id", sourceId));
|
||||||
|
|
||||||
return sourceId;
|
return sourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceContextId SourcePathStorage::readSourceContextId(Utils::SmallStringView sourceContextPath)
|
DirectoryPathId SourcePathStorage::readDirectoryPathId(Utils::SmallStringView directoryPath)
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"read source context id",
|
NanotraceHR::Tracer tracer{"read source context id",
|
||||||
category(),
|
category(),
|
||||||
keyValue("source context path", sourceContextPath)};
|
keyValue("source context path", directoryPath)};
|
||||||
|
|
||||||
auto sourceContextId = s->selectSourceContextIdFromSourceContextsBySourceContextPathStatement
|
auto directoryPathId = s->selectDirectoryPathIdFromDirectoryPathsByDirectoryPathStatement
|
||||||
.value<SourceContextId>(sourceContextPath);
|
.value<DirectoryPathId>(directoryPath);
|
||||||
|
|
||||||
tracer.end(keyValue("source context id", sourceContextId));
|
tracer.end(keyValue("source context id", directoryPathId));
|
||||||
|
|
||||||
return sourceContextId;
|
return directoryPathId;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceContextId SourcePathStorage::writeSourceContextId(Utils::SmallStringView sourceContextPath)
|
DirectoryPathId SourcePathStorage::writeDirectoryPathId(Utils::SmallStringView directoryPath)
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"write source context id",
|
NanotraceHR::Tracer tracer{"write source context id",
|
||||||
category(),
|
category(),
|
||||||
keyValue("source context path", sourceContextPath)};
|
keyValue("source context path", directoryPath)};
|
||||||
|
|
||||||
s->insertIntoSourceContextsStatement.write(sourceContextPath);
|
s->insertIntoDirectoryPathsStatement.write(directoryPath);
|
||||||
|
|
||||||
auto sourceContextId = SourceContextId::create(static_cast<int>(database.lastInsertedRowId()));
|
auto directoryPathId = DirectoryPathId::create(static_cast<int>(database.lastInsertedRowId()));
|
||||||
|
|
||||||
tracer.end(keyValue("source context id", sourceContextId));
|
tracer.end(keyValue("source context id", directoryPathId));
|
||||||
|
|
||||||
return sourceContextId;
|
return directoryPathId;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceNameId SourcePathStorage::writeSourceNameId(Utils::SmallStringView sourceName)
|
FileNameId SourcePathStorage::writeFileNameId(Utils::SmallStringView fileName)
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"write source id", category(), keyValue("source name", sourceName)};
|
NanotraceHR::Tracer tracer{"write source id", category(), keyValue("source name", fileName)};
|
||||||
|
|
||||||
s->insertIntoSourcesStatement.write(sourceName);
|
s->insertIntoSourcesStatement.write(fileName);
|
||||||
|
|
||||||
auto sourceNameId = SourceNameId::create(static_cast<int>(database.lastInsertedRowId()));
|
auto fileNameId = FileNameId::create(static_cast<int>(database.lastInsertedRowId()));
|
||||||
|
|
||||||
tracer.end(keyValue("source name id", sourceNameId));
|
tracer.end(keyValue("source name id", fileNameId));
|
||||||
|
|
||||||
return sourceNameId;
|
return fileNameId;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceNameId SourcePathStorage::readSourceNameId(Utils::SmallStringView sourceName)
|
FileNameId SourcePathStorage::readFileNameId(Utils::SmallStringView fileName)
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"read source id", category(), keyValue("source name", sourceName)};
|
NanotraceHR::Tracer tracer{"read source id", category(), keyValue("source name", fileName)};
|
||||||
|
|
||||||
auto sourceNameId = s->selectSourceNameIdFromSourceNamesBySourceNameStatement.value<SourceNameId>(
|
auto fileNameId = s->selectFileNameIdFromFileNamesByFileNameStatement.value<FileNameId>(
|
||||||
sourceName);
|
fileName);
|
||||||
|
|
||||||
tracer.end(keyValue("source id", sourceNameId));
|
tracer.end(keyValue("source id", fileNameId));
|
||||||
|
|
||||||
return sourceNameId;
|
return fileNameId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourcePathStorage::resetForTestsOnly()
|
void SourcePathStorage::resetForTestsOnly()
|
||||||
|
@@ -21,34 +21,34 @@ public:
|
|||||||
SourcePathStorage(Database &database, bool isInitialized);
|
SourcePathStorage(Database &database, bool isInitialized);
|
||||||
~SourcePathStorage();
|
~SourcePathStorage();
|
||||||
|
|
||||||
SourceContextId fetchSourceContextIdUnguarded(Utils::SmallStringView sourceContextPath);
|
DirectoryPathId fetchDirectoryPathIdUnguarded(Utils::SmallStringView directoryPath);
|
||||||
|
|
||||||
SourceContextId fetchSourceContextId(Utils::SmallStringView sourceContextPath);
|
DirectoryPathId fetchDirectoryPathId(Utils::SmallStringView directoryPath);
|
||||||
|
|
||||||
Utils::PathString fetchSourceContextPath(SourceContextId sourceContextId) const;
|
Utils::PathString fetchDirectoryPath(DirectoryPathId directoryPathId) const;
|
||||||
|
|
||||||
Cache::SourceContexts fetchAllSourceContexts() const;
|
Cache::DirectoryPaths fetchAllDirectoryPaths() const;
|
||||||
|
|
||||||
SourceNameId fetchSourceNameId(Utils::SmallStringView sourceName);
|
FileNameId fetchFileNameId(Utils::SmallStringView fileName);
|
||||||
|
|
||||||
Utils::SmallString fetchSourceName(SourceNameId sourceId) const;
|
Utils::SmallString fetchFileName(FileNameId sourceId) const;
|
||||||
|
|
||||||
void clearSources();
|
void clearSources();
|
||||||
|
|
||||||
Cache::SourceNames fetchAllSourceNames() const;
|
Cache::FileNames fetchAllFileNames() const;
|
||||||
|
|
||||||
SourceNameId fetchSourceNameIdUnguarded(Utils::SmallStringView sourceName);
|
FileNameId fetchFileNameIdUnguarded(Utils::SmallStringView fileName);
|
||||||
|
|
||||||
void resetForTestsOnly();
|
void resetForTestsOnly();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SourceContextId readSourceContextId(Utils::SmallStringView sourceContextPath);
|
DirectoryPathId readDirectoryPathId(Utils::SmallStringView directoryPath);
|
||||||
|
|
||||||
SourceContextId writeSourceContextId(Utils::SmallStringView sourceContextPath);
|
DirectoryPathId writeDirectoryPathId(Utils::SmallStringView directoryPath);
|
||||||
|
|
||||||
SourceNameId writeSourceNameId(Utils::SmallStringView sourceName);
|
FileNameId writeFileNameId(Utils::SmallStringView fileName);
|
||||||
|
|
||||||
SourceNameId readSourceNameId(Utils::SmallStringView sourceName);
|
FileNameId readFileNameId(Utils::SmallStringView fileName);
|
||||||
|
|
||||||
class Initializer;
|
class Initializer;
|
||||||
|
|
||||||
|
@@ -214,10 +214,10 @@ public:
|
|||||||
, qmlDocumentParser{storage, pathCache}
|
, qmlDocumentParser{storage, pathCache}
|
||||||
, pathWatcher{pathCache, fileStatusCache, &updater}
|
, pathWatcher{pathCache, fileStatusCache, &updater}
|
||||||
, projectPartId{ProjectPartId::create(
|
, projectPartId{ProjectPartId::create(
|
||||||
pathCache.sourceContextId(Utils::PathString{project->projectDirectory().path()})
|
pathCache.directoryPathId(Utils::PathString{project->projectDirectory().path()})
|
||||||
.internalId())}
|
.internalId())}
|
||||||
, qtPartId{ProjectPartId::create(
|
, qtPartId{ProjectPartId::create(
|
||||||
pathCache.sourceContextId(Utils::PathString{qmlPath(project)}).internalId())}
|
pathCache.directoryPathId(Utils::PathString{qmlPath(project)}).internalId())}
|
||||||
, updater{fileSystem,
|
, updater{fileSystem,
|
||||||
storage,
|
storage,
|
||||||
fileStatusCache,
|
fileStatusCache,
|
||||||
|
@@ -78,7 +78,7 @@ MATCHER_P3(IsItemLibraryProperty,
|
|||||||
|
|
||||||
template<typename IconPathMatcher, typename TypeTraitsMatcher, typename HintsJsonMatcher, typename ItemLibraryJsonMatcher>
|
template<typename IconPathMatcher, typename TypeTraitsMatcher, typename HintsJsonMatcher, typename ItemLibraryJsonMatcher>
|
||||||
auto IsTypeAnnotation(QmlDesigner::SourceId sourceId,
|
auto IsTypeAnnotation(QmlDesigner::SourceId sourceId,
|
||||||
QmlDesigner::SourceContextId directoryId,
|
QmlDesigner::DirectoryPathId directoryId,
|
||||||
Utils::SmallStringView typeName,
|
Utils::SmallStringView typeName,
|
||||||
QmlDesigner::ModuleId moduleId,
|
QmlDesigner::ModuleId moduleId,
|
||||||
IconPathMatcher iconPath,
|
IconPathMatcher iconPath,
|
||||||
|
@@ -207,9 +207,9 @@ public:
|
|||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(QmlDesigner::SmallSourceIds<4>,
|
MOCK_METHOD(QmlDesigner::SmallSourceIds<4>,
|
||||||
typeAnnotationSourceIds,
|
typeAnnotationSourceIds,
|
||||||
(QmlDesigner::SourceContextId directoryId),
|
(QmlDesigner::DirectoryPathId directoryId),
|
||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(QmlDesigner::SmallSourceContextIds<64>,
|
MOCK_METHOD(QmlDesigner::SmallDirectoryPathIds<64>,
|
||||||
typeAnnotationDirectoryIds,
|
typeAnnotationDirectoryIds,
|
||||||
(),
|
(),
|
||||||
(const, override));
|
(const, override));
|
||||||
@@ -315,18 +315,18 @@ public:
|
|||||||
|
|
||||||
MOCK_METHOD(QmlDesigner::Storage::Synchronization::DirectoryInfos,
|
MOCK_METHOD(QmlDesigner::Storage::Synchronization::DirectoryInfos,
|
||||||
fetchDirectoryInfos,
|
fetchDirectoryInfos,
|
||||||
(QmlDesigner::SourceContextId directoryId),
|
(QmlDesigner::DirectoryPathId directoryId),
|
||||||
(const, override));
|
(const, override));
|
||||||
|
|
||||||
MOCK_METHOD(QmlDesigner::Storage::Synchronization::DirectoryInfos,
|
MOCK_METHOD(QmlDesigner::Storage::Synchronization::DirectoryInfos,
|
||||||
fetchDirectoryInfos,
|
fetchDirectoryInfos,
|
||||||
(QmlDesigner::SourceContextId directoryId,
|
(QmlDesigner::DirectoryPathId directoryId,
|
||||||
QmlDesigner::Storage::Synchronization::FileType),
|
QmlDesigner::Storage::Synchronization::FileType),
|
||||||
(const, override));
|
(const, override));
|
||||||
|
|
||||||
MOCK_METHOD(QmlDesigner::SmallSourceContextIds<32>,
|
MOCK_METHOD(QmlDesigner::SmallDirectoryPathIds<32>,
|
||||||
fetchSubdirectoryIds,
|
fetchSubdirectoryIds,
|
||||||
(QmlDesigner::SourceContextId directoryId),
|
(QmlDesigner::DirectoryPathId directoryId),
|
||||||
(const, override));
|
(const, override));
|
||||||
|
|
||||||
MOCK_METHOD(std::optional<QmlDesigner::Storage::Synchronization::DirectoryInfo>,
|
MOCK_METHOD(std::optional<QmlDesigner::Storage::Synchronization::DirectoryInfo>,
|
||||||
@@ -334,25 +334,25 @@ public:
|
|||||||
(QmlDesigner::SourceId sourceId),
|
(QmlDesigner::SourceId sourceId),
|
||||||
(const, override));
|
(const, override));
|
||||||
|
|
||||||
MOCK_METHOD(QmlDesigner::SourceContextId,
|
MOCK_METHOD(QmlDesigner::DirectoryPathId,
|
||||||
fetchSourceContextId,
|
fetchDirectoryPathId,
|
||||||
(::Utils::SmallStringView SourceContextPath),
|
(::Utils::SmallStringView DirectoryPath),
|
||||||
());
|
());
|
||||||
MOCK_METHOD(QmlDesigner::SourceNameId, fetchSourceNameId, (::Utils::SmallStringView sourceName), ());
|
MOCK_METHOD(QmlDesigner::FileNameId, fetchFileNameId, (::Utils::SmallStringView fileName), ());
|
||||||
MOCK_METHOD(QmlDesigner::SourceContextId,
|
MOCK_METHOD(QmlDesigner::DirectoryPathId,
|
||||||
fetchSourceContextIdUnguarded,
|
fetchDirectoryPathIdUnguarded,
|
||||||
(::Utils::SmallStringView sourceContextPath),
|
(::Utils::SmallStringView directoryPath),
|
||||||
());
|
());
|
||||||
MOCK_METHOD(QmlDesigner::SourceNameId,
|
MOCK_METHOD(QmlDesigner::FileNameId,
|
||||||
fetchSourceNameIdUnguarded,
|
fetchFileNameIdUnguarded,
|
||||||
(::Utils::SmallStringView sourceName),
|
(::Utils::SmallStringView fileName),
|
||||||
());
|
());
|
||||||
MOCK_METHOD(::Utils::PathString,
|
MOCK_METHOD(::Utils::PathString,
|
||||||
fetchSourceContextPath,
|
fetchDirectoryPath,
|
||||||
(QmlDesigner::SourceContextId sourceContextId));
|
(QmlDesigner::DirectoryPathId directoryPathId));
|
||||||
MOCK_METHOD(Utils::SmallString, fetchSourceName, (QmlDesigner::SourceNameId sourceId));
|
MOCK_METHOD(Utils::SmallString, fetchFileName, (QmlDesigner::FileNameId sourceId));
|
||||||
MOCK_METHOD(std::vector<QmlDesigner::Cache::SourceContext>, fetchAllSourceContexts, (), ());
|
MOCK_METHOD(std::vector<QmlDesigner::Cache::DirectoryPath>, fetchAllDirectoryPaths, (), ());
|
||||||
MOCK_METHOD(std::vector<QmlDesigner::Cache::SourceName>, fetchAllSourceNames, (), ());
|
MOCK_METHOD(std::vector<QmlDesigner::Cache::FileName>, fetchAllFileNames, (), ());
|
||||||
|
|
||||||
MOCK_METHOD(QmlDesigner::SourceId,
|
MOCK_METHOD(QmlDesigner::SourceId,
|
||||||
propertyEditorPathId,
|
propertyEditorPathId,
|
||||||
|
@@ -14,7 +14,7 @@ public:
|
|||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void,
|
||||||
updateContextIdPaths,
|
updateContextIdPaths,
|
||||||
(const std::vector<QmlDesigner::IdPaths> &idPaths,
|
(const std::vector<QmlDesigner::IdPaths> &idPaths,
|
||||||
const QmlDesigner::SourceContextIds &sourceContextIds),
|
const QmlDesigner::DirectoryPathIds &directoryPathIds),
|
||||||
(override));
|
(override));
|
||||||
MOCK_METHOD(void, removeIds, (const QmlDesigner::ProjectPartIds &ids), (override));
|
MOCK_METHOD(void, removeIds, (const QmlDesigner::ProjectPartIds &ids), (override));
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void,
|
||||||
|
@@ -14,6 +14,6 @@ public:
|
|||||||
|
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void,
|
||||||
checkForChangeInDirectory,
|
checkForChangeInDirectory,
|
||||||
(QmlDesigner::SourceContextIds sourceContextIds),
|
(QmlDesigner::DirectoryPathIds directoryPathIds),
|
||||||
(override));
|
(override));
|
||||||
};
|
};
|
||||||
|
@@ -22,27 +22,27 @@ public:
|
|||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(QmlDesigner::SourceId,
|
MOCK_METHOD(QmlDesigner::SourceId,
|
||||||
sourceId,
|
sourceId,
|
||||||
(QmlDesigner::SourceContextId sourceContextId, Utils::SmallStringView sourceName),
|
(QmlDesigner::DirectoryPathId directoryPathId, Utils::SmallStringView fileName),
|
||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(QmlDesigner::SourceNameId,
|
MOCK_METHOD(QmlDesigner::FileNameId,
|
||||||
sourceNameId,
|
fileNameId,
|
||||||
(Utils::SmallStringView sourceName),
|
(Utils::SmallStringView fileName),
|
||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(QmlDesigner::SourcePath,
|
MOCK_METHOD(QmlDesigner::SourcePath,
|
||||||
sourcePath,
|
sourcePath,
|
||||||
(QmlDesigner::SourceId sourceId),
|
(QmlDesigner::SourceId sourceId),
|
||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(QmlDesigner::SourceContextId,
|
MOCK_METHOD(QmlDesigner::DirectoryPathId,
|
||||||
sourceContextId,
|
directoryPathId,
|
||||||
(Utils::SmallStringView directoryPath),
|
(Utils::SmallStringView directoryPath),
|
||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(Utils::PathString,
|
MOCK_METHOD(Utils::PathString,
|
||||||
sourceContextPath,
|
directoryPath,
|
||||||
(QmlDesigner::SourceContextId directoryPathId),
|
(QmlDesigner::DirectoryPathId directoryPathId),
|
||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(Utils::SmallString,
|
MOCK_METHOD(Utils::SmallString,
|
||||||
sourceName,
|
fileName,
|
||||||
(QmlDesigner::SourceNameId sourceName),
|
(QmlDesigner::FileNameId fileName),
|
||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(void, populateIfEmpty, (), (override));
|
MOCK_METHOD(void, populateIfEmpty, (), (override));
|
||||||
};
|
};
|
||||||
|
@@ -64,21 +64,21 @@ public:
|
|||||||
(long long, Utils::SmallStringView),
|
(long long, Utils::SmallStringView),
|
||||||
());
|
());
|
||||||
|
|
||||||
MOCK_METHOD(std::vector<QmlDesigner::Cache::SourceContext>,
|
MOCK_METHOD(std::vector<QmlDesigner::Cache::DirectoryPath>,
|
||||||
valuesReturnCacheSourceContexts,
|
valuesReturnCacheDirectoryPaths,
|
||||||
(std::size_t),
|
(std::size_t),
|
||||||
());
|
());
|
||||||
|
|
||||||
MOCK_METHOD(std::vector<QmlDesigner::Cache::SourceName>,
|
MOCK_METHOD(std::vector<QmlDesigner::Cache::FileName>,
|
||||||
valuesReturnCacheSourceNames,
|
valuesReturnCacheFileNames,
|
||||||
(std::size_t),
|
(std::size_t),
|
||||||
());
|
());
|
||||||
|
|
||||||
MOCK_METHOD(Sqlite::TimeStamp, valueWithTransactionReturnsTimeStamp, (Utils::SmallStringView), ());
|
MOCK_METHOD(Sqlite::TimeStamp, valueWithTransactionReturnsTimeStamp, (Utils::SmallStringView), ());
|
||||||
MOCK_METHOD(int, valueWithTransactionReturnsInt, (Utils::SmallStringView), ());
|
MOCK_METHOD(int, valueWithTransactionReturnsInt, (Utils::SmallStringView), ());
|
||||||
|
|
||||||
MOCK_METHOD(QmlDesigner::SourceContextId, valueReturnsSourceContextId, (Utils::SmallStringView), ());
|
MOCK_METHOD(QmlDesigner::DirectoryPathId, valueReturnsDirectoryPathId, (Utils::SmallStringView), ());
|
||||||
MOCK_METHOD(QmlDesigner::SourceContextId, valueWithTransactionReturnsSourceContextId, (int), ());
|
MOCK_METHOD(QmlDesigner::DirectoryPathId, valueWithTransactionReturnsDirectoryPathId, (int), ());
|
||||||
|
|
||||||
MOCK_METHOD(QmlDesigner::SourceId, valueReturnsSourceId, (int, Utils::SmallStringView), ());
|
MOCK_METHOD(QmlDesigner::SourceId, valueReturnsSourceId, (int, Utils::SmallStringView), ());
|
||||||
|
|
||||||
@@ -161,8 +161,8 @@ public:
|
|||||||
else if constexpr (std::is_same_v<ResultType,
|
else if constexpr (std::is_same_v<ResultType,
|
||||||
std::tuple<QmlDesigner::PropertyDeclarationId, QmlDesigner::TypeId>>)
|
std::tuple<QmlDesigner::PropertyDeclarationId, QmlDesigner::TypeId>>)
|
||||||
return valueReturnsPropertyDeclaration(queryValues...);
|
return valueReturnsPropertyDeclaration(queryValues...);
|
||||||
else if constexpr (std::is_same_v<ResultType, QmlDesigner::SourceContextId>)
|
else if constexpr (std::is_same_v<ResultType, QmlDesigner::DirectoryPathId>)
|
||||||
return valueReturnsSourceContextId(queryValues...);
|
return valueReturnsDirectoryPathId(queryValues...);
|
||||||
else if constexpr (std::is_same_v<ResultType, QmlDesigner::SourceId>)
|
else if constexpr (std::is_same_v<ResultType, QmlDesigner::SourceId>)
|
||||||
return valueReturnsSourceId(queryValues...);
|
return valueReturnsSourceId(queryValues...);
|
||||||
else if constexpr (std::is_same_v<ResultType, QmlDesigner::Storage::Synchronization::Type>)
|
else if constexpr (std::is_same_v<ResultType, QmlDesigner::Storage::Synchronization::Type>)
|
||||||
@@ -181,8 +181,8 @@ public:
|
|||||||
else if constexpr (std::is_same_v<ResultType,
|
else if constexpr (std::is_same_v<ResultType,
|
||||||
std::tuple<QmlDesigner::PropertyDeclarationId, QmlDesigner::TypeId>>)
|
std::tuple<QmlDesigner::PropertyDeclarationId, QmlDesigner::TypeId>>)
|
||||||
return valueReturnsPropertyDeclaration(queryValues...);
|
return valueReturnsPropertyDeclaration(queryValues...);
|
||||||
else if constexpr (std::is_same_v<ResultType, QmlDesigner::SourceContextId>)
|
else if constexpr (std::is_same_v<ResultType, QmlDesigner::DirectoryPathId>)
|
||||||
return valueWithTransactionReturnsSourceContextId(queryValues...);
|
return valueWithTransactionReturnsDirectoryPathId(queryValues...);
|
||||||
else if constexpr (std::is_same_v<ResultType, Sqlite::TimeStamp>)
|
else if constexpr (std::is_same_v<ResultType, Sqlite::TimeStamp>)
|
||||||
return valueWithTransactionReturnsTimeStamp(queryValues...);
|
return valueWithTransactionReturnsTimeStamp(queryValues...);
|
||||||
else if constexpr (std::is_same_v<ResultType, int>)
|
else if constexpr (std::is_same_v<ResultType, int>)
|
||||||
@@ -207,10 +207,10 @@ public:
|
|||||||
return valuesReturnStringVector(reserveSize);
|
return valuesReturnStringVector(reserveSize);
|
||||||
else if constexpr (std::is_same_v<ResultType, long long>)
|
else if constexpr (std::is_same_v<ResultType, long long>)
|
||||||
return valuesReturnRowIds(reserveSize);
|
return valuesReturnRowIds(reserveSize);
|
||||||
else if constexpr (std::is_same_v<ResultType, QmlDesigner::Cache::SourceContext>)
|
else if constexpr (std::is_same_v<ResultType, QmlDesigner::Cache::DirectoryPath>)
|
||||||
return valuesReturnCacheSourceContexts(reserveSize);
|
return valuesReturnCacheDirectoryPaths(reserveSize);
|
||||||
else if constexpr (std::is_same_v<ResultType, QmlDesigner::Cache::SourceName>)
|
else if constexpr (std::is_same_v<ResultType, QmlDesigner::Cache::FileName>)
|
||||||
return valuesReturnCacheSourceNames(reserveSize);
|
return valuesReturnCacheFileNames(reserveSize);
|
||||||
else if constexpr (std::is_same_v<ResultType, QmlDesigner::Storage::Synchronization::Type>)
|
else if constexpr (std::is_same_v<ResultType, QmlDesigner::Storage::Synchronization::Type>)
|
||||||
return valuesReturnsStorageTypes(reserveSize, queryValues...);
|
return valuesReturnsStorageTypes(reserveSize, queryValues...);
|
||||||
else if constexpr (std::is_same_v<ResultType, QmlDesigner::Storage::Synchronization::ExportedType>)
|
else if constexpr (std::is_same_v<ResultType, QmlDesigner::Storage::Synchronization::ExportedType>)
|
||||||
|
@@ -489,7 +489,7 @@ std::ostream &operator<<(std::ostream &out, const IdPaths &idPaths)
|
|||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const WatcherEntry &entry)
|
std::ostream &operator<<(std::ostream &out, const WatcherEntry &entry)
|
||||||
{
|
{
|
||||||
return out << "(" << entry.sourceId << ", " << entry.sourceContextId << ", " << entry.id << ", "
|
return out << "(" << entry.sourceId << ", " << entry.directoryPathId << ", " << entry.id << ", "
|
||||||
<< entry.lastModified << ")";
|
<< entry.lastModified << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,9 +600,9 @@ std::ostream &operator<<(std::ostream &out, AuxiliaryDataType type)
|
|||||||
|
|
||||||
namespace Cache {
|
namespace Cache {
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const SourceContext &sourceContext)
|
std::ostream &operator<<(std::ostream &out, const DirectoryPath &directoryPath)
|
||||||
{
|
{
|
||||||
return out << "(" << sourceContext.id << ", " << sourceContext.value << ")";
|
return out << "(" << directoryPath.id << ", " << directoryPath.value << ")";
|
||||||
}
|
}
|
||||||
} // namespace Cache
|
} // namespace Cache
|
||||||
|
|
||||||
|
@@ -164,9 +164,9 @@ std::ostream &operator<<(std::ostream &out, const BasicAuxiliaryDataKey<Utils::S
|
|||||||
std::ostream &operator<<(std::ostream &out, AuxiliaryDataType type);
|
std::ostream &operator<<(std::ostream &out, AuxiliaryDataType type);
|
||||||
|
|
||||||
namespace Cache {
|
namespace Cache {
|
||||||
class SourceContext;
|
class DirectoryPath;
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const SourceContext &sourceContext);
|
std::ostream &operator<<(std::ostream &out, const DirectoryPath &directoryPath);
|
||||||
} // namespace Cache
|
} // namespace Cache
|
||||||
|
|
||||||
namespace ImageCache {
|
namespace ImageCache {
|
||||||
@@ -175,8 +175,8 @@ class FontCollectorSizeAuxiliaryData;
|
|||||||
class FontCollectorSizesAuxiliaryData;
|
class FontCollectorSizesAuxiliaryData;
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const LibraryIconAuxiliaryData &date);
|
std::ostream &operator<<(std::ostream &out, const LibraryIconAuxiliaryData &date);
|
||||||
std::ostream &operator<<(std::ostream &out, const FontCollectorSizeAuxiliaryData &sourceContext);
|
std::ostream &operator<<(std::ostream &out, const FontCollectorSizeAuxiliaryData &directoryPath);
|
||||||
std::ostream &operator<<(std::ostream &out, const FontCollectorSizesAuxiliaryData &sourceContext);
|
std::ostream &operator<<(std::ostream &out, const FontCollectorSizesAuxiliaryData &directoryPath);
|
||||||
} // namespace ImageCache
|
} // namespace ImageCache
|
||||||
|
|
||||||
namespace Storage {
|
namespace Storage {
|
||||||
|
@@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using QmlDesigner::SourceContextId;
|
using QmlDesigner::DirectoryPathId;
|
||||||
using QmlDesigner::SourceContextIds;
|
using QmlDesigner::DirectoryPathIds;
|
||||||
|
|
||||||
class DirectoryPathCompressor : public testing::Test
|
class DirectoryPathCompressor : public testing::Test
|
||||||
{
|
{
|
||||||
@@ -21,61 +21,61 @@ protected:
|
|||||||
void SetUp() { compressor.setCallback(mockCompressorCallback.AsStdFunction()); }
|
void SetUp() { compressor.setCallback(mockCompressorCallback.AsStdFunction()); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NiceMock<MockFunction<void(const SourceContextIds &sourceContextIds)>> mockCompressorCallback;
|
NiceMock<MockFunction<void(const DirectoryPathIds &directoryPathIds)>> mockCompressorCallback;
|
||||||
QmlDesigner::DirectoryPathCompressor<NiceMock<MockTimer>> compressor;
|
QmlDesigner::DirectoryPathCompressor<NiceMock<MockTimer>> compressor;
|
||||||
NiceMock<MockTimer> &mockTimer = compressor.timer();
|
NiceMock<MockTimer> &mockTimer = compressor.timer();
|
||||||
SourceContextId sourceContextId1{SourceContextId::create(1)};
|
DirectoryPathId directoryPathId1{DirectoryPathId::create(1)};
|
||||||
SourceContextId sourceContextId2{SourceContextId::create(2)};
|
DirectoryPathId directoryPathId2{DirectoryPathId::create(2)};
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(DirectoryPathCompressor, add_file_path)
|
TEST_F(DirectoryPathCompressor, add_file_path)
|
||||||
{
|
{
|
||||||
compressor.addSourceContextId(sourceContextId1);
|
compressor.addDirectoryPathId(directoryPathId1);
|
||||||
|
|
||||||
ASSERT_THAT(compressor.sourceContextIds(), ElementsAre(sourceContextId1));
|
ASSERT_THAT(compressor.directoryPathIds(), ElementsAre(directoryPathId1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DirectoryPathCompressor, clear__after_calling_callback)
|
TEST_F(DirectoryPathCompressor, clear__after_calling_callback)
|
||||||
{
|
{
|
||||||
compressor.addSourceContextId(sourceContextId1);
|
compressor.addDirectoryPathId(directoryPathId1);
|
||||||
|
|
||||||
compressor.timer().emitTimoutIfStarted();
|
compressor.timer().emitTimoutIfStarted();
|
||||||
|
|
||||||
ASSERT_THAT(compressor.sourceContextIds(), IsEmpty());
|
ASSERT_THAT(compressor.directoryPathIds(), IsEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DirectoryPathCompressor, dont_clear_for_thrown_exception)
|
TEST_F(DirectoryPathCompressor, dont_clear_for_thrown_exception)
|
||||||
{
|
{
|
||||||
compressor.addSourceContextId(sourceContextId1);
|
compressor.addDirectoryPathId(directoryPathId1);
|
||||||
compressor.setCallback([](const SourceContextIds &) { throw std::exception{}; });
|
compressor.setCallback([](const DirectoryPathIds &) { throw std::exception{}; });
|
||||||
|
|
||||||
compressor.timer().emitTimoutIfStarted();
|
compressor.timer().emitTimoutIfStarted();
|
||||||
|
|
||||||
ASSERT_THAT(compressor.sourceContextIds(), ElementsAre(sourceContextId1));
|
ASSERT_THAT(compressor.directoryPathIds(), ElementsAre(directoryPathId1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DirectoryPathCompressor, call_restart_timer_after_adding_path)
|
TEST_F(DirectoryPathCompressor, call_restart_timer_after_adding_path)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(mockTimer, start(20));
|
EXPECT_CALL(mockTimer, start(20));
|
||||||
|
|
||||||
compressor.addSourceContextId(sourceContextId1);
|
compressor.addDirectoryPathId(directoryPathId1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DirectoryPathCompressor, call_time_out_after_adding_path)
|
TEST_F(DirectoryPathCompressor, call_time_out_after_adding_path)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(mockCompressorCallback, Call(ElementsAre(sourceContextId1, sourceContextId2)));
|
EXPECT_CALL(mockCompressorCallback, Call(ElementsAre(directoryPathId1, directoryPathId2)));
|
||||||
|
|
||||||
compressor.addSourceContextId(sourceContextId1);
|
compressor.addDirectoryPathId(directoryPathId1);
|
||||||
compressor.addSourceContextId(sourceContextId2);
|
compressor.addDirectoryPathId(directoryPathId2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DirectoryPathCompressor, remove_duplicates)
|
TEST_F(DirectoryPathCompressor, remove_duplicates)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(mockCompressorCallback, Call(ElementsAre(sourceContextId1, sourceContextId2)));
|
EXPECT_CALL(mockCompressorCallback, Call(ElementsAre(directoryPathId1, directoryPathId2)));
|
||||||
|
|
||||||
compressor.addSourceContextId(sourceContextId1);
|
compressor.addDirectoryPathId(directoryPathId1);
|
||||||
compressor.addSourceContextId(sourceContextId2);
|
compressor.addDirectoryPathId(directoryPathId2);
|
||||||
compressor.addSourceContextId(sourceContextId1);
|
compressor.addDirectoryPathId(directoryPathId1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@@ -24,11 +24,11 @@ using QmlDesigner::FileStatuses;
|
|||||||
using QmlDesigner::FlagIs;
|
using QmlDesigner::FlagIs;
|
||||||
using QmlDesigner::ModuleId;
|
using QmlDesigner::ModuleId;
|
||||||
using QmlDesigner::PropertyDeclarationId;
|
using QmlDesigner::PropertyDeclarationId;
|
||||||
using QmlDesigner::SourceContextId;
|
using QmlDesigner::DirectoryPathId;
|
||||||
using QmlDesigner::SourceContextIds;
|
using QmlDesigner::DirectoryPathIds;
|
||||||
using QmlDesigner::SourceId;
|
using QmlDesigner::SourceId;
|
||||||
using QmlDesigner::SourceIds;
|
using QmlDesigner::SourceIds;
|
||||||
using QmlDesigner::SourceNameId;
|
using QmlDesigner::FileNameId;
|
||||||
using QmlDesigner::Storage::ModuleKind;
|
using QmlDesigner::Storage::ModuleKind;
|
||||||
using QmlDesigner::Storage::Synchronization::SynchronizationPackage;
|
using QmlDesigner::Storage::Synchronization::SynchronizationPackage;
|
||||||
using QmlDesigner::Storage::Synchronization::TypeAnnotations;
|
using QmlDesigner::Storage::Synchronization::TypeAnnotations;
|
||||||
@@ -1070,16 +1070,16 @@ protected:
|
|||||||
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
||||||
"QtObject",
|
"QtObject",
|
||||||
sourceId1,
|
sourceId1,
|
||||||
sourceContextIdPath6);
|
directoryPathIdPath6);
|
||||||
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
||||||
"Item",
|
"Item",
|
||||||
sourceId2,
|
sourceId2,
|
||||||
sourceContextIdPath6);
|
directoryPathIdPath6);
|
||||||
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
||||||
"Item3D",
|
"Item3D",
|
||||||
sourceId3,
|
sourceId3,
|
||||||
sourceContextIdPath6);
|
directoryPathIdPath6);
|
||||||
package.updatedPropertyEditorQmlPathDirectoryIds.emplace_back(sourceContextIdPath6);
|
package.updatedPropertyEditorQmlPathDirectoryIds.emplace_back(directoryPathIdPath6);
|
||||||
|
|
||||||
return package;
|
return package;
|
||||||
}
|
}
|
||||||
@@ -1093,7 +1093,7 @@ protected:
|
|||||||
traits.visibleInLibrary = FlagIs::True;
|
traits.visibleInLibrary = FlagIs::True;
|
||||||
|
|
||||||
annotations.emplace_back(sourceId4,
|
annotations.emplace_back(sourceId4,
|
||||||
sourceContextIdPath6,
|
directoryPathIdPath6,
|
||||||
"Object",
|
"Object",
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
"/path/to/icon.png",
|
"/path/to/icon.png",
|
||||||
@@ -1115,7 +1115,7 @@ protected:
|
|||||||
"properties":[["color", "color", "#blue"]]}])xy");
|
"properties":[["color", "color", "#blue"]]}])xy");
|
||||||
|
|
||||||
annotations.emplace_back(sourceId5,
|
annotations.emplace_back(sourceId5,
|
||||||
sourceContextIdPath6,
|
directoryPathIdPath6,
|
||||||
"Item",
|
"Item",
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
"/path/to/quick.png",
|
"/path/to/quick.png",
|
||||||
@@ -1140,7 +1140,7 @@ protected:
|
|||||||
traits.visibleInLibrary = FlagIs::True;
|
traits.visibleInLibrary = FlagIs::True;
|
||||||
|
|
||||||
annotations.emplace_back(sourceId5,
|
annotations.emplace_back(sourceId5,
|
||||||
sourceContextIdPath1,
|
directoryPathIdPath1,
|
||||||
"Item",
|
"Item",
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
"/path/to/quick.png",
|
"/path/to/quick.png",
|
||||||
@@ -1253,13 +1253,13 @@ protected:
|
|||||||
SourceId sourceId5{sourcePathCache.sourceId(path5)};
|
SourceId sourceId5{sourcePathCache.sourceId(path5)};
|
||||||
SourceId sourceId6{sourcePathCache.sourceId(path6)};
|
SourceId sourceId6{sourcePathCache.sourceId(path6)};
|
||||||
SourceId sourceIdPath1{sourcePathCache.sourceId(pathPath1)};
|
SourceId sourceIdPath1{sourcePathCache.sourceId(pathPath1)};
|
||||||
SourceContextId sourceContextIdPath1{sourceIdPath1.contextId()};
|
DirectoryPathId directoryPathIdPath1{sourceIdPath1.contextId()};
|
||||||
SourceId sourceIdPath6{sourcePathCache.sourceId(pathPath6)};
|
SourceId sourceIdPath6{sourcePathCache.sourceId(pathPath6)};
|
||||||
SourceContextId sourceContextIdPath6{sourceIdPath6.contextId()};
|
DirectoryPathId directoryPathIdPath6{sourceIdPath6.contextId()};
|
||||||
SourceId qmlProjectSourceId{sourcePathCache.sourceId("/path1/qmldir")};
|
SourceId qmlProjectSourceId{sourcePathCache.sourceId("/path1/qmldir")};
|
||||||
SourceContextId qmlProjectSourceContextId = qmlProjectSourceId.contextId();
|
DirectoryPathId qmlProjectDirectoryPathId = qmlProjectSourceId.contextId();
|
||||||
SourceId qtQuickProjectSourceId{sourcePathCache.sourceId("/path2/qmldir")};
|
SourceId qtQuickProjectSourceId{sourcePathCache.sourceId("/path2/qmldir")};
|
||||||
SourceContextId qtQuickProjectSourceContextId = qtQuickProjectSourceId.contextId();
|
DirectoryPathId qtQuickProjectDirectoryPathId = qtQuickProjectSourceId.contextId();
|
||||||
ModuleId qmlModuleId{storage.moduleId("Qml", ModuleKind::QmlLibrary)};
|
ModuleId qmlModuleId{storage.moduleId("Qml", ModuleKind::QmlLibrary)};
|
||||||
ModuleId qmlNativeModuleId{storage.moduleId("Qml", ModuleKind::CppLibrary)};
|
ModuleId qmlNativeModuleId{storage.moduleId("Qml", ModuleKind::CppLibrary)};
|
||||||
ModuleId qtQuickModuleId{storage.moduleId("QtQuick", ModuleKind::QmlLibrary)};
|
ModuleId qtQuickModuleId{storage.moduleId("QtQuick", ModuleKind::QmlLibrary)};
|
||||||
@@ -5829,261 +5829,261 @@ TEST_F(ProjectStorage, populate_module_cache)
|
|||||||
|
|
||||||
TEST_F(ProjectStorage, add_directory_infoes)
|
TEST_F(ProjectStorage, add_directory_infoes)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectDirectoryPathId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectDirectoryPathId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
|
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
SynchronizationPackage{{qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId}),
|
||||||
UnorderedElementsAre(directoryInfo1, directoryInfo2, directoryInfo3));
|
UnorderedElementsAre(directoryInfo1, directoryInfo2, directoryInfo3));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, remove_directory_info)
|
TEST_F(ProjectStorage, remove_directory_info)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectDirectoryPathId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectDirectoryPathId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
SynchronizationPackage{{qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
SynchronizationPackage{{qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId},
|
||||||
{directoryInfo1}});
|
{directoryInfo1}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId}),
|
||||||
UnorderedElementsAre(directoryInfo1));
|
UnorderedElementsAre(directoryInfo1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, update_directory_info_file_type)
|
TEST_F(ProjectStorage, update_directory_info_file_type)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectDirectoryPathId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2b{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2b{qmlProjectDirectoryPathId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectDirectoryPathId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
SynchronizationPackage{{qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1, directoryInfo2b}});
|
SynchronizationPackage{{qmlProjectDirectoryPathId}, {directoryInfo1, directoryInfo2b}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId}),
|
||||||
UnorderedElementsAre(directoryInfo1, directoryInfo2b, directoryInfo3));
|
UnorderedElementsAre(directoryInfo1, directoryInfo2b, directoryInfo3));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, update_directory_info_module_id)
|
TEST_F(ProjectStorage, update_directory_info_module_id)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectDirectoryPathId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2b{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2b{qmlProjectDirectoryPathId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectDirectoryPathId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
SynchronizationPackage{{qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1, directoryInfo2b}});
|
SynchronizationPackage{{qmlProjectDirectoryPathId}, {directoryInfo1, directoryInfo2b}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId}),
|
||||||
UnorderedElementsAre(directoryInfo1, directoryInfo2b, directoryInfo3));
|
UnorderedElementsAre(directoryInfo1, directoryInfo2b, directoryInfo3));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, throw_for_invalid_source_id_in_directory_info)
|
TEST_F(ProjectStorage, throw_for_invalid_source_id_in_directory_info)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
SourceId{},
|
SourceId{},
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
|
|
||||||
ASSERT_THROW(storage.synchronize(
|
ASSERT_THROW(storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1}}),
|
SynchronizationPackage{{qmlProjectDirectoryPathId}, {directoryInfo1}}),
|
||||||
QmlDesigner::DirectoryInfoHasInvalidSourceId);
|
QmlDesigner::DirectoryInfoHasInvalidSourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, insert_directory_info_with_invalid_module_id)
|
TEST_F(ProjectStorage, insert_directory_info_with_invalid_module_id)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
ModuleId{},
|
ModuleId{},
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
|
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1}});
|
storage.synchronize(SynchronizationPackage{{qmlProjectDirectoryPathId}, {directoryInfo1}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId}),
|
||||||
UnorderedElementsAre(directoryInfo1));
|
UnorderedElementsAre(directoryInfo1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, update_directory_info_with_invalid_module_id)
|
TEST_F(ProjectStorage, update_directory_info_with_invalid_module_id)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1}});
|
storage.synchronize(SynchronizationPackage{{qmlProjectDirectoryPathId}, {directoryInfo1}});
|
||||||
directoryInfo1.moduleId = ModuleId{};
|
directoryInfo1.moduleId = ModuleId{};
|
||||||
|
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1}});
|
storage.synchronize(SynchronizationPackage{{qmlProjectDirectoryPathId}, {directoryInfo1}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId}),
|
||||||
UnorderedElementsAre(directoryInfo1));
|
UnorderedElementsAre(directoryInfo1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, throw_for_updating_with_invalid_project_source_context_id_in_directory_info)
|
TEST_F(ProjectStorage, throw_for_updating_with_invalid_project_directory_path_id_in_directory_info)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{
|
Storage::Synchronization::DirectoryInfo directoryInfo1{
|
||||||
SourceContextId{}, sourceId1, qmlModuleId, Storage::Synchronization::FileType::QmlDocument};
|
DirectoryPathId{}, sourceId1, qmlModuleId, Storage::Synchronization::FileType::QmlDocument};
|
||||||
|
|
||||||
ASSERT_THROW(storage.synchronize(
|
ASSERT_THROW(storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1}}),
|
SynchronizationPackage{{qmlProjectDirectoryPathId}, {directoryInfo1}}),
|
||||||
QmlDesigner::DirectoryInfoHasInvalidProjectSourceId);
|
QmlDesigner::DirectoryInfoHasInvalidProjectSourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_source_context_ids)
|
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_directory_path_ids)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectDirectoryPathId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectDirectoryPathId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
SynchronizationPackage{{qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
auto directoryInfos = storage.fetchDirectoryInfos(
|
auto directoryInfos = storage.fetchDirectoryInfos(
|
||||||
{qmlProjectSourceContextId, qtQuickProjectSourceContextId});
|
{qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId});
|
||||||
|
|
||||||
ASSERT_THAT(directoryInfos, UnorderedElementsAre(directoryInfo1, directoryInfo2, directoryInfo3));
|
ASSERT_THAT(directoryInfos, UnorderedElementsAre(directoryInfo1, directoryInfo2, directoryInfo3));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_source_context_id)
|
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_directory_path_id)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectDirectoryPathId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectDirectoryPathId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
SynchronizationPackage{{qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
auto directoryInfo = storage.fetchDirectoryInfos(qmlProjectSourceContextId);
|
auto directoryInfo = storage.fetchDirectoryInfos(qmlProjectDirectoryPathId);
|
||||||
|
|
||||||
ASSERT_THAT(directoryInfo, UnorderedElementsAre(directoryInfo1, directoryInfo2));
|
ASSERT_THAT(directoryInfo, UnorderedElementsAre(directoryInfo1, directoryInfo2));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_source_context_id_and_file_type)
|
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_directory_path_id_and_file_type)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectDirectoryPathId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
ModuleId{},
|
ModuleId{},
|
||||||
Storage::Synchronization::FileType::Directory};
|
Storage::Synchronization::FileType::Directory};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectDirectoryPathId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo4{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo4{qmlProjectDirectoryPathId,
|
||||||
sourceId4,
|
sourceId4,
|
||||||
ModuleId{},
|
ModuleId{},
|
||||||
Storage::Synchronization::FileType::Directory};
|
Storage::Synchronization::FileType::Directory};
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
SynchronizationPackage{{qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3, directoryInfo4}});
|
{directoryInfo1, directoryInfo2, directoryInfo3, directoryInfo4}});
|
||||||
|
|
||||||
auto directoryInfo = storage.fetchDirectoryInfos(qmlProjectSourceContextId,
|
auto directoryInfo = storage.fetchDirectoryInfos(qmlProjectDirectoryPathId,
|
||||||
Storage::Synchronization::FileType::Directory);
|
Storage::Synchronization::FileType::Directory);
|
||||||
|
|
||||||
ASSERT_THAT(directoryInfo, UnorderedElementsAre(directoryInfo2, directoryInfo4));
|
ASSERT_THAT(directoryInfo, UnorderedElementsAre(directoryInfo2, directoryInfo4));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, fetch_subdirectory_source_context_ids)
|
TEST_F(ProjectStorage, fetch_subdirectory_directory_path_ids)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
auto directory1Id = SourceId::create(SourceNameId{}, sourceId2.contextId());
|
auto directory1Id = SourceId::create(FileNameId{}, sourceId2.contextId());
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectDirectoryPathId,
|
||||||
directory1Id,
|
directory1Id,
|
||||||
ModuleId{},
|
ModuleId{},
|
||||||
Storage::Synchronization::FileType::Directory};
|
Storage::Synchronization::FileType::Directory};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectDirectoryPathId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
auto directory2Id = SourceId::create(SourceNameId{}, sourceId4.contextId());
|
auto directory2Id = SourceId::create(FileNameId{}, sourceId4.contextId());
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo4{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo4{qmlProjectDirectoryPathId,
|
||||||
directory2Id,
|
directory2Id,
|
||||||
ModuleId{},
|
ModuleId{},
|
||||||
Storage::Synchronization::FileType::Directory};
|
Storage::Synchronization::FileType::Directory};
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
SynchronizationPackage{{qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3, directoryInfo4}});
|
{directoryInfo1, directoryInfo2, directoryInfo3, directoryInfo4}});
|
||||||
|
|
||||||
auto directoryInfo = storage.fetchSubdirectoryIds(qmlProjectSourceContextId);
|
auto directoryInfo = storage.fetchSubdirectoryIds(qmlProjectDirectoryPathId);
|
||||||
|
|
||||||
ASSERT_THAT(directoryInfo,
|
ASSERT_THAT(directoryInfo,
|
||||||
UnorderedElementsAre(directory1Id.contextId(), directory2Id.contextId()));
|
UnorderedElementsAre(directory1Id.contextId(), directory2Id.contextId()));
|
||||||
@@ -6091,20 +6091,20 @@ TEST_F(ProjectStorage, fetch_subdirectory_source_context_ids)
|
|||||||
|
|
||||||
TEST_F(ProjectStorage, fetch_directory_info_by_source_id)
|
TEST_F(ProjectStorage, fetch_directory_info_by_source_id)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectDirectoryPathId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectDirectoryPathId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectDirectoryPathId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
SynchronizationPackage{{qmlProjectDirectoryPathId, qtQuickProjectDirectoryPathId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
auto directoryInfo = storage.fetchDirectoryInfo(sourceId2);
|
auto directoryInfo = storage.fetchDirectoryInfo(sourceId2);
|
||||||
@@ -8295,7 +8295,7 @@ TEST_F(ProjectStorage, synchronize_property_editor_adds_path)
|
|||||||
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
||||||
"Item3D",
|
"Item3D",
|
||||||
sourceId3,
|
sourceId3,
|
||||||
sourceContextIdPath6);
|
directoryPathIdPath6);
|
||||||
|
|
||||||
storage.synchronize(package);
|
storage.synchronize(package);
|
||||||
|
|
||||||
@@ -8310,7 +8310,7 @@ TEST_F(ProjectStorage, synchronize_property_editor_with_non_existing_type_name)
|
|||||||
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
||||||
"Item4D",
|
"Item4D",
|
||||||
sourceId4,
|
sourceId4,
|
||||||
sourceContextIdPath6);
|
directoryPathIdPath6);
|
||||||
|
|
||||||
storage.synchronize(package);
|
storage.synchronize(package);
|
||||||
|
|
||||||
@@ -8675,7 +8675,7 @@ TEST_F(ProjectStorage, synchronize_type_annotation_directory_source_id)
|
|||||||
|
|
||||||
storage.synchronize(package);
|
storage.synchronize(package);
|
||||||
|
|
||||||
ASSERT_THAT(storage.typeAnnotationSourceIds(sourceContextIdPath6),
|
ASSERT_THAT(storage.typeAnnotationSourceIds(directoryPathIdPath6),
|
||||||
UnorderedElementsAre(sourceId4, sourceId5));
|
UnorderedElementsAre(sourceId4, sourceId5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8687,7 +8687,7 @@ TEST_F(ProjectStorage, get_type_annotation_source_ids)
|
|||||||
package.typeAnnotations);
|
package.typeAnnotations);
|
||||||
storage.synchronize(package);
|
storage.synchronize(package);
|
||||||
|
|
||||||
auto sourceIds = storage.typeAnnotationSourceIds(sourceContextIdPath6);
|
auto sourceIds = storage.typeAnnotationSourceIds(directoryPathIdPath6);
|
||||||
|
|
||||||
ASSERT_THAT(sourceIds, UnorderedElementsAre(sourceId4, sourceId5));
|
ASSERT_THAT(sourceIds, UnorderedElementsAre(sourceId4, sourceId5));
|
||||||
}
|
}
|
||||||
@@ -8702,7 +8702,7 @@ TEST_F(ProjectStorage, get_type_annotation_directory_source_ids)
|
|||||||
|
|
||||||
auto sourceIds = storage.typeAnnotationDirectoryIds();
|
auto sourceIds = storage.typeAnnotationDirectoryIds();
|
||||||
|
|
||||||
ASSERT_THAT(sourceIds, ElementsAre(sourceContextIdPath1, sourceContextIdPath6));
|
ASSERT_THAT(sourceIds, ElementsAre(directoryPathIdPath1, directoryPathIdPath6));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, get_all_item_library_entries)
|
TEST_F(ProjectStorage, get_all_item_library_entries)
|
||||||
|
@@ -27,8 +27,8 @@ using QmlDesigner::ProjectChunkId;
|
|||||||
using QmlDesigner::ProjectChunkIds;
|
using QmlDesigner::ProjectChunkIds;
|
||||||
using QmlDesigner::ProjectPartId;
|
using QmlDesigner::ProjectPartId;
|
||||||
using QmlDesigner::ProjectPartIds;
|
using QmlDesigner::ProjectPartIds;
|
||||||
using QmlDesigner::SourceContextId;
|
using QmlDesigner::DirectoryPathId;
|
||||||
using QmlDesigner::SourceContextIds;
|
using QmlDesigner::DirectoryPathIds;
|
||||||
using QmlDesigner::SourceId;
|
using QmlDesigner::SourceId;
|
||||||
using QmlDesigner::SourceIds;
|
using QmlDesigner::SourceIds;
|
||||||
using QmlDesigner::SourcePath;
|
using QmlDesigner::SourcePath;
|
||||||
@@ -62,11 +62,11 @@ protected:
|
|||||||
return FileStatus{sourceId, 1, 1};
|
return FileStatus{sourceId, 1, 1};
|
||||||
});
|
});
|
||||||
|
|
||||||
ON_CALL(mockFileSystem, directoryEntries(Eq(sourceContextPath)))
|
ON_CALL(mockFileSystem, directoryEntries(Eq(directoryPath)))
|
||||||
.WillByDefault(Return(SourceIds{sourceIds[0], sourceIds[1]}));
|
.WillByDefault(Return(SourceIds{sourceIds[0], sourceIds[1]}));
|
||||||
ON_CALL(mockFileSystem, directoryEntries(Eq(sourceContextPath2)))
|
ON_CALL(mockFileSystem, directoryEntries(Eq(directoryPath2)))
|
||||||
.WillByDefault(Return(SourceIds{sourceIds[2], sourceIds[3]}));
|
.WillByDefault(Return(SourceIds{sourceIds[2], sourceIds[3]}));
|
||||||
ON_CALL(mockFileSystem, directoryEntries(Eq(sourceContextPath3)))
|
ON_CALL(mockFileSystem, directoryEntries(Eq(directoryPath3)))
|
||||||
.WillByDefault(Return(SourceIds{sourceIds[4]}));
|
.WillByDefault(Return(SourceIds{sourceIds[4]}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,40 +98,40 @@ protected:
|
|||||||
SourcePathView path5{"/path3/path"};
|
SourcePathView path5{"/path3/path"};
|
||||||
QString path1QString = QString(path1.toStringView());
|
QString path1QString = QString(path1.toStringView());
|
||||||
QString path2QString = QString(path2.toStringView());
|
QString path2QString = QString(path2.toStringView());
|
||||||
QString sourceContextPath = "/path";
|
QString directoryPath = "/path";
|
||||||
QString sourceContextPath2 = "/path2";
|
QString directoryPath2 = "/path2";
|
||||||
QString sourceContextPath3 = "/path3";
|
QString directoryPath3 = "/path3";
|
||||||
Utils::PathString sourceContextPathString = sourceContextPath;
|
Utils::PathString directoryPathString = directoryPath;
|
||||||
Utils::PathString sourceContextPathString2 = sourceContextPath2;
|
Utils::PathString directoryPathString2 = directoryPath2;
|
||||||
SourceIds sourceIds = {pathCache.sourceId(path1),
|
SourceIds sourceIds = {pathCache.sourceId(path1),
|
||||||
pathCache.sourceId(path2),
|
pathCache.sourceId(path2),
|
||||||
pathCache.sourceId(path3),
|
pathCache.sourceId(path3),
|
||||||
pathCache.sourceId(path4),
|
pathCache.sourceId(path4),
|
||||||
pathCache.sourceId(path5)};
|
pathCache.sourceId(path5)};
|
||||||
SourceContextIds sourceContextIds = {sourceIds[0].contextId(),
|
DirectoryPathIds directoryPathIds = {sourceIds[0].contextId(),
|
||||||
sourceIds[2].contextId(),
|
sourceIds[2].contextId(),
|
||||||
sourceIds[4].contextId()};
|
sourceIds[4].contextId()};
|
||||||
ProjectChunkIds ids{projectChunkId1, projectChunkId2, projectChunkId3};
|
ProjectChunkIds ids{projectChunkId1, projectChunkId2, projectChunkId3};
|
||||||
WatcherEntry watcherEntry1{projectChunkId1, sourceContextIds[0], sourceIds[0]};
|
WatcherEntry watcherEntry1{projectChunkId1, directoryPathIds[0], sourceIds[0]};
|
||||||
WatcherEntry watcherEntry2{projectChunkId2, sourceContextIds[0], sourceIds[0]};
|
WatcherEntry watcherEntry2{projectChunkId2, directoryPathIds[0], sourceIds[0]};
|
||||||
WatcherEntry watcherEntry3{projectChunkId1, sourceContextIds[0], sourceIds[1]};
|
WatcherEntry watcherEntry3{projectChunkId1, directoryPathIds[0], sourceIds[1]};
|
||||||
WatcherEntry watcherEntry4{projectChunkId2, sourceContextIds[0], sourceIds[1]};
|
WatcherEntry watcherEntry4{projectChunkId2, directoryPathIds[0], sourceIds[1]};
|
||||||
WatcherEntry watcherEntry5{projectChunkId3, sourceContextIds[0], sourceIds[1]};
|
WatcherEntry watcherEntry5{projectChunkId3, directoryPathIds[0], sourceIds[1]};
|
||||||
WatcherEntry watcherEntry6{projectChunkId1, sourceContextIds[1], sourceIds[2]};
|
WatcherEntry watcherEntry6{projectChunkId1, directoryPathIds[1], sourceIds[2]};
|
||||||
WatcherEntry watcherEntry7{projectChunkId2, sourceContextIds[1], sourceIds[3]};
|
WatcherEntry watcherEntry7{projectChunkId2, directoryPathIds[1], sourceIds[3]};
|
||||||
WatcherEntry watcherEntry8{projectChunkId3, sourceContextIds[1], sourceIds[3]};
|
WatcherEntry watcherEntry8{projectChunkId3, directoryPathIds[1], sourceIds[3]};
|
||||||
WatcherEntry watcherEntry9{projectChunkId4, sourceContextIds[0], sourceIds[0]};
|
WatcherEntry watcherEntry9{projectChunkId4, directoryPathIds[0], sourceIds[0]};
|
||||||
WatcherEntry watcherEntry10{projectChunkId4, sourceContextIds[0], sourceIds[1]};
|
WatcherEntry watcherEntry10{projectChunkId4, directoryPathIds[0], sourceIds[1]};
|
||||||
WatcherEntry watcherEntry11{projectChunkId4, sourceContextIds[1], sourceIds[2]};
|
WatcherEntry watcherEntry11{projectChunkId4, directoryPathIds[1], sourceIds[2]};
|
||||||
WatcherEntry watcherEntry12{projectChunkId4, sourceContextIds[1], sourceIds[3]};
|
WatcherEntry watcherEntry12{projectChunkId4, directoryPathIds[1], sourceIds[3]};
|
||||||
WatcherEntry watcherEntry13{projectChunkId4, sourceContextIds[2], sourceIds[4]};
|
WatcherEntry watcherEntry13{projectChunkId4, directoryPathIds[2], sourceIds[4]};
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(ProjectStoragePathWatcher, add_id_paths)
|
TEST_F(ProjectStoragePathWatcher, add_id_paths)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(mockQFileSytemWatcher,
|
EXPECT_CALL(mockQFileSytemWatcher,
|
||||||
addPaths(
|
addPaths(
|
||||||
UnorderedElementsAre(QString(sourceContextPath), QString(sourceContextPath2))));
|
UnorderedElementsAre(QString(directoryPath), QString(directoryPath2))));
|
||||||
|
|
||||||
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1], sourceIds[2]}},
|
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1], sourceIds[2]}},
|
||||||
{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}}});
|
{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}}});
|
||||||
@@ -142,7 +142,7 @@ TEST_F(ProjectStoragePathWatcher, update_id_paths_calls_add_path_in_file_watcher
|
|||||||
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1]}},
|
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1]}},
|
||||||
{projectChunkId2, {sourceIds[0], sourceIds[1]}}});
|
{projectChunkId2, {sourceIds[0], sourceIds[1]}}});
|
||||||
|
|
||||||
EXPECT_CALL(mockQFileSytemWatcher, addPaths(UnorderedElementsAre(QString(sourceContextPath2))));
|
EXPECT_CALL(mockQFileSytemWatcher, addPaths(UnorderedElementsAre(QString(directoryPath2))));
|
||||||
|
|
||||||
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1], sourceIds[2]}},
|
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1], sourceIds[2]}},
|
||||||
{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}}});
|
{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}}});
|
||||||
@@ -153,7 +153,7 @@ TEST_F(ProjectStoragePathWatcher, update_id_paths_and_remove_unused_paths_calls_
|
|||||||
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1], sourceIds[2]}},
|
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1], sourceIds[2]}},
|
||||||
{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}}});
|
{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}}});
|
||||||
|
|
||||||
EXPECT_CALL(mockQFileSytemWatcher, removePaths(UnorderedElementsAre(QString(sourceContextPath2))));
|
EXPECT_CALL(mockQFileSytemWatcher, removePaths(UnorderedElementsAre(QString(directoryPath2))));
|
||||||
|
|
||||||
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1]}},
|
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1]}},
|
||||||
{projectChunkId2, {sourceIds[0], sourceIds[1]}}});
|
{projectChunkId2, {sourceIds[0], sourceIds[1]}}});
|
||||||
@@ -226,7 +226,7 @@ TEST_F(ProjectStoragePathWatcher, add_empty_entries)
|
|||||||
TEST_F(ProjectStoragePathWatcher, add_entries_with_same_id_and_different_paths)
|
TEST_F(ProjectStoragePathWatcher, add_entries_with_same_id_and_different_paths)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(mockQFileSytemWatcher,
|
EXPECT_CALL(mockQFileSytemWatcher,
|
||||||
addPaths(ElementsAre(sourceContextPath, sourceContextPath2, sourceContextPath3)));
|
addPaths(ElementsAre(directoryPath, directoryPath2, directoryPath3)));
|
||||||
|
|
||||||
watcher.updateIdPaths(
|
watcher.updateIdPaths(
|
||||||
{{projectChunkId1, {sourceIds[0], sourceIds[1], sourceIds[2], sourceIds[4]}}});
|
{{projectChunkId1, {sourceIds[0], sourceIds[1], sourceIds[2], sourceIds[4]}}});
|
||||||
@@ -234,7 +234,7 @@ TEST_F(ProjectStoragePathWatcher, add_entries_with_same_id_and_different_paths)
|
|||||||
|
|
||||||
TEST_F(ProjectStoragePathWatcher, add_entries_with_different_id_and_same_paths)
|
TEST_F(ProjectStoragePathWatcher, add_entries_with_different_id_and_same_paths)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(mockQFileSytemWatcher, addPaths(ElementsAre(sourceContextPath)));
|
EXPECT_CALL(mockQFileSytemWatcher, addPaths(ElementsAre(directoryPath)));
|
||||||
|
|
||||||
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1]}}});
|
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1]}}});
|
||||||
}
|
}
|
||||||
@@ -294,7 +294,7 @@ TEST_F(ProjectStoragePathWatcher, remove_path_for_one_id)
|
|||||||
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1]}},
|
watcher.updateIdPaths({{projectChunkId1, {sourceIds[0], sourceIds[1]}},
|
||||||
{projectChunkId3, {sourceIds[0], sourceIds[1], sourceIds[3]}}});
|
{projectChunkId3, {sourceIds[0], sourceIds[1], sourceIds[3]}}});
|
||||||
|
|
||||||
EXPECT_CALL(mockQFileSytemWatcher, removePaths(ElementsAre(sourceContextPath2)));
|
EXPECT_CALL(mockQFileSytemWatcher, removePaths(ElementsAre(directoryPath2)));
|
||||||
|
|
||||||
watcher.removeIds({projectChunkId3.id});
|
watcher.removeIds({projectChunkId3.id});
|
||||||
}
|
}
|
||||||
@@ -316,7 +316,7 @@ TEST_F(ProjectStoragePathWatcher, remove_all_paths_for_three_id)
|
|||||||
{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}}});
|
{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}}});
|
||||||
|
|
||||||
EXPECT_CALL(mockQFileSytemWatcher,
|
EXPECT_CALL(mockQFileSytemWatcher,
|
||||||
removePaths(ElementsAre(sourceContextPath, sourceContextPath2)));
|
removePaths(ElementsAre(directoryPath, directoryPath2)));
|
||||||
|
|
||||||
watcher.removeIds({projectChunkId1.id, projectChunkId2.id, projectChunkId3.id});
|
watcher.removeIds({projectChunkId1.id, projectChunkId2.id, projectChunkId3.id});
|
||||||
}
|
}
|
||||||
@@ -327,7 +327,7 @@ TEST_F(ProjectStoragePathWatcher, remove_one_path_for_two_id)
|
|||||||
{projectChunkId2, {sourceIds[0], sourceIds[1]}},
|
{projectChunkId2, {sourceIds[0], sourceIds[1]}},
|
||||||
{projectChunkId3, {sourceIds[3]}}});
|
{projectChunkId3, {sourceIds[3]}}});
|
||||||
|
|
||||||
EXPECT_CALL(mockQFileSytemWatcher, removePaths(ElementsAre(sourceContextPath)));
|
EXPECT_CALL(mockQFileSytemWatcher, removePaths(ElementsAre(directoryPath)));
|
||||||
|
|
||||||
watcher.removeIds({projectChunkId1.id, projectChunkId2.id});
|
watcher.removeIds({projectChunkId1.id, projectChunkId2.id});
|
||||||
}
|
}
|
||||||
@@ -374,8 +374,8 @@ TEST_F(ProjectStoragePathWatcher, two_notify_file_changes)
|
|||||||
ElementsAre(IdPaths{projectChunkId1, {sourceIds[0], sourceIds[1]}},
|
ElementsAre(IdPaths{projectChunkId1, {sourceIds[0], sourceIds[1]}},
|
||||||
IdPaths{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}})));
|
IdPaths{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}})));
|
||||||
|
|
||||||
mockQFileSytemWatcher.directoryChanged(sourceContextPath);
|
mockQFileSytemWatcher.directoryChanged(directoryPath);
|
||||||
mockQFileSytemWatcher.directoryChanged(sourceContextPath2);
|
mockQFileSytemWatcher.directoryChanged(directoryPath2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStoragePathWatcher, notify_for_path_changes_if_modified_time_changes)
|
TEST_F(ProjectStoragePathWatcher, notify_for_path_changes_if_modified_time_changes)
|
||||||
@@ -389,7 +389,7 @@ TEST_F(ProjectStoragePathWatcher, notify_for_path_changes_if_modified_time_chang
|
|||||||
|
|
||||||
EXPECT_CALL(notifier, pathsChanged(ElementsAre(sourceIds[0])));
|
EXPECT_CALL(notifier, pathsChanged(ElementsAre(sourceIds[0])));
|
||||||
|
|
||||||
mockQFileSytemWatcher.directoryChanged(sourceContextPath);
|
mockQFileSytemWatcher.directoryChanged(directoryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStoragePathWatcher, notify_for_path_changes_if_size_get_bigger)
|
TEST_F(ProjectStoragePathWatcher, notify_for_path_changes_if_size_get_bigger)
|
||||||
@@ -403,7 +403,7 @@ TEST_F(ProjectStoragePathWatcher, notify_for_path_changes_if_size_get_bigger)
|
|||||||
|
|
||||||
EXPECT_CALL(notifier, pathsChanged(ElementsAre(sourceIds[0])));
|
EXPECT_CALL(notifier, pathsChanged(ElementsAre(sourceIds[0])));
|
||||||
|
|
||||||
mockQFileSytemWatcher.directoryChanged(sourceContextPath);
|
mockQFileSytemWatcher.directoryChanged(directoryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStoragePathWatcher, notify_for_path_changes_if_size_get_smaller)
|
TEST_F(ProjectStoragePathWatcher, notify_for_path_changes_if_size_get_smaller)
|
||||||
@@ -417,7 +417,7 @@ TEST_F(ProjectStoragePathWatcher, notify_for_path_changes_if_size_get_smaller)
|
|||||||
|
|
||||||
EXPECT_CALL(notifier, pathsChanged(ElementsAre(sourceIds[0])));
|
EXPECT_CALL(notifier, pathsChanged(ElementsAre(sourceIds[0])));
|
||||||
|
|
||||||
mockQFileSytemWatcher.directoryChanged(sourceContextPath);
|
mockQFileSytemWatcher.directoryChanged(directoryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStoragePathWatcher, no_notify_for_unwatched_path_changes)
|
TEST_F(ProjectStoragePathWatcher, no_notify_for_unwatched_path_changes)
|
||||||
@@ -426,7 +426,7 @@ TEST_F(ProjectStoragePathWatcher, no_notify_for_unwatched_path_changes)
|
|||||||
|
|
||||||
EXPECT_CALL(notifier, pathsChanged(IsEmpty()));
|
EXPECT_CALL(notifier, pathsChanged(IsEmpty()));
|
||||||
|
|
||||||
mockQFileSytemWatcher.directoryChanged(sourceContextPath);
|
mockQFileSytemWatcher.directoryChanged(directoryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStoragePathWatcher, no_duplicate_path_changes)
|
TEST_F(ProjectStoragePathWatcher, no_duplicate_path_changes)
|
||||||
@@ -438,8 +438,8 @@ TEST_F(ProjectStoragePathWatcher, no_duplicate_path_changes)
|
|||||||
|
|
||||||
EXPECT_CALL(notifier, pathsChanged(ElementsAre(sourceIds[0])));
|
EXPECT_CALL(notifier, pathsChanged(ElementsAre(sourceIds[0])));
|
||||||
|
|
||||||
mockQFileSytemWatcher.directoryChanged(sourceContextPath);
|
mockQFileSytemWatcher.directoryChanged(directoryPath);
|
||||||
mockQFileSytemWatcher.directoryChanged(sourceContextPath);
|
mockQFileSytemWatcher.directoryChanged(directoryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStoragePathWatcher, trigger_manual_two_notify_file_changes)
|
TEST_F(ProjectStoragePathWatcher, trigger_manual_two_notify_file_changes)
|
||||||
@@ -493,7 +493,7 @@ TEST_F(ProjectStoragePathWatcher, update_context_id_paths_adds_entry_in_new_dire
|
|||||||
{projectChunkId4, {sourceIds[0], sourceIds[1], sourceIds[2], sourceIds[3]}},
|
{projectChunkId4, {sourceIds[0], sourceIds[1], sourceIds[2], sourceIds[3]}},
|
||||||
});
|
});
|
||||||
|
|
||||||
watcher.updateContextIdPaths({{projectChunkId4, {sourceIds[4]}}}, {sourceContextIds[2]});
|
watcher.updateContextIdPaths({{projectChunkId4, {sourceIds[4]}}}, {directoryPathIds[2]});
|
||||||
|
|
||||||
ASSERT_THAT(watcher.watchedEntries(),
|
ASSERT_THAT(watcher.watchedEntries(),
|
||||||
UnorderedElementsAre(watcherEntry1,
|
UnorderedElementsAre(watcherEntry1,
|
||||||
@@ -515,7 +515,7 @@ TEST_F(ProjectStoragePathWatcher, update_context_id_paths_adds_entry_to_director
|
|||||||
|
|
||||||
watcher.updateContextIdPaths({{projectChunkId4,
|
watcher.updateContextIdPaths({{projectChunkId4,
|
||||||
{sourceIds[0], sourceIds[1], sourceIds[2], sourceIds[3]}}},
|
{sourceIds[0], sourceIds[1], sourceIds[2], sourceIds[3]}}},
|
||||||
{sourceContextIds[1]});
|
{directoryPathIds[1]});
|
||||||
|
|
||||||
ASSERT_THAT(watcher.watchedEntries(),
|
ASSERT_THAT(watcher.watchedEntries(),
|
||||||
UnorderedElementsAre(watcherEntry1,
|
UnorderedElementsAre(watcherEntry1,
|
||||||
@@ -534,7 +534,7 @@ TEST_F(ProjectStoragePathWatcher, update_context_id_paths_removes_entry)
|
|||||||
{projectChunkId4, {sourceIds[0], sourceIds[1], sourceIds[2], sourceIds[3]}},
|
{projectChunkId4, {sourceIds[0], sourceIds[1], sourceIds[2], sourceIds[3]}},
|
||||||
});
|
});
|
||||||
|
|
||||||
watcher.updateContextIdPaths({{projectChunkId4, {sourceIds[3]}}}, {sourceContextIds[1]});
|
watcher.updateContextIdPaths({{projectChunkId4, {sourceIds[3]}}}, {directoryPathIds[1]});
|
||||||
|
|
||||||
ASSERT_THAT(watcher.watchedEntries(),
|
ASSERT_THAT(watcher.watchedEntries(),
|
||||||
UnorderedElementsAre(watcherEntry1,
|
UnorderedElementsAre(watcherEntry1,
|
||||||
|
@@ -62,12 +62,12 @@ using namespace Qt::StringLiterals;
|
|||||||
|
|
||||||
namespace Storage = QmlDesigner::Storage;
|
namespace Storage = QmlDesigner::Storage;
|
||||||
|
|
||||||
|
using QmlDesigner::DirectoryPathId;
|
||||||
|
using QmlDesigner::FileNameId;
|
||||||
using QmlDesigner::FileStatus;
|
using QmlDesigner::FileStatus;
|
||||||
using QmlDesigner::ModuleId;
|
|
||||||
using QmlDesigner::SourceContextId;
|
|
||||||
using QmlDesigner::SourceId;
|
|
||||||
using QmlDesigner::SourceNameId;
|
|
||||||
using QmlDesigner::IdPaths;
|
using QmlDesigner::IdPaths;
|
||||||
|
using QmlDesigner::ModuleId;
|
||||||
|
using QmlDesigner::SourceId;
|
||||||
using Storage::Import;
|
using Storage::Import;
|
||||||
using Storage::IsInsideProject;
|
using Storage::IsInsideProject;
|
||||||
using Storage::ModuleKind;
|
using Storage::ModuleKind;
|
||||||
@@ -178,11 +178,11 @@ MATCHER(PackageIsEmpty, std::string(negation ? "isn't empty" : "is empty"))
|
|||||||
&& package.typeAnnotations.empty() && package.updatedTypeAnnotationSourceIds.empty();
|
&& package.typeAnnotations.empty() && package.updatedTypeAnnotationSourceIds.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ModuleIdMatcher, typename TypeNameMatcher, typename SourceIdMatcher, typename SourceContextIdMatcher>
|
template<typename ModuleIdMatcher, typename TypeNameMatcher, typename SourceIdMatcher, typename DirectoryPathIdMatcher>
|
||||||
auto IsPropertyEditorQmlPath(const ModuleIdMatcher &moduleIdMatcher,
|
auto IsPropertyEditorQmlPath(const ModuleIdMatcher &moduleIdMatcher,
|
||||||
const TypeNameMatcher &typeNameMatcher,
|
const TypeNameMatcher &typeNameMatcher,
|
||||||
const SourceIdMatcher &pathIdMatcher,
|
const SourceIdMatcher &pathIdMatcher,
|
||||||
const SourceContextIdMatcher &directoryIdMatcher)
|
const DirectoryPathIdMatcher &directoryIdMatcher)
|
||||||
{
|
{
|
||||||
return AllOf(
|
return AllOf(
|
||||||
Field("PropertyEditorQmlPath::moduleId", &PropertyEditorQmlPath::moduleId, moduleIdMatcher),
|
Field("PropertyEditorQmlPath::moduleId", &PropertyEditorQmlPath::moduleId, moduleIdMatcher),
|
||||||
@@ -315,7 +315,7 @@ public:
|
|||||||
setFileNames(directoryPath, qmlFileNames, {"*.qml"});
|
setFileNames(directoryPath, qmlFileNames, {"*.qml"});
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDirectoryInfos(SourceContextId directorySourceId, const DirectoryInfos &directoryInfos)
|
void setDirectoryInfos(DirectoryPathId directorySourceId, const DirectoryInfos &directoryInfos)
|
||||||
{
|
{
|
||||||
ON_CALL(projectStorageMock, fetchDirectoryInfos(Eq(directorySourceId)))
|
ON_CALL(projectStorageMock, fetchDirectoryInfos(Eq(directorySourceId)))
|
||||||
.WillByDefault(Return(directoryInfos));
|
.WillByDefault(Return(directoryInfos));
|
||||||
@@ -340,8 +340,8 @@ public:
|
|||||||
ON_CALL(fileSystemMock, subdirectories(Eq(directoryPath))).WillByDefault(Return(subdirectoryPaths));
|
ON_CALL(fileSystemMock, subdirectories(Eq(directoryPath))).WillByDefault(Return(subdirectoryPaths));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setStorageSubdirectories(SourceContextId directoryId,
|
void setStorageSubdirectories(DirectoryPathId directoryId,
|
||||||
const QmlDesigner::SmallSourceContextIds<32> &subdirectoryIds)
|
const QmlDesigner::SmallDirectoryPathIds<32> &subdirectoryIds)
|
||||||
{
|
{
|
||||||
ON_CALL(projectStorageMock, fetchSubdirectoryIds(Eq(directoryId)))
|
ON_CALL(projectStorageMock, fetchSubdirectoryIds(Eq(directoryId)))
|
||||||
.WillByDefault(Return(subdirectoryIds));
|
.WillByDefault(Return(subdirectoryIds));
|
||||||
@@ -354,8 +354,8 @@ public:
|
|||||||
|
|
||||||
SourceId createDirectorySourceId(Utils::SmallStringView path) const
|
SourceId createDirectorySourceId(Utils::SmallStringView path) const
|
||||||
{
|
{
|
||||||
auto directoryId = sourcePathCache.sourceContextId(path);
|
auto directoryId = sourcePathCache.directoryPathId(path);
|
||||||
return SourceId::create(SourceNameId{}, directoryId);
|
return SourceId::create(FileNameId{}, directoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceId createDirectorySourceIdFromQString(const QString &path) const
|
SourceId createDirectorySourceIdFromQString(const QString &path) const
|
||||||
@@ -470,22 +470,21 @@ protected:
|
|||||||
SourceId qmltypesPathSourceId = sourcePathCache.sourceId("/path/example.qmltypes");
|
SourceId qmltypesPathSourceId = sourcePathCache.sourceId("/path/example.qmltypes");
|
||||||
SourceId qmltypes2PathSourceId = sourcePathCache.sourceId("/path/example2.qmltypes");
|
SourceId qmltypes2PathSourceId = sourcePathCache.sourceId("/path/example2.qmltypes");
|
||||||
SourceId qmlDirPathSourceId = sourcePathCache.sourceId("/path/qmldir");
|
SourceId qmlDirPathSourceId = sourcePathCache.sourceId("/path/qmldir");
|
||||||
SourceContextId directoryPathId = qmlDirPathSourceId.contextId();
|
DirectoryPathId directoryPathId = qmlDirPathSourceId.contextId();
|
||||||
SourceId directoryPathSourceId = SourceId::create(QmlDesigner::SourceNameId{}, directoryPathId);
|
SourceId directoryPathSourceId = SourceId::create(QmlDesigner::FileNameId{}, directoryPathId);
|
||||||
SourceId annotationDirectorySourceId = createDirectorySourceId("/path/designer");
|
SourceId annotationDirectorySourceId = createDirectorySourceId("/path/designer");
|
||||||
SourceId qmlDocumentSourceId1 = sourcePathCache.sourceId("/path/First.qml");
|
SourceId qmlDocumentSourceId1 = sourcePathCache.sourceId("/path/First.qml");
|
||||||
SourceId qmlDocumentSourceId2 = sourcePathCache.sourceId("/path/First2.qml");
|
SourceId qmlDocumentSourceId2 = sourcePathCache.sourceId("/path/First2.qml");
|
||||||
SourceId qmlDocumentSourceId3 = sourcePathCache.sourceId("/path/Second.qml");
|
SourceId qmlDocumentSourceId3 = sourcePathCache.sourceId("/path/Second.qml");
|
||||||
const QString itemLibraryPath = QDir::cleanPath(
|
const QString itemLibraryPath = QDir::cleanPath(
|
||||||
UNITTEST_DIR "/../../../../share/qtcreator/qmldesigner/itemLibrary/");
|
UNITTEST_DIR "/../../../../share/qtcreator/qmldesigner/itemLibrary/");
|
||||||
SourceContextId itemLibraryPathSourceContextId = sourcePathCache.sourceContextId(
|
DirectoryPathId itemLibraryPathDirectoryPathId = sourcePathCache.directoryPathId(
|
||||||
Utils::PathString{itemLibraryPath});
|
Utils::PathString{itemLibraryPath});
|
||||||
SourceId itemLibraryPathSourceId = SourceId::create(SourceNameId{},
|
SourceId itemLibraryPathSourceId = SourceId::create(FileNameId{}, itemLibraryPathDirectoryPathId);
|
||||||
itemLibraryPathSourceContextId);
|
|
||||||
const QString qmlImportsPath = QDir::cleanPath(UNITTEST_DIR "/projectstorage/data/qml");
|
const QString qmlImportsPath = QDir::cleanPath(UNITTEST_DIR "/projectstorage/data/qml");
|
||||||
SourceContextId qmlImportsPathSourceContextId = sourcePathCache.sourceContextId(
|
DirectoryPathId qmlImportsPathDirectoryPathId = sourcePathCache.directoryPathId(
|
||||||
Utils::PathString{itemLibraryPath});
|
Utils::PathString{itemLibraryPath});
|
||||||
SourceId qmlImportsPathSourceId = SourceId::create(SourceNameId{}, qmlImportsPathSourceContextId);
|
SourceId qmlImportsPathSourceId = SourceId::create(FileNameId{}, qmlImportsPathDirectoryPathId);
|
||||||
ModuleId qmlModuleId{storage.moduleId("Qml", ModuleKind::QmlLibrary)};
|
ModuleId qmlModuleId{storage.moduleId("Qml", ModuleKind::QmlLibrary)};
|
||||||
ModuleId qmlCppNativeModuleId{storage.moduleId("Qml", ModuleKind::CppLibrary)};
|
ModuleId qmlCppNativeModuleId{storage.moduleId("Qml", ModuleKind::CppLibrary)};
|
||||||
ModuleId exampleModuleId{storage.moduleId("Example", ModuleKind::QmlLibrary)};
|
ModuleId exampleModuleId{storage.moduleId("Example", ModuleKind::QmlLibrary)};
|
||||||
@@ -537,12 +536,12 @@ protected:
|
|||||||
QmlDesigner::SourceType::Qml};
|
QmlDesigner::SourceType::Qml};
|
||||||
QmlDesigner::ProjectChunkId otherQmltypesProjectChunkId{otherProjectPartId,
|
QmlDesigner::ProjectChunkId otherQmltypesProjectChunkId{otherProjectPartId,
|
||||||
QmlDesigner::SourceType::QmlTypes};
|
QmlDesigner::SourceType::QmlTypes};
|
||||||
SourceContextId path1SourceContextId = sourcePathCache.sourceContextId("/path/one");
|
DirectoryPathId path1DirectoryPathId = sourcePathCache.directoryPathId("/path/one");
|
||||||
SourceId path1SourceId = SourceId::create(QmlDesigner::SourceNameId{}, path1SourceContextId);
|
SourceId path1SourceId = SourceId::create(QmlDesigner::FileNameId{}, path1DirectoryPathId);
|
||||||
SourceContextId path2SourceContextId = sourcePathCache.sourceContextId("/path/two");
|
DirectoryPathId path2DirectoryPathId = sourcePathCache.directoryPathId("/path/two");
|
||||||
SourceId path2SourceId = SourceId::create(QmlDesigner::SourceNameId{}, path2SourceContextId);
|
SourceId path2SourceId = SourceId::create(QmlDesigner::FileNameId{}, path2DirectoryPathId);
|
||||||
SourceContextId path3SourceContextId = sourcePathCache.sourceContextId("/path/three");
|
DirectoryPathId path3DirectoryPathId = sourcePathCache.directoryPathId("/path/three");
|
||||||
SourceId path3SourceId = SourceId::create(QmlDesigner::SourceNameId{}, path3SourceContextId);
|
SourceId path3SourceId = SourceId::create(QmlDesigner::FileNameId{}, path3DirectoryPathId);
|
||||||
SourceId qmldir1SourceId = sourcePathCache.sourceId("/path/one/qmldir");
|
SourceId qmldir1SourceId = sourcePathCache.sourceId("/path/one/qmldir");
|
||||||
SourceId qmldir2SourceId = sourcePathCache.sourceId("/path/two/qmldir");
|
SourceId qmldir2SourceId = sourcePathCache.sourceId("/path/two/qmldir");
|
||||||
SourceId qmldir3SourceId = sourcePathCache.sourceId("/path/three/qmldir");
|
SourceId qmldir3SourceId = sourcePathCache.sourceId("/path/three/qmldir");
|
||||||
@@ -609,8 +608,8 @@ public:
|
|||||||
QStringList directories = {"/path"};
|
QStringList directories = {"/path"};
|
||||||
SourceId qmltypesPathSourceId = sourcePathCache.sourceId("/path/example.qmltypes");
|
SourceId qmltypesPathSourceId = sourcePathCache.sourceId("/path/example.qmltypes");
|
||||||
SourceId qmlDirPathSourceId = sourcePathCache.sourceId("/path/qmldir");
|
SourceId qmlDirPathSourceId = sourcePathCache.sourceId("/path/qmldir");
|
||||||
SourceContextId directoryPathId = qmlDirPathSourceId.contextId();
|
DirectoryPathId directoryPathId = qmlDirPathSourceId.contextId();
|
||||||
SourceId directoryPathSourceId = SourceId::create(QmlDesigner::SourceNameId{}, directoryPathId);
|
SourceId directoryPathSourceId = SourceId::create(QmlDesigner::FileNameId{}, directoryPathId);
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(ProjectStorageUpdater_get_content_for_qml_types, added_qml_types_file_provides_content)
|
TEST_F(ProjectStorageUpdater_get_content_for_qml_types, added_qml_types_file_provides_content)
|
||||||
@@ -670,8 +669,8 @@ public:
|
|||||||
SourceId qmltypesPathSourceId = sourcePathCache.sourceId("/root/path/example.qmltypes");
|
SourceId qmltypesPathSourceId = sourcePathCache.sourceId("/root/path/example.qmltypes");
|
||||||
SourceId qmltypes2PathSourceId = sourcePathCache.sourceId("/root/path/example2.qmltypes");
|
SourceId qmltypes2PathSourceId = sourcePathCache.sourceId("/root/path/example2.qmltypes");
|
||||||
SourceId qmlDirPathSourceId = sourcePathCache.sourceId("/root/path/qmldir");
|
SourceId qmlDirPathSourceId = sourcePathCache.sourceId("/root/path/qmldir");
|
||||||
SourceContextId directoryPathId = qmlDirPathSourceId.contextId();
|
DirectoryPathId directoryPathId = qmlDirPathSourceId.contextId();
|
||||||
SourceId directoryPathSourceId = SourceId::create(QmlDesigner::SourceNameId{}, directoryPathId);
|
SourceId directoryPathSourceId = SourceId::create(QmlDesigner::FileNameId{}, directoryPathId);
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(ProjectStorageUpdater_parse_qml_types, add_directory)
|
TEST_F(ProjectStorageUpdater_parse_qml_types, add_directory)
|
||||||
@@ -783,8 +782,8 @@ public:
|
|||||||
SourceId qmltypesPathSourceId = sourcePathCache.sourceId("/root/path/example.qmltypes");
|
SourceId qmltypesPathSourceId = sourcePathCache.sourceId("/root/path/example.qmltypes");
|
||||||
SourceId qmltypes2PathSourceId = sourcePathCache.sourceId("/root/path/example2.qmltypes");
|
SourceId qmltypes2PathSourceId = sourcePathCache.sourceId("/root/path/example2.qmltypes");
|
||||||
SourceId qmlDirPathSourceId = sourcePathCache.sourceId("/root/path/qmldir");
|
SourceId qmlDirPathSourceId = sourcePathCache.sourceId("/root/path/qmldir");
|
||||||
SourceContextId directoryPathId = qmlDirPathSourceId.contextId();
|
DirectoryPathId directoryPathId = qmlDirPathSourceId.contextId();
|
||||||
SourceId directoryPathSourceId = SourceId::create(QmlDesigner::SourceNameId{}, directoryPathId);
|
SourceId directoryPathSourceId = SourceId::create(QmlDesigner::FileNameId{}, directoryPathId);
|
||||||
SourceId annotationDirectoryId = createDirectorySourceId("/root/path/designer");
|
SourceId annotationDirectoryId = createDirectorySourceId("/root/path/designer");
|
||||||
SourceId rootQmlDirPathSourceId = sourcePathCache.sourceId("/root/qmldir");
|
SourceId rootQmlDirPathSourceId = sourcePathCache.sourceId("/root/qmldir");
|
||||||
SourceId rootDirectoryPathSourceId = createDirectorySourceId("/root");
|
SourceId rootDirectoryPathSourceId = createDirectorySourceId("/root");
|
||||||
@@ -878,13 +877,13 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SourceId rootDirectoryPathSourceId = createDirectorySourceId("/root");
|
SourceId rootDirectoryPathSourceId = createDirectorySourceId("/root");
|
||||||
SourceContextId rootDirectoryPathId = rootDirectoryPathSourceId.contextId();
|
DirectoryPathId rootDirectoryPathId = rootDirectoryPathSourceId.contextId();
|
||||||
SourceId path1SourceId = createDirectorySourceId("/root/one");
|
SourceId path1SourceId = createDirectorySourceId("/root/one");
|
||||||
SourceContextId path1SourceContextId = path1SourceId.contextId();
|
DirectoryPathId path1DirectoryPathId = path1SourceId.contextId();
|
||||||
SourceId path2SourceId = createDirectorySourceId("/root/two");
|
SourceId path2SourceId = createDirectorySourceId("/root/two");
|
||||||
SourceContextId path2SourceContextId = path2SourceId.contextId();
|
DirectoryPathId path2DirectoryPathId = path2SourceId.contextId();
|
||||||
SourceId path3SourceId = createDirectorySourceId("/root/one/three");
|
SourceId path3SourceId = createDirectorySourceId("/root/one/three");
|
||||||
SourceContextId path3SourceContextId = path3SourceId.contextId();
|
DirectoryPathId path3DirectoryPathId = path3SourceId.contextId();
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(ProjectStorageUpdater_synchronize_subdirectories, added_qt_subdircectories)
|
TEST_F(ProjectStorageUpdater_synchronize_subdirectories, added_qt_subdircectories)
|
||||||
@@ -899,13 +898,13 @@ TEST_F(ProjectStorageUpdater_synchronize_subdirectories, added_qt_subdircectorie
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
IsDirectoryInfo(rootDirectoryPathId, path1SourceId, ModuleId{}, FileType::Directory),
|
IsDirectoryInfo(rootDirectoryPathId, path1SourceId, ModuleId{}, FileType::Directory),
|
||||||
IsDirectoryInfo(rootDirectoryPathId, path2SourceId, ModuleId{}, FileType::Directory),
|
IsDirectoryInfo(rootDirectoryPathId, path2SourceId, ModuleId{}, FileType::Directory),
|
||||||
IsDirectoryInfo(path1SourceContextId, path3SourceId, ModuleId{}, FileType::Directory))),
|
IsDirectoryInfo(path1DirectoryPathId, path3SourceId, ModuleId{}, FileType::Directory))),
|
||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(rootDirectoryPathId,
|
UnorderedElementsAre(rootDirectoryPathId,
|
||||||
path1SourceContextId,
|
path1DirectoryPathId,
|
||||||
path2SourceContextId,
|
path2DirectoryPathId,
|
||||||
path3SourceContextId)))));
|
path3DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.qtDirectories = {"/root"}});
|
updater.update({.qtDirectories = {"/root"}});
|
||||||
}
|
}
|
||||||
@@ -922,13 +921,13 @@ TEST_F(ProjectStorageUpdater_synchronize_subdirectories, changed_qt_subdircector
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
IsDirectoryInfo(rootDirectoryPathId, path1SourceId, ModuleId{}, FileType::Directory),
|
IsDirectoryInfo(rootDirectoryPathId, path1SourceId, ModuleId{}, FileType::Directory),
|
||||||
IsDirectoryInfo(rootDirectoryPathId, path2SourceId, ModuleId{}, FileType::Directory),
|
IsDirectoryInfo(rootDirectoryPathId, path2SourceId, ModuleId{}, FileType::Directory),
|
||||||
IsDirectoryInfo(path1SourceContextId, path3SourceId, ModuleId{}, FileType::Directory))),
|
IsDirectoryInfo(path1DirectoryPathId, path3SourceId, ModuleId{}, FileType::Directory))),
|
||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(rootDirectoryPathId,
|
UnorderedElementsAre(rootDirectoryPathId,
|
||||||
path1SourceContextId,
|
path1DirectoryPathId,
|
||||||
path2SourceContextId,
|
path2DirectoryPathId,
|
||||||
path3SourceContextId)))));
|
path3DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.qtDirectories = {"/root"}});
|
updater.update({.qtDirectories = {"/root"}});
|
||||||
}
|
}
|
||||||
@@ -945,13 +944,13 @@ TEST_F(ProjectStorageUpdater_synchronize_subdirectories, added_project_subdircec
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
IsDirectoryInfo(rootDirectoryPathId, path1SourceId, ModuleId{}, FileType::Directory),
|
IsDirectoryInfo(rootDirectoryPathId, path1SourceId, ModuleId{}, FileType::Directory),
|
||||||
IsDirectoryInfo(rootDirectoryPathId, path2SourceId, ModuleId{}, FileType::Directory),
|
IsDirectoryInfo(rootDirectoryPathId, path2SourceId, ModuleId{}, FileType::Directory),
|
||||||
IsDirectoryInfo(path1SourceContextId, path3SourceId, ModuleId{}, FileType::Directory))),
|
IsDirectoryInfo(path1DirectoryPathId, path3SourceId, ModuleId{}, FileType::Directory))),
|
||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(rootDirectoryPathId,
|
UnorderedElementsAre(rootDirectoryPathId,
|
||||||
path1SourceContextId,
|
path1DirectoryPathId,
|
||||||
path2SourceContextId,
|
path2DirectoryPathId,
|
||||||
path3SourceContextId)))));
|
path3DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.projectDirectory = "/root"});
|
updater.update({.projectDirectory = "/root"});
|
||||||
}
|
}
|
||||||
@@ -968,13 +967,13 @@ TEST_F(ProjectStorageUpdater_synchronize_subdirectories, changed_project_subdirc
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
IsDirectoryInfo(rootDirectoryPathId, path1SourceId, ModuleId{}, FileType::Directory),
|
IsDirectoryInfo(rootDirectoryPathId, path1SourceId, ModuleId{}, FileType::Directory),
|
||||||
IsDirectoryInfo(rootDirectoryPathId, path2SourceId, ModuleId{}, FileType::Directory),
|
IsDirectoryInfo(rootDirectoryPathId, path2SourceId, ModuleId{}, FileType::Directory),
|
||||||
IsDirectoryInfo(path1SourceContextId, path3SourceId, ModuleId{}, FileType::Directory))),
|
IsDirectoryInfo(path1DirectoryPathId, path3SourceId, ModuleId{}, FileType::Directory))),
|
||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(rootDirectoryPathId,
|
UnorderedElementsAre(rootDirectoryPathId,
|
||||||
path1SourceContextId,
|
path1DirectoryPathId,
|
||||||
path2SourceContextId,
|
path2DirectoryPathId,
|
||||||
path3SourceContextId)))));
|
path3DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.projectDirectory = "/root"});
|
updater.update({.projectDirectory = "/root"});
|
||||||
}
|
}
|
||||||
@@ -987,15 +986,15 @@ TEST_F(ProjectStorageUpdater_synchronize_subdirectories, qt_subdirectories_if_ro
|
|||||||
EXPECT_CALL(projectStorageMock,
|
EXPECT_CALL(projectStorageMock,
|
||||||
synchronize(AllOf(Field("SynchronizationPackage::directoryInfos",
|
synchronize(AllOf(Field("SynchronizationPackage::directoryInfos",
|
||||||
&SynchronizationPackage::directoryInfos,
|
&SynchronizationPackage::directoryInfos,
|
||||||
UnorderedElementsAre(IsDirectoryInfo(path1SourceContextId,
|
UnorderedElementsAre(IsDirectoryInfo(path1DirectoryPathId,
|
||||||
path3SourceId,
|
path3SourceId,
|
||||||
ModuleId{},
|
ModuleId{},
|
||||||
FileType::Directory))),
|
FileType::Directory))),
|
||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(path1SourceContextId,
|
UnorderedElementsAre(path1DirectoryPathId,
|
||||||
path2SourceContextId,
|
path2DirectoryPathId,
|
||||||
path3SourceContextId)))));
|
path3DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.qtDirectories = {"/root"}});
|
updater.update({.qtDirectories = {"/root"}});
|
||||||
}
|
}
|
||||||
@@ -1008,15 +1007,15 @@ TEST_F(ProjectStorageUpdater_synchronize_subdirectories, project_subdirectories_
|
|||||||
EXPECT_CALL(projectStorageMock,
|
EXPECT_CALL(projectStorageMock,
|
||||||
synchronize(AllOf(Field("SynchronizationPackage::directoryInfos",
|
synchronize(AllOf(Field("SynchronizationPackage::directoryInfos",
|
||||||
&SynchronizationPackage::directoryInfos,
|
&SynchronizationPackage::directoryInfos,
|
||||||
UnorderedElementsAre(IsDirectoryInfo(path1SourceContextId,
|
UnorderedElementsAre(IsDirectoryInfo(path1DirectoryPathId,
|
||||||
path3SourceId,
|
path3SourceId,
|
||||||
ModuleId{},
|
ModuleId{},
|
||||||
FileType::Directory))),
|
FileType::Directory))),
|
||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(path1SourceContextId,
|
UnorderedElementsAre(path1DirectoryPathId,
|
||||||
path2SourceContextId,
|
path2DirectoryPathId,
|
||||||
path3SourceContextId)))));
|
path3DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.projectDirectory = "/root"});
|
updater.update({.projectDirectory = "/root"});
|
||||||
}
|
}
|
||||||
@@ -1026,8 +1025,8 @@ TEST_F(ProjectStorageUpdater_synchronize_subdirectories, for_deleted_qt_subdirec
|
|||||||
setFilesChanged({rootDirectoryPathSourceId});
|
setFilesChanged({rootDirectoryPathSourceId});
|
||||||
setFilesRemoved({path1SourceId, path3SourceId});
|
setFilesRemoved({path1SourceId, path3SourceId});
|
||||||
setFilesUnchanged({path2SourceId});
|
setFilesUnchanged({path2SourceId});
|
||||||
setStorageSubdirectories(rootDirectoryPathId, {path1SourceContextId, path2SourceContextId});
|
setStorageSubdirectories(rootDirectoryPathId, {path1DirectoryPathId, path2DirectoryPathId});
|
||||||
setStorageSubdirectories(path1SourceContextId, {path3SourceContextId});
|
setStorageSubdirectories(path1DirectoryPathId, {path3DirectoryPathId});
|
||||||
setFileSystemSubdirectories(u"/root", {"/root/two"});
|
setFileSystemSubdirectories(u"/root", {"/root/two"});
|
||||||
|
|
||||||
EXPECT_CALL(projectStorageMock,
|
EXPECT_CALL(projectStorageMock,
|
||||||
@@ -1040,8 +1039,8 @@ TEST_F(ProjectStorageUpdater_synchronize_subdirectories, for_deleted_qt_subdirec
|
|||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(rootDirectoryPathId,
|
UnorderedElementsAre(rootDirectoryPathId,
|
||||||
path1SourceContextId,
|
path1DirectoryPathId,
|
||||||
path3SourceContextId)))));
|
path3DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.qtDirectories = {"/root"}});
|
updater.update({.qtDirectories = {"/root"}});
|
||||||
}
|
}
|
||||||
@@ -1051,8 +1050,8 @@ TEST_F(ProjectStorageUpdater_synchronize_subdirectories, for_deleted_project_sub
|
|||||||
setFilesChanged({rootDirectoryPathSourceId});
|
setFilesChanged({rootDirectoryPathSourceId});
|
||||||
setFilesRemoved({path1SourceId, path3SourceId});
|
setFilesRemoved({path1SourceId, path3SourceId});
|
||||||
setFilesUnchanged({path2SourceId});
|
setFilesUnchanged({path2SourceId});
|
||||||
setStorageSubdirectories(rootDirectoryPathId, {path1SourceContextId, path2SourceContextId});
|
setStorageSubdirectories(rootDirectoryPathId, {path1DirectoryPathId, path2DirectoryPathId});
|
||||||
setStorageSubdirectories(path1SourceContextId, {path3SourceContextId});
|
setStorageSubdirectories(path1DirectoryPathId, {path3DirectoryPathId});
|
||||||
setFileSystemSubdirectories(u"/root", {"/root/two"});
|
setFileSystemSubdirectories(u"/root", {"/root/two"});
|
||||||
|
|
||||||
EXPECT_CALL(projectStorageMock,
|
EXPECT_CALL(projectStorageMock,
|
||||||
@@ -1065,8 +1064,8 @@ TEST_F(ProjectStorageUpdater_synchronize_subdirectories, for_deleted_project_sub
|
|||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(rootDirectoryPathId,
|
UnorderedElementsAre(rootDirectoryPathId,
|
||||||
path1SourceContextId,
|
path1DirectoryPathId,
|
||||||
path3SourceContextId)))));
|
path3DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.projectDirectory = {"/root"}});
|
updater.update({.projectDirectory = {"/root"}});
|
||||||
}
|
}
|
||||||
@@ -1093,8 +1092,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
SourceId qmltypesPathSourceId = sourcePathCache.sourceId("/path/example.qmltypes");
|
SourceId qmltypesPathSourceId = sourcePathCache.sourceId("/path/example.qmltypes");
|
||||||
SourceId qmlDirPathSourceId = sourcePathCache.sourceId("/path/qmldir");
|
SourceId qmlDirPathSourceId = sourcePathCache.sourceId("/path/qmldir");
|
||||||
SourceContextId directoryPathId = qmlDirPathSourceId.contextId();
|
DirectoryPathId directoryPathId = qmlDirPathSourceId.contextId();
|
||||||
SourceId directoryPathSourceId = SourceId::create(QmlDesigner::SourceNameId{}, directoryPathId);
|
SourceId directoryPathSourceId = SourceId::create(QmlDesigner::FileNameId{}, directoryPathId);
|
||||||
SourceId annotationDirectorySourceId = createDirectorySourceId("/path/designer");
|
SourceId annotationDirectorySourceId = createDirectorySourceId("/path/designer");
|
||||||
ModuleId qmlModuleId{storage.moduleId("Qml", ModuleKind::QmlLibrary)};
|
ModuleId qmlModuleId{storage.moduleId("Qml", ModuleKind::QmlLibrary)};
|
||||||
ModuleId exampleModuleId{storage.moduleId("Example", ModuleKind::QmlLibrary)};
|
ModuleId exampleModuleId{storage.moduleId("Example", ModuleKind::QmlLibrary)};
|
||||||
@@ -2744,11 +2743,11 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qml_files_changed)
|
|||||||
{
|
{
|
||||||
setFilesUnchanged({qmldir1SourceId, qmldir2SourceId, path1SourceId, path2SourceId});
|
setFilesUnchanged({qmldir1SourceId, qmldir2SourceId, path1SourceId, path2SourceId});
|
||||||
setFilesChanged({firstSourceId, secondSourceId, thirdSourceId});
|
setFilesChanged({firstSourceId, secondSourceId, thirdSourceId});
|
||||||
setDirectoryInfos(path1SourceContextId,
|
setDirectoryInfos(path1DirectoryPathId,
|
||||||
{{path1SourceContextId, firstSourceId, exampleModuleId, FileType::QmlDocument},
|
{{path1DirectoryPathId, firstSourceId, exampleModuleId, FileType::QmlDocument},
|
||||||
{path1SourceContextId, secondSourceId, exampleModuleId, FileType::QmlDocument}});
|
{path1DirectoryPathId, secondSourceId, exampleModuleId, FileType::QmlDocument}});
|
||||||
setDirectoryInfos(path2SourceContextId,
|
setDirectoryInfos(path2DirectoryPathId,
|
||||||
{{path2SourceContextId, thirdSourceId, ModuleId{}, FileType::QmlDocument}});
|
{{path2DirectoryPathId, thirdSourceId, ModuleId{}, FileType::QmlDocument}});
|
||||||
|
|
||||||
EXPECT_CALL(patchWatcherMock,
|
EXPECT_CALL(patchWatcherMock,
|
||||||
updateIdPaths(Contains(IdPaths{qtPartId,
|
updateIdPaths(Contains(IdPaths{qtPartId,
|
||||||
@@ -2767,11 +2766,11 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qml_files_and_directories_dont
|
|||||||
firstSourceId,
|
firstSourceId,
|
||||||
secondSourceId,
|
secondSourceId,
|
||||||
thirdSourceId});
|
thirdSourceId});
|
||||||
setDirectoryInfos(path1SourceContextId,
|
setDirectoryInfos(path1DirectoryPathId,
|
||||||
{{path1SourceContextId, firstSourceId, exampleModuleId, FileType::QmlDocument},
|
{{path1DirectoryPathId, firstSourceId, exampleModuleId, FileType::QmlDocument},
|
||||||
{path1SourceContextId, secondSourceId, exampleModuleId, FileType::QmlDocument}});
|
{path1DirectoryPathId, secondSourceId, exampleModuleId, FileType::QmlDocument}});
|
||||||
setDirectoryInfos(path2SourceContextId,
|
setDirectoryInfos(path2DirectoryPathId,
|
||||||
{{path2SourceContextId, thirdSourceId, ModuleId{}, FileType::QmlDocument}});
|
{{path2DirectoryPathId, thirdSourceId, ModuleId{}, FileType::QmlDocument}});
|
||||||
|
|
||||||
EXPECT_CALL(patchWatcherMock,
|
EXPECT_CALL(patchWatcherMock,
|
||||||
updateIdPaths(Contains(IdPaths{qtPartId,
|
updateIdPaths(Contains(IdPaths{qtPartId,
|
||||||
@@ -2822,10 +2821,10 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qmltypes_files_changed)
|
|||||||
{
|
{
|
||||||
setFilesUnchanged({qmldir1SourceId, qmldir2SourceId, path1SourceId, path2SourceId});
|
setFilesUnchanged({qmldir1SourceId, qmldir2SourceId, path1SourceId, path2SourceId});
|
||||||
setFilesChanged({qmltypes1SourceId, qmltypes2SourceId});
|
setFilesChanged({qmltypes1SourceId, qmltypes2SourceId});
|
||||||
setDirectoryInfos(path1SourceContextId,
|
setDirectoryInfos(path1DirectoryPathId,
|
||||||
{{path1SourceContextId, qmltypes1SourceId, exampleModuleId, FileType::QmlTypes}});
|
{{path1DirectoryPathId, qmltypes1SourceId, exampleModuleId, FileType::QmlTypes}});
|
||||||
setDirectoryInfos(path2SourceContextId,
|
setDirectoryInfos(path2DirectoryPathId,
|
||||||
{{path2SourceContextId, qmltypes2SourceId, exampleModuleId, FileType::QmlTypes}});
|
{{path2DirectoryPathId, qmltypes2SourceId, exampleModuleId, FileType::QmlTypes}});
|
||||||
|
|
||||||
EXPECT_CALL(patchWatcherMock,
|
EXPECT_CALL(patchWatcherMock,
|
||||||
updateIdPaths(Contains(IdPaths{qtPartId,
|
updateIdPaths(Contains(IdPaths{qtPartId,
|
||||||
@@ -2843,10 +2842,10 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmltypes_files_and_directories
|
|||||||
path2SourceId,
|
path2SourceId,
|
||||||
qmltypes1SourceId,
|
qmltypes1SourceId,
|
||||||
qmltypes2SourceId});
|
qmltypes2SourceId});
|
||||||
setDirectoryInfos(path1SourceContextId,
|
setDirectoryInfos(path1DirectoryPathId,
|
||||||
{{path1SourceContextId, qmltypes1SourceId, exampleModuleId, FileType::QmlTypes}});
|
{{path1DirectoryPathId, qmltypes1SourceId, exampleModuleId, FileType::QmlTypes}});
|
||||||
setDirectoryInfos(path2SourceContextId,
|
setDirectoryInfos(path2DirectoryPathId,
|
||||||
{{path2SourceContextId, qmltypes2SourceId, exampleModuleId, FileType::QmlTypes}});
|
{{path2DirectoryPathId, qmltypes2SourceId, exampleModuleId, FileType::QmlTypes}});
|
||||||
|
|
||||||
EXPECT_CALL(patchWatcherMock,
|
EXPECT_CALL(patchWatcherMock,
|
||||||
updateIdPaths(Contains(IdPaths{qtPartId,
|
updateIdPaths(Contains(IdPaths{qtPartId,
|
||||||
@@ -3244,8 +3243,8 @@ TEST_F(ProjectStorageUpdater, watcher_updates_subdirectories)
|
|||||||
FirstType 2.2 First2.qml
|
FirstType 2.2 First2.qml
|
||||||
SecondType 2.2 Second.qml)"};
|
SecondType 2.2 Second.qml)"};
|
||||||
setContent(u"/path/qmldir", qmldir);
|
setContent(u"/path/qmldir", qmldir);
|
||||||
SourceContextId rootPathId = sourcePathCache.sourceContextId("/root");
|
DirectoryPathId rootPathId = sourcePathCache.directoryPathId("/root");
|
||||||
SourceId rootPathSourceId = SourceId::create(QmlDesigner::SourceNameId{}, rootPathId);
|
SourceId rootPathSourceId = SourceId::create(QmlDesigner::FileNameId{}, rootPathId);
|
||||||
SourceId rootQmldirPathSourceId = sourcePathCache.sourceId("/root/qmldir");
|
SourceId rootQmldirPathSourceId = sourcePathCache.sourceId("/root/qmldir");
|
||||||
setFilesChanged({directoryPathSourceId, rootPathSourceId});
|
setFilesChanged({directoryPathSourceId, rootPathSourceId});
|
||||||
setFilesUnchanged({qmlDirPathSourceId, rootQmldirPathSourceId});
|
setFilesUnchanged({qmlDirPathSourceId, rootQmldirPathSourceId});
|
||||||
@@ -3357,7 +3356,7 @@ TEST_F(ProjectStorageUpdater, watcher_watches_directories_after_directory_change
|
|||||||
setContent(u"/path/qmldir", qmldir);
|
setContent(u"/path/qmldir", qmldir);
|
||||||
setFilesChanged({directoryPathSourceId});
|
setFilesChanged({directoryPathSourceId});
|
||||||
setFilesUnchanged({qmlDirPathSourceId});
|
setFilesUnchanged({qmlDirPathSourceId});
|
||||||
auto directorySourceContextId = directoryPathSourceId.contextId();
|
auto directoryDirectoryPathId = directoryPathSourceId.contextId();
|
||||||
|
|
||||||
EXPECT_CALL(patchWatcherMock,
|
EXPECT_CALL(patchWatcherMock,
|
||||||
updateContextIdPaths(
|
updateContextIdPaths(
|
||||||
@@ -3367,7 +3366,7 @@ TEST_F(ProjectStorageUpdater, watcher_watches_directories_after_directory_change
|
|||||||
IdPaths{qtPartId,
|
IdPaths{qtPartId,
|
||||||
QmlDesigner::SourceType::Qml,
|
QmlDesigner::SourceType::Qml,
|
||||||
{qmlDocumentSourceId1, qmlDocumentSourceId2, qmlDocumentSourceId3}}),
|
{qmlDocumentSourceId1, qmlDocumentSourceId2, qmlDocumentSourceId3}}),
|
||||||
UnorderedElementsAre(directorySourceContextId)));
|
UnorderedElementsAre(directoryDirectoryPathId)));
|
||||||
|
|
||||||
updater.pathsWithIdsChanged({{directoryProjectChunkId, {directoryPathSourceId}}});
|
updater.pathsWithIdsChanged({{directoryProjectChunkId, {directoryPathSourceId}}});
|
||||||
}
|
}
|
||||||
@@ -3472,7 +3471,7 @@ TEST_F(ProjectStorageUpdater, watcher_watches_directories_after_qmldir_changes)
|
|||||||
FirstType 2.2 First2.qml
|
FirstType 2.2 First2.qml
|
||||||
SecondType 2.2 Second.qml)"};
|
SecondType 2.2 Second.qml)"};
|
||||||
setContent(u"/path/qmldir", qmldir);
|
setContent(u"/path/qmldir", qmldir);
|
||||||
auto directorySourceContextId = qmlDirPathSourceId.contextId();
|
auto directoryDirectoryPathId = qmlDirPathSourceId.contextId();
|
||||||
|
|
||||||
EXPECT_CALL(patchWatcherMock,
|
EXPECT_CALL(patchWatcherMock,
|
||||||
updateContextIdPaths(
|
updateContextIdPaths(
|
||||||
@@ -3482,7 +3481,7 @@ TEST_F(ProjectStorageUpdater, watcher_watches_directories_after_qmldir_changes)
|
|||||||
IdPaths{qtPartId,
|
IdPaths{qtPartId,
|
||||||
QmlDesigner::SourceType::Qml,
|
QmlDesigner::SourceType::Qml,
|
||||||
{qmlDocumentSourceId1, qmlDocumentSourceId2, qmlDocumentSourceId3}}),
|
{qmlDocumentSourceId1, qmlDocumentSourceId2, qmlDocumentSourceId3}}),
|
||||||
UnorderedElementsAre(directorySourceContextId)));
|
UnorderedElementsAre(directoryDirectoryPathId)));
|
||||||
|
|
||||||
updater.pathsWithIdsChanged({{qmldirProjectChunkId, {qmlDirPathSourceId}}});
|
updater.pathsWithIdsChanged({{qmldirProjectChunkId, {qmlDirPathSourceId}}});
|
||||||
}
|
}
|
||||||
@@ -4793,9 +4792,9 @@ TEST_F(ProjectStorageUpdater, update_property_editor_panes)
|
|||||||
});
|
});
|
||||||
auto sourceId = sourcePathCache.sourceId(
|
auto sourceId = sourcePathCache.sourceId(
|
||||||
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QML/QtObjectPane.qml"});
|
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QML/QtObjectPane.qml"});
|
||||||
auto directoryId = sourcePathCache.sourceContextId(
|
auto directoryId = sourcePathCache.directoryPathId(
|
||||||
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QML"});
|
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QML"});
|
||||||
auto directorySourceId = SourceId::create(QmlDesigner::SourceNameId{}, directoryId);
|
auto directorySourceId = SourceId::create(QmlDesigner::FileNameId{}, directoryId);
|
||||||
setFilesChanged({directorySourceId});
|
setFilesChanged({directorySourceId});
|
||||||
auto qmlModuleId = storage.moduleId("QML", ModuleKind::QmlLibrary);
|
auto qmlModuleId = storage.moduleId("QML", ModuleKind::QmlLibrary);
|
||||||
|
|
||||||
@@ -4828,15 +4827,14 @@ TEST_F(ProjectStorageUpdater, update_property_editor_specifics)
|
|||||||
});
|
});
|
||||||
auto textSourceId = sourcePathCache.sourceId(
|
auto textSourceId = sourcePathCache.sourceId(
|
||||||
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QtQuick/TextSpecifics.qml"});
|
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QtQuick/TextSpecifics.qml"});
|
||||||
auto qtQuickDirectoryId = sourcePathCache.sourceContextId(
|
auto qtQuickDirectoryId = sourcePathCache.directoryPathId(
|
||||||
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QtQuick"});
|
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QtQuick"});
|
||||||
auto qtQuickDirectorySourceId = SourceId::create(QmlDesigner::SourceNameId{}, qtQuickDirectoryId);
|
auto qtQuickDirectorySourceId = SourceId::create(QmlDesigner::FileNameId{}, qtQuickDirectoryId);
|
||||||
auto buttonSourceId = sourcePathCache.sourceId(
|
auto buttonSourceId = sourcePathCache.sourceId(
|
||||||
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QtQuick/Controls/ButtonSpecifics.qml"});
|
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QtQuick/Controls/ButtonSpecifics.qml"});
|
||||||
auto controlsDirectoryId = sourcePathCache.sourceContextId(
|
auto controlsDirectoryId = sourcePathCache.directoryPathId(
|
||||||
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QtQuick/Controls"});
|
QmlDesigner::SourcePath{propertyEditorQmlPath + "/QtQuick/Controls"});
|
||||||
auto controlsDirectorySourceId = SourceId::create(QmlDesigner::SourceNameId{},
|
auto controlsDirectorySourceId = SourceId::create(QmlDesigner::FileNameId{}, controlsDirectoryId);
|
||||||
controlsDirectoryId);
|
|
||||||
setFilesChanged({qtQuickDirectorySourceId, controlsDirectorySourceId});
|
setFilesChanged({qtQuickDirectorySourceId, controlsDirectorySourceId});
|
||||||
auto qtQuickModuleId = storage.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
auto qtQuickModuleId = storage.moduleId("QtQuick", ModuleKind::QmlLibrary);
|
||||||
auto controlsModuleId = storage.moduleId("QtQuick.Controls", ModuleKind::QmlLibrary);
|
auto controlsModuleId = storage.moduleId("QtQuick.Controls", ModuleKind::QmlLibrary);
|
||||||
@@ -4888,7 +4886,7 @@ TEST_F(ProjectStorageUpdater, update_type_annotations)
|
|||||||
synchronize(AllOf(Field("SynchronizationPackage::typeAnnotations",
|
synchronize(AllOf(Field("SynchronizationPackage::typeAnnotations",
|
||||||
&SynchronizationPackage::typeAnnotations,
|
&SynchronizationPackage::typeAnnotations,
|
||||||
IsSupersetOf({IsTypeAnnotation(qtQuickSourceId,
|
IsSupersetOf({IsTypeAnnotation(qtQuickSourceId,
|
||||||
itemLibraryPathSourceContextId,
|
itemLibraryPathDirectoryPathId,
|
||||||
"Item",
|
"Item",
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
StartsWith(itemLibraryPath),
|
StartsWith(itemLibraryPath),
|
||||||
@@ -4896,7 +4894,7 @@ TEST_F(ProjectStorageUpdater, update_type_annotations)
|
|||||||
_,
|
_,
|
||||||
_),
|
_),
|
||||||
IsTypeAnnotation(qtQuickControlSourceId,
|
IsTypeAnnotation(qtQuickControlSourceId,
|
||||||
itemLibraryPathSourceContextId,
|
itemLibraryPathDirectoryPathId,
|
||||||
"Button",
|
"Button",
|
||||||
qtQuickControlsModuleId,
|
qtQuickControlsModuleId,
|
||||||
StartsWith(itemLibraryPath),
|
StartsWith(itemLibraryPath),
|
||||||
@@ -4927,7 +4925,7 @@ TEST_F(ProjectStorageUpdater, update_added_type_annotation)
|
|||||||
synchronize(AllOf(Field("SynchronizationPackage::typeAnnotations",
|
synchronize(AllOf(Field("SynchronizationPackage::typeAnnotations",
|
||||||
&SynchronizationPackage::typeAnnotations,
|
&SynchronizationPackage::typeAnnotations,
|
||||||
IsSupersetOf({IsTypeAnnotation(qtQuickSourceId,
|
IsSupersetOf({IsTypeAnnotation(qtQuickSourceId,
|
||||||
itemLibraryPathSourceContextId,
|
itemLibraryPathDirectoryPathId,
|
||||||
"Item",
|
"Item",
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
StartsWith(itemLibraryPath),
|
StartsWith(itemLibraryPath),
|
||||||
@@ -4935,7 +4933,7 @@ TEST_F(ProjectStorageUpdater, update_added_type_annotation)
|
|||||||
_,
|
_,
|
||||||
_),
|
_),
|
||||||
IsTypeAnnotation(qtQuickControlSourceId,
|
IsTypeAnnotation(qtQuickControlSourceId,
|
||||||
itemLibraryPathSourceContextId,
|
itemLibraryPathDirectoryPathId,
|
||||||
"Button",
|
"Button",
|
||||||
qtQuickControlsModuleId,
|
qtQuickControlsModuleId,
|
||||||
StartsWith(itemLibraryPath),
|
StartsWith(itemLibraryPath),
|
||||||
@@ -4966,7 +4964,7 @@ TEST_F(ProjectStorageUpdater, update_changed_type_annotation)
|
|||||||
synchronize(AllOf(Field("SynchronizationPackage::typeAnnotations",
|
synchronize(AllOf(Field("SynchronizationPackage::typeAnnotations",
|
||||||
&SynchronizationPackage::typeAnnotations,
|
&SynchronizationPackage::typeAnnotations,
|
||||||
IsSupersetOf({IsTypeAnnotation(qtQuickSourceId,
|
IsSupersetOf({IsTypeAnnotation(qtQuickSourceId,
|
||||||
itemLibraryPathSourceContextId,
|
itemLibraryPathDirectoryPathId,
|
||||||
"Item",
|
"Item",
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
StartsWith(itemLibraryPath),
|
StartsWith(itemLibraryPath),
|
||||||
@@ -4974,7 +4972,7 @@ TEST_F(ProjectStorageUpdater, update_changed_type_annotation)
|
|||||||
_,
|
_,
|
||||||
_),
|
_),
|
||||||
IsTypeAnnotation(qtQuickControlSourceId,
|
IsTypeAnnotation(qtQuickControlSourceId,
|
||||||
itemLibraryPathSourceContextId,
|
itemLibraryPathDirectoryPathId,
|
||||||
"Button",
|
"Button",
|
||||||
qtQuickControlsModuleId,
|
qtQuickControlsModuleId,
|
||||||
StartsWith(itemLibraryPath),
|
StartsWith(itemLibraryPath),
|
||||||
@@ -5020,8 +5018,8 @@ TEST_F(ProjectStorageUpdater, update_type_annotations_removed_meta_info_file)
|
|||||||
auto qtQuickControlSourceId = sourcePathCache.sourceId(
|
auto qtQuickControlSourceId = sourcePathCache.sourceId(
|
||||||
QmlDesigner::SourcePath{itemLibraryPath + "/qtquickcontrols2.metainfo"});
|
QmlDesigner::SourcePath{itemLibraryPath + "/qtquickcontrols2.metainfo"});
|
||||||
ON_CALL(projectStorageMock, typeAnnotationDirectoryIds())
|
ON_CALL(projectStorageMock, typeAnnotationDirectoryIds())
|
||||||
.WillByDefault(Return(QmlDesigner::SmallSourceContextIds<64>{itemLibraryPathSourceContextId}));
|
.WillByDefault(Return(QmlDesigner::SmallDirectoryPathIds<64>{itemLibraryPathDirectoryPathId}));
|
||||||
ON_CALL(projectStorageMock, typeAnnotationSourceIds(itemLibraryPathSourceContextId))
|
ON_CALL(projectStorageMock, typeAnnotationSourceIds(itemLibraryPathDirectoryPathId))
|
||||||
.WillByDefault(Return(QmlDesigner::SmallSourceIds<4>{qtQuickSourceId, qtQuickControlSourceId}));
|
.WillByDefault(Return(QmlDesigner::SmallSourceIds<4>{qtQuickSourceId, qtQuickControlSourceId}));
|
||||||
setFilesChanged({itemLibraryPathSourceId});
|
setFilesChanged({itemLibraryPathSourceId});
|
||||||
setFilesRemoved({qtQuickSourceId});
|
setFilesRemoved({qtQuickSourceId});
|
||||||
@@ -5052,10 +5050,10 @@ TEST_F(ProjectStorageUpdater, update_type_annotations_removed_directory)
|
|||||||
auto qtQuickControlSourceId = sourcePathCache.sourceId(
|
auto qtQuickControlSourceId = sourcePathCache.sourceId(
|
||||||
QmlDesigner::SourcePath{itemLibraryPath + "/qtquickcontrols2.metainfo"});
|
QmlDesigner::SourcePath{itemLibraryPath + "/qtquickcontrols2.metainfo"});
|
||||||
ON_CALL(projectStorageMock, typeAnnotationDirectoryIds())
|
ON_CALL(projectStorageMock, typeAnnotationDirectoryIds())
|
||||||
.WillByDefault(Return(QmlDesigner::SmallSourceContextIds<64>{
|
.WillByDefault(Return(QmlDesigner::SmallDirectoryPathIds<64>{
|
||||||
itemLibraryPathSourceContextId,
|
itemLibraryPathDirectoryPathId,
|
||||||
}));
|
}));
|
||||||
ON_CALL(projectStorageMock, typeAnnotationSourceIds(itemLibraryPathSourceContextId))
|
ON_CALL(projectStorageMock, typeAnnotationSourceIds(itemLibraryPathDirectoryPathId))
|
||||||
.WillByDefault(Return(QmlDesigner::SmallSourceIds<4>{qtQuickSourceId, qtQuickControlSourceId}));
|
.WillByDefault(Return(QmlDesigner::SmallSourceIds<4>{qtQuickSourceId, qtQuickControlSourceId}));
|
||||||
setFilesRemoved({itemLibraryPathSourceId, qtQuickSourceId, qtQuickControlSourceId});
|
setFilesRemoved({itemLibraryPathSourceId, qtQuickSourceId, qtQuickControlSourceId});
|
||||||
|
|
||||||
@@ -5073,8 +5071,8 @@ TEST_F(ProjectStorageUpdater, update_type_annotations_removed_directory)
|
|||||||
TEST_F(ProjectStorageUpdater, synchronize_added_property_editor_qml_paths_directory)
|
TEST_F(ProjectStorageUpdater, synchronize_added_property_editor_qml_paths_directory)
|
||||||
{
|
{
|
||||||
setFileSystemSubdirectories(u"/path/one", {"/path/one/designer"});
|
setFileSystemSubdirectories(u"/path/one", {"/path/one/designer"});
|
||||||
SourceContextId designer1DirectoryId = sourcePathCache.sourceContextId("/path/one/designer");
|
DirectoryPathId designer1DirectoryId = sourcePathCache.directoryPathId("/path/one/designer");
|
||||||
SourceId designer1SourceId = SourceId::create(QmlDesigner::SourceNameId{}, designer1DirectoryId);
|
SourceId designer1SourceId = SourceId::create(QmlDesigner::FileNameId{}, designer1DirectoryId);
|
||||||
setFilesUnchanged({path1SourceId});
|
setFilesUnchanged({path1SourceId});
|
||||||
setFilesAdded({designer1SourceId});
|
setFilesAdded({designer1SourceId});
|
||||||
|
|
||||||
@@ -5099,7 +5097,7 @@ TEST_F(ProjectStorageUpdater, synchronize_added_property_editor_qml_paths_direct
|
|||||||
IsEmpty()),
|
IsEmpty()),
|
||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(path1SourceContextId)))));
|
UnorderedElementsAre(path1DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.projectDirectory = "/path/one"});
|
updater.update({.projectDirectory = "/path/one"});
|
||||||
}
|
}
|
||||||
@@ -5107,8 +5105,8 @@ TEST_F(ProjectStorageUpdater, synchronize_added_property_editor_qml_paths_direct
|
|||||||
TEST_F(ProjectStorageUpdater, synchronize_changed_property_editor_qml_paths_directory)
|
TEST_F(ProjectStorageUpdater, synchronize_changed_property_editor_qml_paths_directory)
|
||||||
{
|
{
|
||||||
setFileSystemSubdirectories(u"/path/one", {"/path/one/designer"});
|
setFileSystemSubdirectories(u"/path/one", {"/path/one/designer"});
|
||||||
SourceContextId designer1DirectoryId = sourcePathCache.sourceContextId("/path/one/designer");
|
DirectoryPathId designer1DirectoryId = sourcePathCache.directoryPathId("/path/one/designer");
|
||||||
SourceId designer1SourceId = SourceId::create(QmlDesigner::SourceNameId{}, designer1DirectoryId);
|
SourceId designer1SourceId = SourceId::create(QmlDesigner::FileNameId{}, designer1DirectoryId);
|
||||||
setFilesUnchanged({path1SourceId});
|
setFilesUnchanged({path1SourceId});
|
||||||
setFilesChanged({designer1SourceId});
|
setFilesChanged({designer1SourceId});
|
||||||
|
|
||||||
@@ -5133,7 +5131,7 @@ TEST_F(ProjectStorageUpdater, synchronize_changed_property_editor_qml_paths_dire
|
|||||||
IsEmpty()),
|
IsEmpty()),
|
||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(path1SourceContextId)))));
|
UnorderedElementsAre(path1DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.projectDirectory = "/path/one"});
|
updater.update({.projectDirectory = "/path/one"});
|
||||||
}
|
}
|
||||||
@@ -5141,8 +5139,8 @@ TEST_F(ProjectStorageUpdater, synchronize_changed_property_editor_qml_paths_dire
|
|||||||
TEST_F(ProjectStorageUpdater, dont_synchronize_empty_property_editor_qml_paths_directory)
|
TEST_F(ProjectStorageUpdater, dont_synchronize_empty_property_editor_qml_paths_directory)
|
||||||
{
|
{
|
||||||
setFileSystemSubdirectories(u"/path/two", {});
|
setFileSystemSubdirectories(u"/path/two", {});
|
||||||
SourceContextId designer2DirectoryId = sourcePathCache.sourceContextId("/path/two/designer");
|
DirectoryPathId designer2DirectoryId = sourcePathCache.directoryPathId("/path/two/designer");
|
||||||
SourceId designer2SourceId = SourceId::create(QmlDesigner::SourceNameId{}, designer2DirectoryId);
|
SourceId designer2SourceId = SourceId::create(QmlDesigner::FileNameId{}, designer2DirectoryId);
|
||||||
setFilesChanged({path2SourceId});
|
setFilesChanged({path2SourceId});
|
||||||
setFilesNotExists({designer2SourceId});
|
setFilesNotExists({designer2SourceId});
|
||||||
|
|
||||||
@@ -5166,15 +5164,15 @@ TEST_F(ProjectStorageUpdater, dont_synchronize_empty_property_editor_qml_paths_d
|
|||||||
IsEmpty()),
|
IsEmpty()),
|
||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(path2SourceContextId)))));
|
UnorderedElementsAre(path2DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.projectDirectory = "/path/two"});
|
updater.update({.projectDirectory = "/path/two"});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorageUpdater, remove_property_editor_qml_paths_if_designer_directory_is_removed)
|
TEST_F(ProjectStorageUpdater, remove_property_editor_qml_paths_if_designer_directory_is_removed)
|
||||||
{
|
{
|
||||||
SourceContextId designer1DirectoryId = sourcePathCache.sourceContextId("/path/one/designer");
|
DirectoryPathId designer1DirectoryId = sourcePathCache.directoryPathId("/path/one/designer");
|
||||||
SourceId designer1SourceId = SourceId::create(QmlDesigner::SourceNameId{}, designer1DirectoryId);
|
SourceId designer1SourceId = SourceId::create(QmlDesigner::FileNameId{}, designer1DirectoryId);
|
||||||
setFilesUnchanged({path1SourceId, qmldir1SourceId});
|
setFilesUnchanged({path1SourceId, qmldir1SourceId});
|
||||||
setFilesRemoved({designer1SourceId});
|
setFilesRemoved({designer1SourceId});
|
||||||
|
|
||||||
@@ -5197,7 +5195,7 @@ TEST_F(ProjectStorageUpdater, remove_property_editor_qml_paths_if_designer_direc
|
|||||||
IsEmpty()),
|
IsEmpty()),
|
||||||
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
Field("SynchronizationPackage::updatedDirectoryInfoDirectoryIds",
|
||||||
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
&SynchronizationPackage::updatedDirectoryInfoDirectoryIds,
|
||||||
UnorderedElementsAre(path1SourceContextId)))));
|
UnorderedElementsAre(path1DirectoryPathId)))));
|
||||||
|
|
||||||
updater.update({.projectDirectory = "/path/one"});
|
updater.update({.projectDirectory = "/path/one"});
|
||||||
}
|
}
|
||||||
@@ -5208,14 +5206,14 @@ TEST_F(ProjectStorageUpdater,
|
|||||||
setFileSystemSubdirectories(u"/path/one", {"/path/one/designer"});
|
setFileSystemSubdirectories(u"/path/one", {"/path/one/designer"});
|
||||||
QString qmldir{R"(module Bar)"};
|
QString qmldir{R"(module Bar)"};
|
||||||
setContent(u"/path/one/qmldir", qmldir);
|
setContent(u"/path/one/qmldir", qmldir);
|
||||||
SourceContextId designer1DirectoryId = sourcePathCache.sourceContextId("/path/one/designer");
|
DirectoryPathId designer1DirectoryId = sourcePathCache.directoryPathId("/path/one/designer");
|
||||||
SourceId propertyEditorSpecificSourceId = sourcePathCache.sourceId(
|
SourceId propertyEditorSpecificSourceId = sourcePathCache.sourceId(
|
||||||
"/path/one/designer/FooSpecifics.qml");
|
"/path/one/designer/FooSpecifics.qml");
|
||||||
SourceId propertyEditorSpecificDynamicSourceId = sourcePathCache.sourceId(
|
SourceId propertyEditorSpecificDynamicSourceId = sourcePathCache.sourceId(
|
||||||
"/path/one/designer/HuoSpecificsDynamic.qml");
|
"/path/one/designer/HuoSpecificsDynamic.qml");
|
||||||
SourceId propertyEditorPaneSourceId = sourcePathCache.sourceId(
|
SourceId propertyEditorPaneSourceId = sourcePathCache.sourceId(
|
||||||
"/path/one/designer/CaoPane.qml");
|
"/path/one/designer/CaoPane.qml");
|
||||||
SourceId designer1SourceId = SourceId::create(QmlDesigner::SourceNameId{}, designer1DirectoryId);
|
SourceId designer1SourceId = SourceId::create(QmlDesigner::FileNameId{}, designer1DirectoryId);
|
||||||
setFilesChanged({designer1SourceId});
|
setFilesChanged({designer1SourceId});
|
||||||
setFilesUnchanged({path1SourceId, qmldir1SourceId});
|
setFilesUnchanged({path1SourceId, qmldir1SourceId});
|
||||||
auto barModuleId = storage.moduleId("Bar", ModuleKind::QmlLibrary);
|
auto barModuleId = storage.moduleId("Bar", ModuleKind::QmlLibrary);
|
||||||
@@ -5252,14 +5250,14 @@ TEST_F(ProjectStorageUpdater,
|
|||||||
setFileSystemSubdirectories(u"/path/one", {"/path/one/designer"});
|
setFileSystemSubdirectories(u"/path/one", {"/path/one/designer"});
|
||||||
QString qmldir{R"(module Bar)"};
|
QString qmldir{R"(module Bar)"};
|
||||||
setContent(u"/path/one/qmldir", qmldir);
|
setContent(u"/path/one/qmldir", qmldir);
|
||||||
SourceContextId designer1DirectoryId = sourcePathCache.sourceContextId("/path/one/designer");
|
DirectoryPathId designer1DirectoryId = sourcePathCache.directoryPathId("/path/one/designer");
|
||||||
SourceId propertyEditorSpecificSourceId = sourcePathCache.sourceId(
|
SourceId propertyEditorSpecificSourceId = sourcePathCache.sourceId(
|
||||||
"/path/one/designer/FooSpecifics.qml");
|
"/path/one/designer/FooSpecifics.qml");
|
||||||
SourceId propertyEditorSpecificDynamicSourceId = sourcePathCache.sourceId(
|
SourceId propertyEditorSpecificDynamicSourceId = sourcePathCache.sourceId(
|
||||||
"/path/one/designer/HuoSpecificsDynamic.qml");
|
"/path/one/designer/HuoSpecificsDynamic.qml");
|
||||||
SourceId propertyEditorPaneSourceId = sourcePathCache.sourceId(
|
SourceId propertyEditorPaneSourceId = sourcePathCache.sourceId(
|
||||||
"/path/one/designer/CaoPane.qml");
|
"/path/one/designer/CaoPane.qml");
|
||||||
SourceId designer1SourceId = SourceId::create(QmlDesigner::SourceNameId{}, designer1DirectoryId);
|
SourceId designer1SourceId = SourceId::create(QmlDesigner::FileNameId{}, designer1DirectoryId);
|
||||||
setFilesChanged({path1SourceId});
|
setFilesChanged({path1SourceId});
|
||||||
setFilesUnchanged({qmldir1SourceId, designer1SourceId});
|
setFilesUnchanged({qmldir1SourceId, designer1SourceId});
|
||||||
auto barModuleId = storage.moduleId("Bar", ModuleKind::QmlLibrary);
|
auto barModuleId = storage.moduleId("Bar", ModuleKind::QmlLibrary);
|
||||||
@@ -5295,14 +5293,14 @@ TEST_F(ProjectStorageUpdater, synchronize_property_editor_qml_paths_directory_if
|
|||||||
setFileSystemSubdirectories(u"/path/one", {"/path/one/designer"});
|
setFileSystemSubdirectories(u"/path/one", {"/path/one/designer"});
|
||||||
QString qmldir{R"(module Bar)"};
|
QString qmldir{R"(module Bar)"};
|
||||||
setContent(u"/path/one/qmldir", qmldir);
|
setContent(u"/path/one/qmldir", qmldir);
|
||||||
SourceContextId designer1DirectoryId = sourcePathCache.sourceContextId("/path/one/designer");
|
DirectoryPathId designer1DirectoryId = sourcePathCache.directoryPathId("/path/one/designer");
|
||||||
SourceId propertyEditorSpecificSourceId = sourcePathCache.sourceId(
|
SourceId propertyEditorSpecificSourceId = sourcePathCache.sourceId(
|
||||||
"/path/one/designer/FooSpecifics.qml");
|
"/path/one/designer/FooSpecifics.qml");
|
||||||
SourceId propertyEditorSpecificDynamicSourceId = sourcePathCache.sourceId(
|
SourceId propertyEditorSpecificDynamicSourceId = sourcePathCache.sourceId(
|
||||||
"/path/one/designer/HuoSpecificsDynamic.qml");
|
"/path/one/designer/HuoSpecificsDynamic.qml");
|
||||||
SourceId propertyEditorPaneSourceId = sourcePathCache.sourceId(
|
SourceId propertyEditorPaneSourceId = sourcePathCache.sourceId(
|
||||||
"/path/one/designer/CaoPane.qml");
|
"/path/one/designer/CaoPane.qml");
|
||||||
SourceId designer1SourceId = SourceId::create(QmlDesigner::SourceNameId{}, designer1DirectoryId);
|
SourceId designer1SourceId = SourceId::create(QmlDesigner::FileNameId{}, designer1DirectoryId);
|
||||||
setFilesChanged({qmldir1SourceId});
|
setFilesChanged({qmldir1SourceId});
|
||||||
setFilesUnchanged({path1SourceId, designer1SourceId});
|
setFilesUnchanged({path1SourceId, designer1SourceId});
|
||||||
auto barModuleId = storage.moduleId("Bar", ModuleKind::QmlLibrary);
|
auto barModuleId = storage.moduleId("Bar", ModuleKind::QmlLibrary);
|
||||||
|
@@ -18,7 +18,7 @@ namespace {
|
|||||||
namespace Storage = QmlDesigner::Storage;
|
namespace Storage = QmlDesigner::Storage;
|
||||||
namespace Synchronization = Storage::Synchronization;
|
namespace Synchronization = Storage::Synchronization;
|
||||||
using QmlDesigner::ModuleId;
|
using QmlDesigner::ModuleId;
|
||||||
using QmlDesigner::SourceContextId;
|
using QmlDesigner::DirectoryPathId;
|
||||||
using QmlDesigner::SourceId;
|
using QmlDesigner::SourceId;
|
||||||
using QmlDesigner::Storage::ModuleKind;
|
using QmlDesigner::Storage::ModuleKind;
|
||||||
using Storage::TypeTraits;
|
using Storage::TypeTraits;
|
||||||
@@ -158,8 +158,8 @@ protected:
|
|||||||
QmlDesigner::QmlDocumentParser parser{storage, sourcePathCache};
|
QmlDesigner::QmlDocumentParser parser{storage, sourcePathCache};
|
||||||
Storage::Imports imports;
|
Storage::Imports imports;
|
||||||
SourceId qmlFileSourceId{sourcePathCache.sourceId("/path/to/qmlfile.qml")};
|
SourceId qmlFileSourceId{sourcePathCache.sourceId("/path/to/qmlfile.qml")};
|
||||||
SourceContextId qmlFileSourceContextId{qmlFileSourceId.contextId()};
|
DirectoryPathId qmlFileDirectoryPathId{qmlFileSourceId.contextId()};
|
||||||
Utils::PathString directoryPath{sourcePathCache.sourceContextPath(qmlFileSourceContextId)};
|
Utils::PathString directoryPath{sourcePathCache.directoryPath(qmlFileDirectoryPathId)};
|
||||||
ModuleId directoryModuleId{storage.moduleId(directoryPath, ModuleKind::PathLibrary)};
|
ModuleId directoryModuleId{storage.moduleId(directoryPath, ModuleKind::PathLibrary)};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ namespace {
|
|||||||
namespace Storage = QmlDesigner::Storage;
|
namespace Storage = QmlDesigner::Storage;
|
||||||
namespace Synchronization = QmlDesigner::Storage::Synchronization;
|
namespace Synchronization = QmlDesigner::Storage::Synchronization;
|
||||||
using QmlDesigner::ModuleId;
|
using QmlDesigner::ModuleId;
|
||||||
using QmlDesigner::SourceContextId;
|
using QmlDesigner::DirectoryPathId;
|
||||||
using QmlDesigner::SourceId;
|
using QmlDesigner::SourceId;
|
||||||
using QmlDesigner::Storage::ModuleKind;
|
using QmlDesigner::Storage::ModuleKind;
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ protected:
|
|||||||
qmltypesFileSourceId,
|
qmltypesFileSourceId,
|
||||||
qtQmlNativeModuleId,
|
qtQmlNativeModuleId,
|
||||||
Synchronization::FileType::QmlTypes};
|
Synchronization::FileType::QmlTypes};
|
||||||
SourceContextId qmltypesFileSourceContextId{qmltypesFileSourceId.contextId()};
|
DirectoryPathId qmltypesFileDirectoryPathId{qmltypesFileSourceId.contextId()};
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(QmlTypesParser, imports)
|
TEST_F(QmlTypesParser, imports)
|
||||||
|
@@ -53,7 +53,7 @@ protected:
|
|||||||
QmlDesigner::ProjectStorage &storage = staticData->storage;
|
QmlDesigner::ProjectStorage &storage = staticData->storage;
|
||||||
QmlDesigner::Storage::TypeAnnotationReader reader{storage};
|
QmlDesigner::Storage::TypeAnnotationReader reader{storage};
|
||||||
QmlDesigner::SourceId sourceId = QmlDesigner::SourceId::create(33);
|
QmlDesigner::SourceId sourceId = QmlDesigner::SourceId::create(33);
|
||||||
QmlDesigner::SourceContextId directoryId = QmlDesigner::SourceContextId::create(77);
|
QmlDesigner::DirectoryPathId directoryId = QmlDesigner::DirectoryPathId::create(77);
|
||||||
QmlDesigner::Storage::TypeTraits traits;
|
QmlDesigner::Storage::TypeTraits traits;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -10,13 +10,13 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using QmlDesigner::SourceContextId;
|
using QmlDesigner::DirectoryPathId;
|
||||||
using QmlDesigner::SourceId;
|
using QmlDesigner::SourceId;
|
||||||
using QmlDesigner::SourceIds;
|
using QmlDesigner::SourceIds;
|
||||||
using QmlDesigner::SourceNameId;
|
using QmlDesigner::FileNameId;
|
||||||
using Cache = QmlDesigner::SourcePathCache<NiceMock<ProjectStorageMock>>;
|
using Cache = QmlDesigner::SourcePathCache<NiceMock<ProjectStorageMock>>;
|
||||||
using NFP = QmlDesigner::SourcePath;
|
using NFP = QmlDesigner::SourcePath;
|
||||||
using QmlDesigner::Cache::SourceName;
|
using QmlDesigner::Cache::FileName;
|
||||||
using QmlDesigner::SourcePathView;
|
using QmlDesigner::SourcePathView;
|
||||||
using QmlDesigner::SourcePathViews;
|
using QmlDesigner::SourcePathViews;
|
||||||
|
|
||||||
@@ -25,48 +25,48 @@ class SourcePathCache : public testing::Test
|
|||||||
protected:
|
protected:
|
||||||
SourcePathCache()
|
SourcePathCache()
|
||||||
{
|
{
|
||||||
ON_CALL(storageMock, fetchSourceContextId(Eq("/path/to"))).WillByDefault(Return(sourceContextId5));
|
ON_CALL(storageMock, fetchDirectoryPathId(Eq("/path/to"))).WillByDefault(Return(directoryPathId5));
|
||||||
ON_CALL(storageMock, fetchSourceContextId(Eq("/path2/to"))).WillByDefault(Return(sourceContextId6));
|
ON_CALL(storageMock, fetchDirectoryPathId(Eq("/path2/to"))).WillByDefault(Return(directoryPathId6));
|
||||||
ON_CALL(storageMock, fetchSourceNameId(Eq("file.cpp"))).WillByDefault(Return(sourceNameId42));
|
ON_CALL(storageMock, fetchFileNameId(Eq("file.cpp"))).WillByDefault(Return(fileNameId42));
|
||||||
ON_CALL(storageMock, fetchSourceNameId(Eq("file2.cpp"))).WillByDefault(Return(sourceNameId63));
|
ON_CALL(storageMock, fetchFileNameId(Eq("file2.cpp"))).WillByDefault(Return(fileNameId63));
|
||||||
ON_CALL(storageMock, fetchSourceContextPath(sourceContextId5))
|
ON_CALL(storageMock, fetchDirectoryPath(directoryPathId5))
|
||||||
.WillByDefault(Return(Utils::PathString("/path/to")));
|
.WillByDefault(Return(Utils::PathString("/path/to")));
|
||||||
ON_CALL(storageMock, fetchSourceName(sourceNameId42)).WillByDefault(Return("file.cpp"));
|
ON_CALL(storageMock, fetchFileName(fileNameId42)).WillByDefault(Return("file.cpp"));
|
||||||
ON_CALL(storageMockFilled, fetchAllSourceNames())
|
ON_CALL(storageMockFilled, fetchAllFileNames())
|
||||||
.WillByDefault(Return(std::vector<QmlDesigner::Cache::SourceName>(
|
.WillByDefault(Return(std::vector<QmlDesigner::Cache::FileName>(
|
||||||
{{"file.cpp", sourceNameId42}, {"file2.cpp", sourceNameId63}})));
|
{{"file.cpp", fileNameId42}, {"file2.cpp", fileNameId63}})));
|
||||||
ON_CALL(storageMockFilled, fetchAllSourceContexts())
|
ON_CALL(storageMockFilled, fetchAllDirectoryPaths())
|
||||||
.WillByDefault(Return(std::vector<QmlDesigner::Cache::SourceContext>(
|
.WillByDefault(Return(std::vector<QmlDesigner::Cache::DirectoryPath>(
|
||||||
{{"/path2/to", sourceContextId6}, {"/path/to", sourceContextId5}})));
|
{{"/path2/to", directoryPathId6}, {"/path/to", directoryPathId5}})));
|
||||||
ON_CALL(storageMockFilled, fetchSourceContextId(Eq("/path/to")))
|
ON_CALL(storageMockFilled, fetchDirectoryPathId(Eq("/path/to")))
|
||||||
.WillByDefault(Return(sourceContextId5));
|
.WillByDefault(Return(directoryPathId5));
|
||||||
ON_CALL(storageMockFilled, fetchSourceNameId(Eq("file.cpp"))).WillByDefault(Return(sourceNameId42));
|
ON_CALL(storageMockFilled, fetchFileNameId(Eq("file.cpp"))).WillByDefault(Return(fileNameId42));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SourceNameId sourceNameId42 = SourceNameId::create(42);
|
FileNameId fileNameId42 = FileNameId::create(42);
|
||||||
SourceNameId sourceNameId63 = SourceNameId::create(63);
|
FileNameId fileNameId63 = FileNameId::create(63);
|
||||||
SourceContextId sourceContextId5 = SourceContextId::create(5);
|
DirectoryPathId directoryPathId5 = DirectoryPathId::create(5);
|
||||||
SourceContextId sourceContextId6 = SourceContextId::create(6);
|
DirectoryPathId directoryPathId6 = DirectoryPathId::create(6);
|
||||||
SourceId sourceId542 = SourceId::create(sourceNameId42, sourceContextId5);
|
SourceId sourceId542 = SourceId::create(fileNameId42, directoryPathId5);
|
||||||
SourceId sourceId563 = SourceId::create(sourceNameId63, sourceContextId5);
|
SourceId sourceId563 = SourceId::create(fileNameId63, directoryPathId5);
|
||||||
SourceId sourceId642 = SourceId::create(sourceNameId42, sourceContextId6);
|
SourceId sourceId642 = SourceId::create(fileNameId42, directoryPathId6);
|
||||||
NiceMock<ProjectStorageMock> storageMock;
|
NiceMock<ProjectStorageMock> storageMock;
|
||||||
Cache cache{storageMock};
|
Cache cache{storageMock};
|
||||||
NiceMock<ProjectStorageMock> storageMockFilled;
|
NiceMock<ProjectStorageMock> storageMockFilled;
|
||||||
Cache cacheNotFilled{storageMockFilled};
|
Cache cacheNotFilled{storageMockFilled};
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_id_with_out_any_entry_call_source_context_id)
|
TEST_F(SourcePathCache, source_id_with_out_any_entry_call_directory_path_id)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(storageMock, fetchSourceContextId(Eq("/path/to")));
|
EXPECT_CALL(storageMock, fetchDirectoryPathId(Eq("/path/to")));
|
||||||
|
|
||||||
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_id_with_out_any_entry_calls)
|
TEST_F(SourcePathCache, source_id_with_out_any_entry_calls)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(storageMock, fetchSourceNameId(Eq("file.cpp")));
|
EXPECT_CALL(storageMock, fetchFileNameId(Eq("file.cpp")));
|
||||||
|
|
||||||
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
||||||
}
|
}
|
||||||
@@ -78,11 +78,11 @@ TEST_F(SourcePathCache, source_id_of_source_id_with_out_any_entry)
|
|||||||
ASSERT_THAT(sourceId, sourceId542);
|
ASSERT_THAT(sourceId, sourceId542);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_id_with_source_context_id_and_source_name)
|
TEST_F(SourcePathCache, source_id_with_directory_path_id_and_file_name)
|
||||||
{
|
{
|
||||||
auto sourceContextId = cache.sourceContextId("/path/to"_sv);
|
auto directoryPathId = cache.directoryPathId("/path/to"_sv);
|
||||||
|
|
||||||
auto sourceId = cache.sourceId(sourceContextId, "file.cpp"_sv);
|
auto sourceId = cache.sourceId(directoryPathId, "file.cpp"_sv);
|
||||||
|
|
||||||
ASSERT_THAT(sourceId, sourceId542);
|
ASSERT_THAT(sourceId, sourceId542);
|
||||||
}
|
}
|
||||||
@@ -91,18 +91,19 @@ TEST_F(SourcePathCache, if_entry_exists_dont_call_in_strorage)
|
|||||||
{
|
{
|
||||||
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
||||||
|
|
||||||
EXPECT_CALL(storageMock, fetchSourceContextId(Eq("/path/to"))).Times(0);
|
EXPECT_CALL(storageMock, fetchDirectoryPathId(Eq("/path/to"))).Times(0);
|
||||||
EXPECT_CALL(storageMock, fetchSourceNameId(Eq("file.cpp"))).Times(0);
|
EXPECT_CALL(storageMock, fetchFileNameId(Eq("file.cpp"))).Times(0);
|
||||||
|
|
||||||
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, if_directory_entry_exists_dont_call_fetch_source_context_id_but_still_call_fetch_source_id)
|
TEST_F(SourcePathCache,
|
||||||
|
if_directory_entry_exists_dont_call_fetch_directory_path_id_but_still_call_fetch_source_id)
|
||||||
{
|
{
|
||||||
cache.sourceId(SourcePathView("/path/to/file2.cpp"));
|
cache.sourceId(SourcePathView("/path/to/file2.cpp"));
|
||||||
|
|
||||||
EXPECT_CALL(storageMock, fetchSourceContextId(Eq("/path/to"))).Times(0);
|
EXPECT_CALL(storageMock, fetchDirectoryPathId(Eq("/path/to"))).Times(0);
|
||||||
EXPECT_CALL(storageMock, fetchSourceNameId(Eq("file.cpp")));
|
EXPECT_CALL(storageMock, fetchFileNameId(Eq("file.cpp")));
|
||||||
|
|
||||||
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
||||||
}
|
}
|
||||||
@@ -116,7 +117,7 @@ TEST_F(SourcePathCache, get_source_id_with_cached_value)
|
|||||||
ASSERT_THAT(sourceId, sourceId542);
|
ASSERT_THAT(sourceId, sourceId542);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, get_source_id_with_source_context_id_cached)
|
TEST_F(SourcePathCache, get_source_id_with_directory_path_id_cached)
|
||||||
{
|
{
|
||||||
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
cache.sourceId(SourcePathView("/path/to/file.cpp"));
|
||||||
|
|
||||||
@@ -166,135 +167,135 @@ TEST_F(SourcePathCache, duplicate_file_paths_are_equal)
|
|||||||
ASSERT_THAT(sourcePath2Id, Eq(sourcePath1Id));
|
ASSERT_THAT(sourcePath2Id, Eq(sourcePath1Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_context_id_calls_fetch_source_context_id)
|
TEST_F(SourcePathCache, directory_path_id_calls_fetch_directory_path_id)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(storageMock, fetchSourceContextId(Eq("/path/to")));
|
EXPECT_CALL(storageMock, fetchDirectoryPathId(Eq("/path/to")));
|
||||||
|
|
||||||
cache.sourceContextId(Utils::SmallString("/path/to"));
|
cache.directoryPathId(Utils::SmallString("/path/to"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, second_source_context_id_calls_not_fetch_source_context_id)
|
TEST_F(SourcePathCache, second_directory_path_id_calls_not_fetch_directory_path_id)
|
||||||
{
|
{
|
||||||
cache.sourceContextId(Utils::SmallString("/path/to"));
|
cache.directoryPathId(Utils::SmallString("/path/to"));
|
||||||
|
|
||||||
EXPECT_CALL(storageMock, fetchSourceContextId(Eq("/path/to"))).Times(0);
|
EXPECT_CALL(storageMock, fetchDirectoryPathId(Eq("/path/to"))).Times(0);
|
||||||
|
|
||||||
cache.sourceContextId(Utils::SmallString("/path/to"));
|
cache.directoryPathId(Utils::SmallString("/path/to"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_context_id_with_trailing_slash)
|
TEST_F(SourcePathCache, directory_path_id_with_trailing_slash)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(storageMock, fetchSourceContextId(Eq("/path/to")));
|
EXPECT_CALL(storageMock, fetchDirectoryPathId(Eq("/path/to")));
|
||||||
|
|
||||||
cache.sourceContextId(Utils::SmallString("/path/to/"));
|
cache.directoryPathId(Utils::SmallString("/path/to/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_context_id)
|
TEST_F(SourcePathCache, directory_path_id)
|
||||||
{
|
{
|
||||||
auto id = cache.sourceContextId(Utils::SmallString("/path/to"));
|
auto id = cache.directoryPathId(Utils::SmallString("/path/to"));
|
||||||
|
|
||||||
ASSERT_THAT(id, Eq(sourceContextId5));
|
ASSERT_THAT(id, Eq(directoryPathId5));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_context_id_is_already_in_cache)
|
TEST_F(SourcePathCache, directory_path_id_is_already_in_cache)
|
||||||
{
|
{
|
||||||
auto firstId = cache.sourceContextId(Utils::SmallString("/path/to"));
|
auto firstId = cache.directoryPathId(Utils::SmallString("/path/to"));
|
||||||
|
|
||||||
auto secondId = cache.sourceContextId(Utils::SmallString("/path/to"));
|
auto secondId = cache.directoryPathId(Utils::SmallString("/path/to"));
|
||||||
|
|
||||||
ASSERT_THAT(secondId, firstId);
|
ASSERT_THAT(secondId, firstId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_context_id_is_already_in_cache_with_trailing_slash)
|
TEST_F(SourcePathCache, directory_path_id_is_already_in_cache_with_trailing_slash)
|
||||||
{
|
{
|
||||||
auto firstId = cache.sourceContextId(Utils::SmallString("/path/to/"));
|
auto firstId = cache.directoryPathId(Utils::SmallString("/path/to/"));
|
||||||
|
|
||||||
auto secondId = cache.sourceContextId(Utils::SmallString("/path/to/"));
|
auto secondId = cache.directoryPathId(Utils::SmallString("/path/to/"));
|
||||||
|
|
||||||
ASSERT_THAT(secondId, firstId);
|
ASSERT_THAT(secondId, firstId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_context_id_is_already_in_cache_with_and_without_trailing_slash)
|
TEST_F(SourcePathCache, directory_path_id_is_already_in_cache_with_and_without_trailing_slash)
|
||||||
{
|
{
|
||||||
auto firstId = cache.sourceContextId(Utils::SmallString("/path/to/"));
|
auto firstId = cache.directoryPathId(Utils::SmallString("/path/to/"));
|
||||||
|
|
||||||
auto secondId = cache.sourceContextId(Utils::SmallString("/path/to"));
|
auto secondId = cache.directoryPathId(Utils::SmallString("/path/to"));
|
||||||
|
|
||||||
ASSERT_THAT(secondId, firstId);
|
ASSERT_THAT(secondId, firstId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_context_id_is_already_in_cache_without_and_with_trailing_slash)
|
TEST_F(SourcePathCache, directory_path_id_is_already_in_cache_without_and_with_trailing_slash)
|
||||||
{
|
{
|
||||||
auto firstId = cache.sourceContextId(Utils::SmallString("/path/to"));
|
auto firstId = cache.directoryPathId(Utils::SmallString("/path/to"));
|
||||||
|
|
||||||
auto secondId = cache.sourceContextId(Utils::SmallString("/path/to/"));
|
auto secondId = cache.directoryPathId(Utils::SmallString("/path/to/"));
|
||||||
|
|
||||||
ASSERT_THAT(secondId, firstId);
|
ASSERT_THAT(secondId, firstId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, throw_for_getting_a_directory_path_with_an_invalid_id)
|
TEST_F(SourcePathCache, throw_for_getting_a_directory_path_with_an_invalid_id)
|
||||||
{
|
{
|
||||||
SourceContextId sourceContextId;
|
DirectoryPathId directoryPathId;
|
||||||
|
|
||||||
ASSERT_THROW(cache.sourceContextPath(sourceContextId),
|
ASSERT_THROW(cache.directoryPath(directoryPathId),
|
||||||
QmlDesigner::NoSourceContextPathForInvalidSourceContextId);
|
QmlDesigner::NoDirectoryPathForInvalidDirectoryPathId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, get_a_directory_path)
|
TEST_F(SourcePathCache, get_a_directory_path)
|
||||||
{
|
{
|
||||||
SourceContextId sourceContextId{sourceContextId5};
|
DirectoryPathId directoryPathId{directoryPathId5};
|
||||||
|
|
||||||
auto sourceContextPath = cache.sourceContextPath(sourceContextId);
|
auto directoryPath = cache.directoryPath(directoryPathId);
|
||||||
|
|
||||||
ASSERT_THAT(sourceContextPath, Eq(Utils::SmallStringView{"/path/to"}));
|
ASSERT_THAT(directoryPath, Eq(Utils::SmallStringView{"/path/to"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, get_a_directory_path_with_cached_source_context_id)
|
TEST_F(SourcePathCache, get_a_directory_path_with_cached_directory_path_id)
|
||||||
{
|
{
|
||||||
SourceContextId sourceContextId{sourceContextId5};
|
DirectoryPathId directoryPathId{directoryPathId5};
|
||||||
cache.sourceContextPath(sourceContextId);
|
cache.directoryPath(directoryPathId);
|
||||||
|
|
||||||
auto sourceContextPath = cache.sourceContextPath(sourceContextId);
|
auto directoryPath = cache.directoryPath(directoryPathId);
|
||||||
|
|
||||||
ASSERT_THAT(sourceContextPath, Eq(Utils::SmallStringView{"/path/to"}));
|
ASSERT_THAT(directoryPath, Eq(Utils::SmallStringView{"/path/to"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, directory_path_calls_fetch_directory_path)
|
TEST_F(SourcePathCache, directory_path_calls_fetch_directory_path)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(storageMock, fetchSourceContextPath(Eq(sourceContextId5)));
|
EXPECT_CALL(storageMock, fetchDirectoryPath(Eq(directoryPathId5)));
|
||||||
|
|
||||||
cache.sourceContextPath(sourceContextId5);
|
cache.directoryPath(directoryPathId5);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, second_directory_path_calls_not_fetch_directory_path)
|
TEST_F(SourcePathCache, second_directory_path_calls_not_fetch_directory_path)
|
||||||
{
|
{
|
||||||
cache.sourceContextPath(sourceContextId5);
|
cache.directoryPath(directoryPathId5);
|
||||||
|
|
||||||
EXPECT_CALL(storageMock, fetchSourceContextPath(_)).Times(0);
|
EXPECT_CALL(storageMock, fetchDirectoryPath(_)).Times(0);
|
||||||
|
|
||||||
cache.sourceContextPath(sourceContextId5);
|
cache.directoryPath(directoryPathId5);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, fetch_source_context_from_source_id)
|
TEST_F(SourcePathCache, fetch_directory_path_from_source_id)
|
||||||
{
|
{
|
||||||
auto sourceContextId = sourceId542.contextId();
|
auto directoryPathId = sourceId542.contextId();
|
||||||
|
|
||||||
ASSERT_THAT(sourceContextId, Eq(sourceContextId5));
|
ASSERT_THAT(directoryPathId, Eq(directoryPathId5));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, fetch_source_context_id_after_fetching_file_path_by_source_id)
|
TEST_F(SourcePathCache, fetch_directory_path_id_after_fetching_file_path_by_source_id)
|
||||||
{
|
{
|
||||||
cache.sourcePath(sourceId542);
|
cache.sourcePath(sourceId542);
|
||||||
|
|
||||||
auto sourceContextId = sourceId542.contextId();
|
auto directoryPathId = sourceId542.contextId();
|
||||||
|
|
||||||
ASSERT_THAT(sourceContextId, Eq(sourceContextId5));
|
ASSERT_THAT(directoryPathId, Eq(directoryPathId5));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, fetch_all_source_contexts_and_sources_at_creation)
|
TEST_F(SourcePathCache, fetch_all_directory_paths_and_sources_at_creation)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(storageMock, fetchAllSourceContexts());
|
EXPECT_CALL(storageMock, fetchAllDirectoryPaths());
|
||||||
EXPECT_CALL(storageMock, fetchAllSourceNames());
|
EXPECT_CALL(storageMock, fetchAllFileNames());
|
||||||
|
|
||||||
Cache cache{storageMock};
|
Cache cache{storageMock};
|
||||||
}
|
}
|
||||||
@@ -308,20 +309,20 @@ TEST_F(SourcePathCache, get_file_id_in_filled_cache)
|
|||||||
ASSERT_THAT(id, Eq(sourceId642));
|
ASSERT_THAT(id, Eq(sourceId642));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, get_source_context_id_in_filled_cache)
|
TEST_F(SourcePathCache, get_directory_path_id_in_filled_cache)
|
||||||
{
|
{
|
||||||
Cache cacheFilled{storageMockFilled};
|
Cache cacheFilled{storageMockFilled};
|
||||||
|
|
||||||
auto id = sourceId542.contextId();
|
auto id = sourceId542.contextId();
|
||||||
|
|
||||||
ASSERT_THAT(id, Eq(sourceContextId5));
|
ASSERT_THAT(id, Eq(directoryPathId5));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, get_directory_path_in_filled_cache)
|
TEST_F(SourcePathCache, get_directory_path_in_filled_cache)
|
||||||
{
|
{
|
||||||
Cache cacheFilled{storageMockFilled};
|
Cache cacheFilled{storageMockFilled};
|
||||||
|
|
||||||
auto path = cacheFilled.sourceContextPath(sourceContextId5);
|
auto path = cacheFilled.directoryPath(directoryPathId5);
|
||||||
|
|
||||||
ASSERT_THAT(path, Eq("/path/to"));
|
ASSERT_THAT(path, Eq("/path/to"));
|
||||||
}
|
}
|
||||||
@@ -348,8 +349,8 @@ TEST_F(SourcePathCache, dont_populate_if_not_empty)
|
|||||||
{
|
{
|
||||||
cacheNotFilled.sourceId("/path/to/file.cpp");
|
cacheNotFilled.sourceId("/path/to/file.cpp");
|
||||||
|
|
||||||
EXPECT_CALL(storageMockFilled, fetchAllSourceContexts()).Times(0);
|
EXPECT_CALL(storageMockFilled, fetchAllDirectoryPaths()).Times(0);
|
||||||
EXPECT_CALL(storageMockFilled, fetchAllSourceNames()).Times(0);
|
EXPECT_CALL(storageMockFilled, fetchAllFileNames()).Times(0);
|
||||||
|
|
||||||
cacheNotFilled.populateIfEmpty();
|
cacheNotFilled.populateIfEmpty();
|
||||||
}
|
}
|
||||||
@@ -358,7 +359,7 @@ TEST_F(SourcePathCache, get_directory_path_after_populate_if_empty)
|
|||||||
{
|
{
|
||||||
cacheNotFilled.populateIfEmpty();
|
cacheNotFilled.populateIfEmpty();
|
||||||
|
|
||||||
auto path = cacheNotFilled.sourceContextPath(sourceContextId5);
|
auto path = cacheNotFilled.directoryPath(directoryPathId5);
|
||||||
|
|
||||||
ASSERT_THAT(path, Eq("/path/to"));
|
ASSERT_THAT(path, Eq("/path/to"));
|
||||||
}
|
}
|
||||||
@@ -372,78 +373,78 @@ TEST_F(SourcePathCache, get_file_path_after_populate_if_empty)
|
|||||||
ASSERT_THAT(path, Eq("/path/to/file.cpp"));
|
ASSERT_THAT(path, Eq("/path/to/file.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_name_id_calls_fetch_source_name_id)
|
TEST_F(SourcePathCache, file_name_id_calls_fetch_file_name_id)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(storageMock, fetchSourceNameId(Eq("file.cpp")));
|
EXPECT_CALL(storageMock, fetchFileNameId(Eq("file.cpp")));
|
||||||
|
|
||||||
cache.sourceNameId(Utils::SmallString("file.cpp"));
|
cache.fileNameId(Utils::SmallString("file.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, second_source_name_id_calls_not_fetch_source_name_id)
|
TEST_F(SourcePathCache, second_file_name_id_calls_not_fetch_file_name_id)
|
||||||
{
|
{
|
||||||
cache.sourceNameId(Utils::SmallString("file.cpp"));
|
cache.fileNameId(Utils::SmallString("file.cpp"));
|
||||||
|
|
||||||
EXPECT_CALL(storageMock, fetchSourceNameId(Eq("file.cpp"))).Times(0);
|
EXPECT_CALL(storageMock, fetchFileNameId(Eq("file.cpp"))).Times(0);
|
||||||
|
|
||||||
cache.sourceNameId(Utils::SmallString("file.cpp"));
|
cache.fileNameId(Utils::SmallString("file.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_name_id)
|
TEST_F(SourcePathCache, file_name_id)
|
||||||
{
|
{
|
||||||
auto id = cache.sourceNameId(Utils::SmallString("file.cpp"));
|
auto id = cache.fileNameId(Utils::SmallString("file.cpp"));
|
||||||
|
|
||||||
ASSERT_THAT(id, Eq(sourceNameId42));
|
ASSERT_THAT(id, Eq(fileNameId42));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_name_id_is_already_in_cache)
|
TEST_F(SourcePathCache, file_name_id_is_already_in_cache)
|
||||||
{
|
{
|
||||||
auto firstId = cache.sourceNameId(Utils::SmallString("file.cpp"));
|
auto firstId = cache.fileNameId(Utils::SmallString("file.cpp"));
|
||||||
|
|
||||||
auto secondId = cache.sourceNameId(Utils::SmallString("file.cpp"));
|
auto secondId = cache.fileNameId(Utils::SmallString("file.cpp"));
|
||||||
|
|
||||||
ASSERT_THAT(secondId, firstId);
|
ASSERT_THAT(secondId, firstId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, throw_for_getting_source_name_with_an_invalid_id)
|
TEST_F(SourcePathCache, throw_for_getting_file_name_with_an_invalid_id)
|
||||||
{
|
{
|
||||||
SourceNameId sourceNameId;
|
FileNameId fileNameId;
|
||||||
|
|
||||||
ASSERT_THROW(cache.sourceName(sourceNameId), QmlDesigner::NoSourceNameForInvalidSourceNameId);
|
ASSERT_THROW(cache.fileName(fileNameId), QmlDesigner::NoFileNameForInvalidFileNameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, get_a_source_name)
|
TEST_F(SourcePathCache, get_a_file_name)
|
||||||
{
|
{
|
||||||
SourceNameId sourceNameId{sourceNameId42};
|
FileNameId fileNameId{fileNameId42};
|
||||||
|
|
||||||
auto sourceName = cache.sourceName(sourceNameId);
|
auto fileName = cache.fileName(fileNameId);
|
||||||
|
|
||||||
ASSERT_THAT(sourceName, Eq(Utils::SmallStringView{"file.cpp"}));
|
ASSERT_THAT(fileName, Eq(Utils::SmallStringView{"file.cpp"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, get_a_source_name_with_cached_source_name_id)
|
TEST_F(SourcePathCache, get_a_file_name_with_cached_file_name_id)
|
||||||
{
|
{
|
||||||
SourceNameId sourceNameId{sourceNameId42};
|
FileNameId fileNameId{fileNameId42};
|
||||||
cache.sourceName(sourceNameId);
|
cache.fileName(fileNameId);
|
||||||
|
|
||||||
auto sourceName = cache.sourceName(sourceNameId);
|
auto fileName = cache.fileName(fileNameId);
|
||||||
|
|
||||||
ASSERT_THAT(sourceName, Eq(Utils::SmallStringView{"file.cpp"}));
|
ASSERT_THAT(fileName, Eq(Utils::SmallStringView{"file.cpp"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, source_name_calls_fetch_source_name)
|
TEST_F(SourcePathCache, file_name_calls_fetch_file_name)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(storageMock, fetchSourceName(Eq(sourceNameId42)));
|
EXPECT_CALL(storageMock, fetchFileName(Eq(fileNameId42)));
|
||||||
|
|
||||||
cache.sourceName(sourceNameId42);
|
cache.fileName(fileNameId42);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathCache, second_source_name_calls_not_fetch_source_name)
|
TEST_F(SourcePathCache, second_file_name_calls_not_fetch_file_name)
|
||||||
{
|
{
|
||||||
cache.sourceName(sourceNameId42);
|
cache.fileName(fileNameId42);
|
||||||
|
|
||||||
EXPECT_CALL(storageMock, fetchSourceName(_)).Times(0);
|
EXPECT_CALL(storageMock, fetchFileName(_)).Times(0);
|
||||||
|
|
||||||
cache.sourceName(sourceNameId42);
|
cache.fileName(fileNameId42);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@@ -7,21 +7,21 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using QmlDesigner::Cache::SourceContext;
|
using QmlDesigner::Cache::DirectoryPath;
|
||||||
using QmlDesigner::Cache::SourceName;
|
using QmlDesigner::Cache::FileName;
|
||||||
using QmlDesigner::SourceContextId;
|
using QmlDesigner::DirectoryPathId;
|
||||||
using QmlDesigner::SourceId;
|
using QmlDesigner::SourceId;
|
||||||
using QmlDesigner::SourceIds;
|
using QmlDesigner::SourceIds;
|
||||||
using QmlDesigner::SourceNameId;
|
using QmlDesigner::FileNameId;
|
||||||
|
|
||||||
MATCHER_P2(IsSourceContext,
|
MATCHER_P2(IsDirectoryPath,
|
||||||
id,
|
id,
|
||||||
value,
|
value,
|
||||||
std::string(negation ? "isn't " : "is ") + PrintToString(SourceContext{value, id}))
|
std::string(negation ? "isn't " : "is ") + PrintToString(DirectoryPath{value, id}))
|
||||||
{
|
{
|
||||||
const SourceContext &sourceContext = arg;
|
const DirectoryPath &directoryPath = arg;
|
||||||
|
|
||||||
return sourceContext.id == id && sourceContext.value == value;
|
return directoryPath.id == id && directoryPath.value == value;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SourcePathStorage : public testing::Test
|
class SourcePathStorage : public testing::Test
|
||||||
@@ -43,14 +43,14 @@ protected:
|
|||||||
|
|
||||||
void addSomeDummyData()
|
void addSomeDummyData()
|
||||||
{
|
{
|
||||||
storage.fetchSourceContextId("/path/dummy");
|
storage.fetchDirectoryPathId("/path/dummy");
|
||||||
storage.fetchSourceContextId("/path/dummy2");
|
storage.fetchDirectoryPathId("/path/dummy2");
|
||||||
storage.fetchSourceContextId("/path/");
|
storage.fetchDirectoryPathId("/path/");
|
||||||
|
|
||||||
storage.fetchSourceNameId("foo");
|
storage.fetchFileNameId("foo");
|
||||||
storage.fetchSourceNameId("dummy");
|
storage.fetchFileNameId("dummy");
|
||||||
storage.fetchSourceNameId("bar");
|
storage.fetchFileNameId("bar");
|
||||||
storage.fetchSourceNameId("bar");
|
storage.fetchFileNameId("bar");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Range>
|
template<typename Range>
|
||||||
@@ -67,112 +67,112 @@ protected:
|
|||||||
Sqlite::Database &database = staticData->database;
|
Sqlite::Database &database = staticData->database;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_source_context_id_returns_always_the_same_id_for_the_same_path)
|
TEST_F(SourcePathStorage, fetch_directory_path_id_returns_always_the_same_id_for_the_same_path)
|
||||||
|
|
||||||
{
|
{
|
||||||
auto sourceContextId = storage.fetchSourceContextId("/path/to");
|
auto directoryPathId = storage.fetchDirectoryPathId("/path/to");
|
||||||
|
|
||||||
auto newSourceContextId = storage.fetchSourceContextId("/path/to");
|
auto newDirectoryPathId = storage.fetchDirectoryPathId("/path/to");
|
||||||
|
|
||||||
ASSERT_THAT(newSourceContextId, Eq(sourceContextId));
|
ASSERT_THAT(newDirectoryPathId, Eq(directoryPathId));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_source_context_id_returns_not_the_same_id_for_different_path)
|
TEST_F(SourcePathStorage, fetch_directory_path_id_returns_not_the_same_id_for_different_path)
|
||||||
{
|
{
|
||||||
auto sourceContextId = storage.fetchSourceContextId("/path/to");
|
auto directoryPathId = storage.fetchDirectoryPathId("/path/to");
|
||||||
|
|
||||||
auto newSourceContextId = storage.fetchSourceContextId("/path/to2");
|
auto newDirectoryPathId = storage.fetchDirectoryPathId("/path/to2");
|
||||||
|
|
||||||
ASSERT_THAT(newSourceContextId, Ne(sourceContextId));
|
ASSERT_THAT(newDirectoryPathId, Ne(directoryPathId));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_source_context_path)
|
TEST_F(SourcePathStorage, fetch_directory_path_path)
|
||||||
{
|
{
|
||||||
auto sourceContextId = storage.fetchSourceContextId("/path/to");
|
auto directoryPathId = storage.fetchDirectoryPathId("/path/to");
|
||||||
|
|
||||||
auto path = storage.fetchSourceContextPath(sourceContextId);
|
auto path = storage.fetchDirectoryPath(directoryPathId);
|
||||||
|
|
||||||
ASSERT_THAT(path, Eq("/path/to"));
|
ASSERT_THAT(path, Eq("/path/to"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_unknown_source_context_path_throws)
|
TEST_F(SourcePathStorage, fetch_unknown_directory_path_path_throws)
|
||||||
{
|
{
|
||||||
ASSERT_THROW(storage.fetchSourceContextPath(SourceContextId::create(323)),
|
ASSERT_THROW(storage.fetchDirectoryPath(DirectoryPathId::create(323)),
|
||||||
QmlDesigner::SourceContextIdDoesNotExists);
|
QmlDesigner::DirectoryPathIdDoesNotExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_all_source_contexts_are_empty_if_no_source_contexts_exists)
|
TEST_F(SourcePathStorage, fetch_all_directory_paths_are_empty_if_no_directory_paths_exists)
|
||||||
{
|
{
|
||||||
storage.clearSources();
|
storage.clearSources();
|
||||||
|
|
||||||
auto sourceContexts = storage.fetchAllSourceContexts();
|
auto directoryPaths = storage.fetchAllDirectoryPaths();
|
||||||
|
|
||||||
ASSERT_THAT(toValues(sourceContexts), IsEmpty());
|
ASSERT_THAT(toValues(directoryPaths), IsEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_all_source_contexts)
|
TEST_F(SourcePathStorage, fetch_all_directory_paths)
|
||||||
{
|
{
|
||||||
storage.clearSources();
|
storage.clearSources();
|
||||||
auto sourceContextId = storage.fetchSourceContextId("/path/to");
|
auto directoryPathId = storage.fetchDirectoryPathId("/path/to");
|
||||||
auto sourceContextId2 = storage.fetchSourceContextId("/path/to2");
|
auto directoryPathId2 = storage.fetchDirectoryPathId("/path/to2");
|
||||||
|
|
||||||
auto sourceContexts = storage.fetchAllSourceContexts();
|
auto directoryPaths = storage.fetchAllDirectoryPaths();
|
||||||
|
|
||||||
ASSERT_THAT(toValues(sourceContexts),
|
ASSERT_THAT(toValues(directoryPaths),
|
||||||
UnorderedElementsAre(IsSourceContext(sourceContextId, "/path/to"),
|
UnorderedElementsAre(IsDirectoryPath(directoryPathId, "/path/to"),
|
||||||
IsSourceContext(sourceContextId2, "/path/to2")));
|
IsDirectoryPath(directoryPathId2, "/path/to2")));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_source_id_first_time)
|
TEST_F(SourcePathStorage, fetch_source_id_first_time)
|
||||||
{
|
{
|
||||||
addSomeDummyData();
|
addSomeDummyData();
|
||||||
|
|
||||||
auto sourceNameId = storage.fetchSourceNameId("foo");
|
auto fileNameId = storage.fetchFileNameId("foo");
|
||||||
|
|
||||||
ASSERT_TRUE(sourceNameId.isValid());
|
ASSERT_TRUE(fileNameId.isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_existing_source_id)
|
TEST_F(SourcePathStorage, fetch_existing_source_id)
|
||||||
{
|
{
|
||||||
addSomeDummyData();
|
addSomeDummyData();
|
||||||
auto createdSourceNameId = storage.fetchSourceNameId("foo");
|
auto createdFileNameId = storage.fetchFileNameId("foo");
|
||||||
|
|
||||||
auto sourceNameId = storage.fetchSourceNameId("foo");
|
auto fileNameId = storage.fetchFileNameId("foo");
|
||||||
|
|
||||||
ASSERT_THAT(sourceNameId, createdSourceNameId);
|
ASSERT_THAT(fileNameId, createdFileNameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_source_id_with_different_name_are_not_equal)
|
TEST_F(SourcePathStorage, fetch_source_id_with_different_name_are_not_equal)
|
||||||
{
|
{
|
||||||
addSomeDummyData();
|
addSomeDummyData();
|
||||||
auto sourceNameId2 = storage.fetchSourceNameId("foo");
|
auto fileNameId2 = storage.fetchFileNameId("foo");
|
||||||
|
|
||||||
auto sourceNameId = storage.fetchSourceNameId("foo2");
|
auto fileNameId = storage.fetchFileNameId("foo2");
|
||||||
|
|
||||||
ASSERT_THAT(sourceNameId, Ne(sourceNameId2));
|
ASSERT_THAT(fileNameId, Ne(fileNameId2));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_source_name_and_source_context_id_for_non_existing_source_id)
|
TEST_F(SourcePathStorage, fetch_file_name_and_directory_path_id_for_non_existing_source_id)
|
||||||
{
|
{
|
||||||
ASSERT_THROW(storage.fetchSourceName(SourceNameId::create(212)),
|
ASSERT_THROW(storage.fetchFileName(FileNameId::create(212)),
|
||||||
QmlDesigner::SourceNameIdDoesNotExists);
|
QmlDesigner::FileNameIdDoesNotExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_source_name_for_non_existing_entry)
|
TEST_F(SourcePathStorage, fetch_file_name_for_non_existing_entry)
|
||||||
{
|
{
|
||||||
addSomeDummyData();
|
addSomeDummyData();
|
||||||
auto sourceNameId = storage.fetchSourceNameId("foo");
|
auto fileNameId = storage.fetchFileNameId("foo");
|
||||||
|
|
||||||
auto sourceName = storage.fetchSourceName(sourceNameId);
|
auto fileName = storage.fetchFileName(fileNameId);
|
||||||
|
|
||||||
ASSERT_THAT(sourceName, Eq("foo"));
|
ASSERT_THAT(fileName, Eq("foo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourcePathStorage, fetch_all_sources)
|
TEST_F(SourcePathStorage, fetch_all_sources)
|
||||||
{
|
{
|
||||||
storage.clearSources();
|
storage.clearSources();
|
||||||
|
|
||||||
auto sources = storage.fetchAllSourceNames();
|
auto sources = storage.fetchAllFileNames();
|
||||||
|
|
||||||
ASSERT_THAT(toValues(sources), IsEmpty());
|
ASSERT_THAT(toValues(sources), IsEmpty());
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ TEST_F(SourcePathStorage, fetch_source_id_unguarded_first_time)
|
|||||||
addSomeDummyData();
|
addSomeDummyData();
|
||||||
std::lock_guard lock{database};
|
std::lock_guard lock{database};
|
||||||
|
|
||||||
auto sourceId = storage.fetchSourceNameIdUnguarded("foo");
|
auto sourceId = storage.fetchFileNameIdUnguarded("foo");
|
||||||
|
|
||||||
ASSERT_TRUE(sourceId.isValid());
|
ASSERT_TRUE(sourceId.isValid());
|
||||||
}
|
}
|
||||||
@@ -191,9 +191,9 @@ TEST_F(SourcePathStorage, fetch_existing_source_id_unguarded)
|
|||||||
{
|
{
|
||||||
addSomeDummyData();
|
addSomeDummyData();
|
||||||
std::lock_guard lock{database};
|
std::lock_guard lock{database};
|
||||||
auto createdSourceId = storage.fetchSourceNameIdUnguarded("foo");
|
auto createdSourceId = storage.fetchFileNameIdUnguarded("foo");
|
||||||
|
|
||||||
auto sourceId = storage.fetchSourceNameIdUnguarded("foo");
|
auto sourceId = storage.fetchFileNameIdUnguarded("foo");
|
||||||
|
|
||||||
ASSERT_THAT(sourceId, createdSourceId);
|
ASSERT_THAT(sourceId, createdSourceId);
|
||||||
}
|
}
|
||||||
@@ -202,9 +202,9 @@ TEST_F(SourcePathStorage, fetch_source_id_unguarded_with_different_name_are_not_
|
|||||||
{
|
{
|
||||||
addSomeDummyData();
|
addSomeDummyData();
|
||||||
std::lock_guard lock{database};
|
std::lock_guard lock{database};
|
||||||
auto sourceId2 = storage.fetchSourceNameIdUnguarded("foo");
|
auto sourceId2 = storage.fetchFileNameIdUnguarded("foo");
|
||||||
|
|
||||||
auto sourceId = storage.fetchSourceNameIdUnguarded("foo2");
|
auto sourceId = storage.fetchFileNameIdUnguarded("foo2");
|
||||||
|
|
||||||
ASSERT_THAT(sourceId, Ne(sourceId2));
|
ASSERT_THAT(sourceId, Ne(sourceId2));
|
||||||
}
|
}
|
||||||
|
@@ -14,18 +14,18 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using QmlDesigner::SourceContextId;
|
using QmlDesigner::DirectoryPathId;
|
||||||
using QmlDesigner::StorageCacheException;
|
using QmlDesigner::StorageCacheException;
|
||||||
using Utils::compare;
|
using Utils::compare;
|
||||||
|
|
||||||
class StorageAdapter
|
class StorageAdapter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
auto fetchId(Utils::SmallStringView view) const { return storage.fetchSourceContextId(view); }
|
auto fetchId(Utils::SmallStringView view) const { return storage.fetchDirectoryPathId(view); }
|
||||||
|
|
||||||
auto fetchValue(SourceContextId id) const { return storage.fetchSourceContextPath(id); }
|
auto fetchValue(DirectoryPathId id) const { return storage.fetchDirectoryPath(id); }
|
||||||
|
|
||||||
auto fetchAll() const { return storage.fetchAllSourceContexts(); }
|
auto fetchAll() const { return storage.fetchAllDirectoryPaths(); }
|
||||||
|
|
||||||
ProjectStorageMock &storage;
|
ProjectStorageMock &storage;
|
||||||
};
|
};
|
||||||
@@ -40,19 +40,19 @@ struct Less
|
|||||||
|
|
||||||
using CacheWithMockLocking = QmlDesigner::StorageCache<Utils::PathString,
|
using CacheWithMockLocking = QmlDesigner::StorageCache<Utils::PathString,
|
||||||
Utils::SmallStringView,
|
Utils::SmallStringView,
|
||||||
SourceContextId,
|
DirectoryPathId,
|
||||||
StorageAdapter,
|
StorageAdapter,
|
||||||
NiceMock<MockMutex>,
|
NiceMock<MockMutex>,
|
||||||
Less,
|
Less,
|
||||||
QmlDesigner::Cache::SourceContext>;
|
QmlDesigner::Cache::DirectoryPath>;
|
||||||
|
|
||||||
using CacheWithoutLocking = QmlDesigner::StorageCache<Utils::PathString,
|
using CacheWithoutLocking = QmlDesigner::StorageCache<Utils::PathString,
|
||||||
Utils::SmallStringView,
|
Utils::SmallStringView,
|
||||||
SourceContextId,
|
DirectoryPathId,
|
||||||
StorageAdapter,
|
StorageAdapter,
|
||||||
NiceMock<MockMutexNonLocking>,
|
NiceMock<MockMutexNonLocking>,
|
||||||
Less,
|
Less,
|
||||||
QmlDesigner::Cache::SourceContext>;
|
QmlDesigner::Cache::DirectoryPath>;
|
||||||
|
|
||||||
template<typename Cache>
|
template<typename Cache>
|
||||||
class StorageCache : public testing::Test
|
class StorageCache : public testing::Test
|
||||||
@@ -67,17 +67,17 @@ protected:
|
|||||||
return std::lexicographical_compare(f.rbegin(), f.rend(), l.rbegin(), l.rend());
|
return std::lexicographical_compare(f.rbegin(), f.rend(), l.rbegin(), l.rend());
|
||||||
});
|
});
|
||||||
|
|
||||||
ON_CALL(this->mockStorage, fetchSourceContextId(Eq("foo"))).WillByDefault(Return(id42));
|
ON_CALL(this->mockStorage, fetchDirectoryPathId(Eq("foo"))).WillByDefault(Return(id42));
|
||||||
ON_CALL(this->mockStorage, fetchSourceContextId(Eq("bar"))).WillByDefault(Return(id43));
|
ON_CALL(this->mockStorage, fetchDirectoryPathId(Eq("bar"))).WillByDefault(Return(id43));
|
||||||
ON_CALL(this->mockStorage, fetchSourceContextId(Eq("poo"))).WillByDefault(Return(id44));
|
ON_CALL(this->mockStorage, fetchDirectoryPathId(Eq("poo"))).WillByDefault(Return(id44));
|
||||||
ON_CALL(this->mockStorage, fetchSourceContextId(Eq("taa"))).WillByDefault(Return(id45));
|
ON_CALL(this->mockStorage, fetchDirectoryPathId(Eq("taa"))).WillByDefault(Return(id45));
|
||||||
ON_CALL(this->mockStorage, fetchSourceContextPath(this->id41))
|
ON_CALL(this->mockStorage, fetchDirectoryPath(this->id41))
|
||||||
.WillByDefault(Return(Utils::PathString("bar")));
|
.WillByDefault(Return(Utils::PathString("bar")));
|
||||||
ON_CALL(this->mockStorage, fetchSourceContextId(Eq(filePath1))).WillByDefault(Return(id1));
|
ON_CALL(this->mockStorage, fetchDirectoryPathId(Eq(filePath1))).WillByDefault(Return(id1));
|
||||||
ON_CALL(this->mockStorage, fetchSourceContextId(Eq(filePath2))).WillByDefault(Return(id2));
|
ON_CALL(this->mockStorage, fetchDirectoryPathId(Eq(filePath2))).WillByDefault(Return(id2));
|
||||||
ON_CALL(this->mockStorage, fetchSourceContextId(Eq(filePath3))).WillByDefault(Return(id3));
|
ON_CALL(this->mockStorage, fetchDirectoryPathId(Eq(filePath3))).WillByDefault(Return(id3));
|
||||||
ON_CALL(this->mockStorage, fetchSourceContextId(Eq(filePath4))).WillByDefault(Return(id4));
|
ON_CALL(this->mockStorage, fetchDirectoryPathId(Eq(filePath4))).WillByDefault(Return(id4));
|
||||||
ON_CALL(this->mockStorage, fetchSourceContextId(Eq(filePath5))).WillByDefault(Return(id5));
|
ON_CALL(this->mockStorage, fetchDirectoryPathId(Eq(filePath5))).WillByDefault(Return(id5));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -92,16 +92,16 @@ protected:
|
|||||||
Utils::PathString filePath5{"/file/pathFife"};
|
Utils::PathString filePath5{"/file/pathFife"};
|
||||||
Utils::PathStringVector filePaths{filePath1, filePath2, filePath3, filePath4, filePath5};
|
Utils::PathStringVector filePaths{filePath1, filePath2, filePath3, filePath4, filePath5};
|
||||||
Utils::PathStringVector reverseFilePaths{filePath1, filePath2, filePath3, filePath4, filePath5};
|
Utils::PathStringVector reverseFilePaths{filePath1, filePath2, filePath3, filePath4, filePath5};
|
||||||
SourceContextId id1{SourceContextId::create(1)};
|
DirectoryPathId id1{DirectoryPathId::create(1)};
|
||||||
SourceContextId id2{SourceContextId::create(2)};
|
DirectoryPathId id2{DirectoryPathId::create(2)};
|
||||||
SourceContextId id3{SourceContextId::create(3)};
|
DirectoryPathId id3{DirectoryPathId::create(3)};
|
||||||
SourceContextId id4{SourceContextId::create(4)};
|
DirectoryPathId id4{DirectoryPathId::create(4)};
|
||||||
SourceContextId id5{SourceContextId::create(5)};
|
DirectoryPathId id5{DirectoryPathId::create(5)};
|
||||||
SourceContextId id41{SourceContextId::create(41)};
|
DirectoryPathId id41{DirectoryPathId::create(41)};
|
||||||
SourceContextId id42{SourceContextId::create(42)};
|
DirectoryPathId id42{DirectoryPathId::create(42)};
|
||||||
SourceContextId id43{SourceContextId::create(43)};
|
DirectoryPathId id43{DirectoryPathId::create(43)};
|
||||||
SourceContextId id44{SourceContextId::create(44)};
|
DirectoryPathId id44{DirectoryPathId::create(44)};
|
||||||
SourceContextId id45{SourceContextId::create(45)};
|
DirectoryPathId id45{DirectoryPathId::create(45)};
|
||||||
};
|
};
|
||||||
|
|
||||||
using CacheTypes = ::testing::Types<CacheWithMockLocking, CacheWithoutLocking>;
|
using CacheTypes = ::testing::Types<CacheWithMockLocking, CacheWithoutLocking>;
|
||||||
@@ -220,8 +220,8 @@ TYPED_TEST(StorageCache, is_not_empty_after_populate_with_some_entries)
|
|||||||
typename TypeParam::CacheEntries entries{{this->filePath1, this->id1},
|
typename TypeParam::CacheEntries entries{{this->filePath1, this->id1},
|
||||||
{this->filePath2, this->id4},
|
{this->filePath2, this->id4},
|
||||||
{this->filePath3, this->id3},
|
{this->filePath3, this->id3},
|
||||||
{this->filePath4, SourceContextId::create(5)}};
|
{this->filePath4, DirectoryPathId::create(5)}};
|
||||||
ON_CALL(this->mockStorage, fetchAllSourceContexts()).WillByDefault(Return(entries));
|
ON_CALL(this->mockStorage, fetchAllDirectoryPaths()).WillByDefault(Return(entries));
|
||||||
|
|
||||||
this->cache.uncheckedPopulate();
|
this->cache.uncheckedPopulate();
|
||||||
|
|
||||||
@@ -232,12 +232,12 @@ TYPED_TEST(StorageCache, get_entry_after_populate_with_some_entries)
|
|||||||
{
|
{
|
||||||
typename TypeParam::CacheEntries entries{{this->filePath1, this->id1},
|
typename TypeParam::CacheEntries entries{{this->filePath1, this->id1},
|
||||||
{this->filePath2, this->id2},
|
{this->filePath2, this->id2},
|
||||||
{this->filePath3, SourceContextId::create(7)},
|
{this->filePath3, DirectoryPathId::create(7)},
|
||||||
{this->filePath4, this->id4}};
|
{this->filePath4, this->id4}};
|
||||||
ON_CALL(this->mockStorage, fetchAllSourceContexts()).WillByDefault(Return(entries));
|
ON_CALL(this->mockStorage, fetchAllDirectoryPaths()).WillByDefault(Return(entries));
|
||||||
this->cache.uncheckedPopulate();
|
this->cache.uncheckedPopulate();
|
||||||
|
|
||||||
auto value = this->cache.value(SourceContextId::create(7));
|
auto value = this->cache.value(DirectoryPathId::create(7));
|
||||||
|
|
||||||
ASSERT_THAT(value, this->filePath3);
|
ASSERT_THAT(value, this->filePath3);
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ TYPED_TEST(StorageCache, entries_have_unique_ids)
|
|||||||
{this->filePath2, this->id2},
|
{this->filePath2, this->id2},
|
||||||
{this->filePath3, this->id3},
|
{this->filePath3, this->id3},
|
||||||
{this->filePath4, this->id3}};
|
{this->filePath4, this->id3}};
|
||||||
ON_CALL(this->mockStorage, fetchAllSourceContexts()).WillByDefault(Return(entries));
|
ON_CALL(this->mockStorage, fetchAllDirectoryPaths()).WillByDefault(Return(entries));
|
||||||
|
|
||||||
ASSERT_THROW(this->cache.populate(), StorageCacheException);
|
ASSERT_THROW(this->cache.populate(), StorageCacheException);
|
||||||
}
|
}
|
||||||
@@ -259,7 +259,7 @@ TYPED_TEST(StorageCache, multiple_entries)
|
|||||||
{this->filePath1, this->id2},
|
{this->filePath1, this->id2},
|
||||||
{this->filePath3, this->id3},
|
{this->filePath3, this->id3},
|
||||||
{this->filePath4, this->id4}};
|
{this->filePath4, this->id4}};
|
||||||
ON_CALL(this->mockStorage, fetchAllSourceContexts()).WillByDefault(Return(entries));
|
ON_CALL(this->mockStorage, fetchAllDirectoryPaths()).WillByDefault(Return(entries));
|
||||||
|
|
||||||
ASSERT_THROW(this->cache.populate(), StorageCacheException);
|
ASSERT_THROW(this->cache.populate(), StorageCacheException);
|
||||||
}
|
}
|
||||||
@@ -283,7 +283,7 @@ TYPED_TEST(StorageCache, id_with_storage_function_is_read_and_write_locked_for_u
|
|||||||
EXPECT_CALL(this->mockMutex, lock_shared());
|
EXPECT_CALL(this->mockMutex, lock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, unlock_shared());
|
EXPECT_CALL(this->mockMutex, unlock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, lock());
|
EXPECT_CALL(this->mockMutex, lock());
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextId(Eq("foo")));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPathId(Eq("foo")));
|
||||||
EXPECT_CALL(this->mockMutex, unlock());
|
EXPECT_CALL(this->mockMutex, unlock());
|
||||||
|
|
||||||
this->cache.id("foo");
|
this->cache.id("foo");
|
||||||
@@ -297,7 +297,7 @@ TYPED_TEST(StorageCache, id_with_storage_function_is_read_locked_for_known_entry
|
|||||||
EXPECT_CALL(this->mockMutex, lock_shared());
|
EXPECT_CALL(this->mockMutex, lock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, unlock_shared());
|
EXPECT_CALL(this->mockMutex, unlock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, lock()).Times(0);
|
EXPECT_CALL(this->mockMutex, lock()).Times(0);
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextId(Eq("foo"))).Times(0);
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPathId(Eq("foo"))).Times(0);
|
||||||
EXPECT_CALL(this->mockMutex, unlock()).Times(0);
|
EXPECT_CALL(this->mockMutex, unlock()).Times(0);
|
||||||
|
|
||||||
this->cache.id("foo");
|
this->cache.id("foo");
|
||||||
@@ -358,7 +358,7 @@ TYPED_TEST(StorageCache, value_with_storage_function_is_read_and_write_locked_fo
|
|||||||
EXPECT_CALL(this->mockMutex, lock_shared());
|
EXPECT_CALL(this->mockMutex, lock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, unlock_shared());
|
EXPECT_CALL(this->mockMutex, unlock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, lock());
|
EXPECT_CALL(this->mockMutex, lock());
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextPath(Eq(this->id41)));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPath(Eq(this->id41)));
|
||||||
EXPECT_CALL(this->mockMutex, unlock());
|
EXPECT_CALL(this->mockMutex, unlock());
|
||||||
|
|
||||||
this->cache.value(this->id41);
|
this->cache.value(this->id41);
|
||||||
@@ -372,7 +372,7 @@ TYPED_TEST(StorageCache, value_with_storage_function_is_read_locked_for_known_id
|
|||||||
EXPECT_CALL(this->mockMutex, lock_shared());
|
EXPECT_CALL(this->mockMutex, lock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, unlock_shared());
|
EXPECT_CALL(this->mockMutex, unlock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, lock()).Times(0);
|
EXPECT_CALL(this->mockMutex, lock()).Times(0);
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextPath(Eq(this->id41))).Times(0);
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPath(Eq(this->id41))).Times(0);
|
||||||
EXPECT_CALL(this->mockMutex, unlock()).Times(0);
|
EXPECT_CALL(this->mockMutex, unlock()).Times(0);
|
||||||
|
|
||||||
this->cache.value(this->id41);
|
this->cache.value(this->id41);
|
||||||
@@ -380,7 +380,7 @@ TYPED_TEST(StorageCache, value_with_storage_function_is_read_locked_for_known_id
|
|||||||
|
|
||||||
TYPED_TEST(StorageCache, id_with_storage_function_which_has_no_entry_is_calling_storage_function)
|
TYPED_TEST(StorageCache, id_with_storage_function_which_has_no_entry_is_calling_storage_function)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextId(Eq("foo")));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPathId(Eq("foo")));
|
||||||
|
|
||||||
this->cache.id("foo");
|
this->cache.id("foo");
|
||||||
}
|
}
|
||||||
@@ -389,7 +389,7 @@ TYPED_TEST(StorageCache, id_with_storage_function_which_has_entry_is_not_calling
|
|||||||
{
|
{
|
||||||
this->cache.id("foo");
|
this->cache.id("foo");
|
||||||
|
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextId(Eq("foo"))).Times(0);
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPathId(Eq("foo"))).Times(0);
|
||||||
|
|
||||||
this->cache.id("foo");
|
this->cache.id("foo");
|
||||||
}
|
}
|
||||||
@@ -419,24 +419,24 @@ TYPED_TEST(StorageCache, get_entry_by_index_after_inserting_by_custom_index)
|
|||||||
ASSERT_THAT(value, Eq("foo"));
|
ASSERT_THAT(value, Eq("foo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPED_TEST(StorageCache, call_fetch_source_context_path_for_lower_index)
|
TYPED_TEST(StorageCache, call_fetch_directory_path_path_for_lower_index)
|
||||||
{
|
{
|
||||||
auto index = this->cache.id("foo");
|
auto index = this->cache.id("foo");
|
||||||
SourceContextId lowerIndex{SourceContextId::create(index.internalId() - 1)};
|
DirectoryPathId lowerIndex{DirectoryPathId::create(index.internalId() - 1)};
|
||||||
|
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextPath(Eq(lowerIndex)));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPath(Eq(lowerIndex)));
|
||||||
|
|
||||||
this->cache.value(lowerIndex);
|
this->cache.value(lowerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPED_TEST(StorageCache, call_fetch_source_context_path_for_unknown_index)
|
TYPED_TEST(StorageCache, call_fetch_directory_path_path_for_unknown_index)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextPath(Eq(this->id1)));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPath(Eq(this->id1)));
|
||||||
|
|
||||||
this->cache.value(this->id1);
|
this->cache.value(this->id1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPED_TEST(StorageCache, fetch_source_context_path_for_unknown_index)
|
TYPED_TEST(StorageCache, fetch_directory_path_path_for_unknown_index)
|
||||||
{
|
{
|
||||||
auto value = this->cache.value(this->id41);
|
auto value = this->cache.value(this->id41);
|
||||||
|
|
||||||
@@ -445,9 +445,9 @@ TYPED_TEST(StorageCache, fetch_source_context_path_for_unknown_index)
|
|||||||
|
|
||||||
TYPED_TEST(StorageCache, add_calls)
|
TYPED_TEST(StorageCache, add_calls)
|
||||||
{
|
{
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextId(Eq("foo")));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPathId(Eq("foo")));
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextId(Eq("bar")));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPathId(Eq("bar")));
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextId(Eq("poo")));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPathId(Eq("poo")));
|
||||||
|
|
||||||
this->cache.add({"foo", "bar", "poo"});
|
this->cache.add({"foo", "bar", "poo"});
|
||||||
}
|
}
|
||||||
@@ -456,8 +456,8 @@ TYPED_TEST(StorageCache, add_calls_only_for_new_values)
|
|||||||
{
|
{
|
||||||
this->cache.add({"foo", "poo"});
|
this->cache.add({"foo", "poo"});
|
||||||
|
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextId(Eq("taa")));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPathId(Eq("taa")));
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextId(Eq("bar")));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPathId(Eq("bar")));
|
||||||
|
|
||||||
this->cache.add({"foo", "bar", "poo", "taa"});
|
this->cache.add({"foo", "bar", "poo", "taa"});
|
||||||
}
|
}
|
||||||
@@ -504,12 +504,12 @@ TYPED_TEST(StorageCache, fetch_ids_from_storage_calls)
|
|||||||
EXPECT_CALL(this->mockMutex, lock_shared());
|
EXPECT_CALL(this->mockMutex, lock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, unlock_shared());
|
EXPECT_CALL(this->mockMutex, unlock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, lock());
|
EXPECT_CALL(this->mockMutex, lock());
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextId(Eq("foo")));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPathId(Eq("foo")));
|
||||||
EXPECT_CALL(this->mockMutex, unlock());
|
EXPECT_CALL(this->mockMutex, unlock());
|
||||||
EXPECT_CALL(this->mockMutex, lock_shared());
|
EXPECT_CALL(this->mockMutex, lock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, unlock_shared());
|
EXPECT_CALL(this->mockMutex, unlock_shared());
|
||||||
EXPECT_CALL(this->mockMutex, lock());
|
EXPECT_CALL(this->mockMutex, lock());
|
||||||
EXPECT_CALL(this->mockStorage, fetchSourceContextId(Eq("bar")));
|
EXPECT_CALL(this->mockStorage, fetchDirectoryPathId(Eq("bar")));
|
||||||
EXPECT_CALL(this->mockMutex, unlock());
|
EXPECT_CALL(this->mockMutex, unlock());
|
||||||
|
|
||||||
this->cache.ids({"foo", "bar"});
|
this->cache.ids({"foo", "bar"});
|
||||||
|
Reference in New Issue
Block a user