QmlDesigner: Fix broken tests

There were key conflicts because we do not got all type ids.

Change-Id: Ief90920cb02a0e6478ee89f9b54ed8e3158fb3b6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2021-12-09 17:48:55 +01:00
parent 08cbf13199
commit 6ecd4e76b4

View File

@@ -522,6 +522,13 @@ private:
return selectTypeIdsForSourceIdsStatement.template values<TypeId>(128, toIntegers(sourceIds)); return selectTypeIdsForSourceIdsStatement.template values<TypeId>(128, toIntegers(sourceIds));
} }
void unique(SourceIds &sourceIds)
{
std::sort(sourceIds.begin(), sourceIds.end());
auto newEnd = std::unique(sourceIds.begin(), sourceIds.end());
sourceIds.erase(newEnd, sourceIds.end());
}
void synchronizeTypes(Storage::Types &types, void synchronizeTypes(Storage::Types &types,
TypeIds &updatedTypeIds, TypeIds &updatedTypeIds,
AliasPropertyDeclarations &insertedAliasPropertyDeclarations, AliasPropertyDeclarations &insertedAliasPropertyDeclarations,
@@ -537,8 +544,8 @@ private:
sourceIdsOfTypes.reserve(updatedSourceIds.size()); sourceIdsOfTypes.reserve(updatedSourceIds.size());
SourceIds notUpdatedExportedSourceIds; SourceIds notUpdatedExportedSourceIds;
notUpdatedExportedSourceIds.reserve(updatedSourceIds.size()); notUpdatedExportedSourceIds.reserve(updatedSourceIds.size());
TypeIds exportedTypeIds; SourceIds exportedSourceIds;
exportedTypeIds.reserve(types.size()); exportedSourceIds.reserve(types.size());
for (auto &&type : types) { for (auto &&type : types) {
if (!type.sourceId) if (!type.sourceId)
@@ -548,19 +555,19 @@ private:
sourceIdsOfTypes.push_back(type.sourceId); sourceIdsOfTypes.push_back(type.sourceId);
updatedTypeIds.push_back(typeId); updatedTypeIds.push_back(typeId);
if (type.changeLevel != Storage::ChangeLevel::ExcludeExportedTypes) { if (type.changeLevel != Storage::ChangeLevel::ExcludeExportedTypes) {
exportedTypeIds.push_back(typeId); exportedSourceIds.push_back(type.sourceId);
extractExportedTypes(typeId, type, exportedTypes); extractExportedTypes(typeId, type, exportedTypes);
} }
} }
std::sort(updatedTypeIds.begin(), updatedTypeIds.end()); unique(exportedSourceIds);
SourceIds sourceIdsWithoutType = filterSourceIdsWithoutType(updatedSourceIds, SourceIds sourceIdsWithoutType = filterSourceIdsWithoutType(updatedSourceIds,
sourceIdsOfTypes); sourceIdsOfTypes);
TypeIds notUpdatedTypeIds = fetchTypeIds(sourceIdsWithoutType); exportedSourceIds.insert(exportedSourceIds.end(),
exportedTypeIds.insert(exportedTypeIds.end(), sourceIdsWithoutType.begin(),
notUpdatedTypeIds.begin(), sourceIdsWithoutType.end());
notUpdatedTypeIds.end()); TypeIds exportedTypeIds = fetchTypeIds(exportedSourceIds);
synchronizeExportedTypes(exportedTypeIds, synchronizeExportedTypes(exportedTypeIds,
exportedTypes, exportedTypes,
relinkableAliasPropertyDeclarations, relinkableAliasPropertyDeclarations,