| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | /****************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Copyright (C) 2021 The Qt Company Ltd. | 
					
						
							|  |  |  | ** Contact: https://www.qt.io/licensing/
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** This file is part of Qt Creator. | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Commercial License Usage | 
					
						
							|  |  |  | ** Licensees holding valid commercial Qt licenses may use this file in | 
					
						
							|  |  |  | ** accordance with the commercial license agreement provided with the | 
					
						
							|  |  |  | ** Software or, alternatively, in accordance with the terms contained in | 
					
						
							|  |  |  | ** a written agreement between you and The Qt Company. For licensing terms | 
					
						
							|  |  |  | ** and conditions see https://www.qt.io/terms-conditions. For further
 | 
					
						
							|  |  |  | ** information use the contact form at https://www.qt.io/contact-us.
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** GNU General Public License Usage | 
					
						
							|  |  |  | ** Alternatively, this file may be used under the terms of the GNU | 
					
						
							|  |  |  | ** General Public License version 3 as published by the Free Software | 
					
						
							|  |  |  | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT | 
					
						
							|  |  |  | ** included in the packaging of this file. Please review the following | 
					
						
							|  |  |  | ** information to ensure the GNU General Public License requirements will | 
					
						
							|  |  |  | ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ****************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "googletest.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "sqlitedatabasemock.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <modelnode.h>
 | 
					
						
							| 
									
										
										
										
											2021-05-04 13:27:42 +02:00
										 |  |  | #include <projectstorage/projectstorage.h>
 | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | #include <projectstorage/sourcepathcache.h>
 | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | #include <sqlitedatabase.h>
 | 
					
						
							|  |  |  | #include <sqlitereadstatement.h>
 | 
					
						
							|  |  |  | #include <sqlitewritestatement.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  | using QmlDesigner::FileStatus; | 
					
						
							|  |  |  | using QmlDesigner::FileStatuses; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | using QmlDesigner::ModuleId; | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | using QmlDesigner::PropertyDeclarationId; | 
					
						
							|  |  |  | using QmlDesigner::SourceContextId; | 
					
						
							|  |  |  | using QmlDesigner::SourceId; | 
					
						
							|  |  |  | using QmlDesigner::TypeId; | 
					
						
							| 
									
										
										
										
											2021-05-06 12:26:39 +02:00
										 |  |  | using QmlDesigner::Cache::Source; | 
					
						
							|  |  |  | using QmlDesigner::Cache::SourceContext; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | using QmlDesigner::Storage::TypeAccessSemantics; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Storage = QmlDesigner::Storage; | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | MATCHER_P2(IsSourceContext, | 
					
						
							|  |  |  |            id, | 
					
						
							|  |  |  |            value, | 
					
						
							|  |  |  |            std::string(negation ? "isn't " : "is ") + PrintToString(SourceContext{value, id})) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     const SourceContext &sourceContext = arg; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return sourceContext.id == id && sourceContext.value == value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MATCHER_P2(IsSourceNameAndSourceContextId, | 
					
						
							|  |  |  |            name, | 
					
						
							|  |  |  |            id, | 
					
						
							|  |  |  |            std::string(negation ? "isn't " : "is ") | 
					
						
							| 
									
										
										
										
											2021-05-06 12:26:39 +02:00
										 |  |  |                + PrintToString(QmlDesigner::Cache::SourceNameAndSourceContextId{name, id})) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-05-06 12:26:39 +02:00
										 |  |  |     const QmlDesigner::Cache::SourceNameAndSourceContextId &sourceNameAndSourceContextId = arg; | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return sourceNameAndSourceContextId.sourceName == name | 
					
						
							|  |  |  |            && sourceNameAndSourceContextId.sourceContextId == id; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  | MATCHER_P5(IsStorageType, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |            module, | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |            typeName, | 
					
						
							|  |  |  |            prototype, | 
					
						
							|  |  |  |            accessSemantics, | 
					
						
							|  |  |  |            sourceId, | 
					
						
							|  |  |  |            std::string(negation ? "isn't " : "is ") | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                + PrintToString(Storage::Type{module, typeName, prototype, accessSemantics, sourceId})) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     const Storage::Type &type = arg; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     return type.module == module && type.typeName == typeName | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |            && type.accessSemantics == accessSemantics && type.sourceId == sourceId | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  |            && Storage::TypeName{prototype} == type.prototype; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  | MATCHER_P4(IsStorageTypeWithInvalidSourceId, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |            module, | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  |            typeName, | 
					
						
							|  |  |  |            prototype, | 
					
						
							|  |  |  |            accessSemantics, | 
					
						
							|  |  |  |            std::string(negation ? "isn't " : "is ") | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                + PrintToString(Storage::Type{module, typeName, prototype, accessSemantics, SourceId{}})) | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     const Storage::Type &type = arg; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     return type.module == module && type.typeName == typeName && type.prototype == prototype | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  |            && type.accessSemantics == accessSemantics && !type.sourceId.isValid(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | MATCHER_P(IsExportedType, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |           name, | 
					
						
							|  |  |  |           std::string(negation ? "isn't " : "is ") + PrintToString(Storage::ExportedType{name})) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     const Storage::ExportedType &type = arg; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     return type.name == name; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MATCHER_P3(IsPropertyDeclaration, | 
					
						
							|  |  |  |            name, | 
					
						
							|  |  |  |            typeName, | 
					
						
							|  |  |  |            traits, | 
					
						
							|  |  |  |            std::string(negation ? "isn't " : "is ") | 
					
						
							|  |  |  |                + PrintToString(Storage::PropertyDeclaration{name, typeName, traits})) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     const Storage::PropertyDeclaration &propertyDeclaration = arg; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     return propertyDeclaration.name == name | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  |            && Storage::TypeName{typeName} == propertyDeclaration.typeName | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |            && propertyDeclaration.traits == traits; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | MATCHER_P4(IsPropertyDeclaration, | 
					
						
							|  |  |  |            name, | 
					
						
							|  |  |  |            typeName, | 
					
						
							|  |  |  |            traits, | 
					
						
							|  |  |  |            aliasPropertyName, | 
					
						
							|  |  |  |            std::string(negation ? "isn't " : "is ") | 
					
						
							|  |  |  |                + PrintToString(Storage::PropertyDeclaration(name, typeName, traits, aliasPropertyName))) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     const Storage::PropertyDeclaration &propertyDeclaration = arg; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return propertyDeclaration.name == name | 
					
						
							|  |  |  |            && Utils::visit([&](auto &&v) -> bool { return v.name == typeName.name; }, | 
					
						
							|  |  |  |                            propertyDeclaration.typeName) | 
					
						
							|  |  |  |            && propertyDeclaration.aliasPropertyName == aliasPropertyName | 
					
						
							|  |  |  |            && propertyDeclaration.traits == traits; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | MATCHER_P2(IsModule, | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  |            name, | 
					
						
							|  |  |  |            version, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |            std::string(negation ? "isn't " : "is ") + PrintToString(Storage::Module{name, version})) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     const Storage::Module &module = arg; | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     return module.name == name && module.version == version; | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | MATCHER_P3(IsModuleDependency, | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  |            name, | 
					
						
							|  |  |  |            version, | 
					
						
							|  |  |  |            sourceId, | 
					
						
							|  |  |  |            std::string(negation ? "isn't " : "is ") | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                + PrintToString(Storage::ModuleDependency{name, version, sourceId})) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     const Storage::ModuleDependency &module = arg; | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     return module.name == name && module.version == version && &module.sourceId == &sourceId; | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | class ProjectStorage : public testing::Test | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |     template<typename Range> | 
					
						
							|  |  |  |     static auto toValues(Range &&range) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         using Type = typename std::decay_t<Range>; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return std::vector<typename Type::value_type>{range.begin(), range.end()}; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void addSomeDummyData() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         auto sourceContextId1 = storage.fetchSourceContextId("/path/dummy"); | 
					
						
							|  |  |  |         auto sourceContextId2 = storage.fetchSourceContextId("/path/dummy2"); | 
					
						
							|  |  |  |         auto sourceContextId3 = storage.fetchSourceContextId("/path/"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         storage.fetchSourceId(sourceContextId1, "foo"); | 
					
						
							|  |  |  |         storage.fetchSourceId(sourceContextId1, "dummy"); | 
					
						
							|  |  |  |         storage.fetchSourceId(sourceContextId2, "foo"); | 
					
						
							|  |  |  |         storage.fetchSourceId(sourceContextId2, "bar"); | 
					
						
							|  |  |  |         storage.fetchSourceId(sourceContextId3, "foo"); | 
					
						
							|  |  |  |         storage.fetchSourceId(sourceContextId3, "bar"); | 
					
						
							|  |  |  |         storage.fetchSourceId(sourceContextId1, "bar"); | 
					
						
							|  |  |  |         storage.fetchSourceId(sourceContextId3, "bar"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     auto createTypes() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         setUpModuleDependenciesAndDocuments(); | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |         return Storage::Types{ | 
					
						
							|  |  |  |             Storage::Type{ | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |                 "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                 Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |                 TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                 sourceId1, | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  |                 {Storage::ExportedType{"Item"}}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                 {Storage::PropertyDeclaration{"data", | 
					
						
							|  |  |  |                                               Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                               Storage::PropertyDeclarationTraits::IsList}, | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |                  Storage::PropertyDeclaration{"children", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                               Storage::ExportedType{"Item"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                               Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                   | Storage::PropertyDeclarationTraits::IsReadOnly}}, | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |                 {Storage::FunctionDeclaration{"execute", "", {Storage::ParameterDeclaration{"arg", ""}}}, | 
					
						
							|  |  |  |                  Storage::FunctionDeclaration{ | 
					
						
							|  |  |  |                      "values", | 
					
						
							|  |  |  |                      "Vector3D", | 
					
						
							|  |  |  |                      {Storage::ParameterDeclaration{"arg1", "int"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                       Storage::ParameterDeclaration{"arg2", | 
					
						
							|  |  |  |                                                     "QObject", | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsPointer}, | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |                       Storage::ParameterDeclaration{"arg3", "string"}}}}, | 
					
						
							|  |  |  |                 {Storage::SignalDeclaration{"execute", {Storage::ParameterDeclaration{"arg", ""}}}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                  Storage::SignalDeclaration{ | 
					
						
							|  |  |  |                      "values", | 
					
						
							|  |  |  |                      {Storage::ParameterDeclaration{"arg1", "int"}, | 
					
						
							|  |  |  |                       Storage::ParameterDeclaration{"arg2", | 
					
						
							|  |  |  |                                                     "QObject", | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsPointer}, | 
					
						
							|  |  |  |                       Storage::ParameterDeclaration{"arg3", "string"}}}}, | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |                 {Storage::EnumerationDeclaration{"Enum", | 
					
						
							|  |  |  |                                                  {Storage::EnumeratorDeclaration{"Foo"}, | 
					
						
							|  |  |  |                                                   Storage::EnumeratorDeclaration{"Bar", 32}}}, | 
					
						
							|  |  |  |                  Storage::EnumerationDeclaration{"Type", | 
					
						
							|  |  |  |                                                  {Storage::EnumeratorDeclaration{"Foo"}, | 
					
						
							|  |  |  |                                                   Storage::EnumeratorDeclaration{"Poo", 12}}}}}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |             Storage::Type{Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                           "QObject", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                           Storage::NativeType{}, | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |                           TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                           sourceId2, | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  |                           {Storage::ExportedType{"Object"}, Storage::ExportedType{"Obj"}}}}; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     auto createTypesWithExportedTypeNamesOnly() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         auto types = createTypes(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         types[0].prototype = Storage::ExportedType{"Object"}; | 
					
						
							|  |  |  |         types[0].propertyDeclarations[0].typeName = Storage::ExportedType{"Object"}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return types; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |     auto createTypesWithAliases() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         auto types = createTypes(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         types[1].propertyDeclarations.push_back( | 
					
						
							|  |  |  |             Storage::PropertyDeclaration{"objects", | 
					
						
							|  |  |  |                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                          Storage::PropertyDeclarationTraits::IsList}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                       "QAliasItem", | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |                                       Storage::ExportedType{"Item"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                       TypeAccessSemantics::Reference, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                       sourceId3, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                       {Storage::ExportedType{"AliasItem"}}}); | 
					
						
							|  |  |  |         types.back().propertyDeclarations.push_back( | 
					
						
							|  |  |  |             Storage::PropertyDeclaration{"data", | 
					
						
							|  |  |  |                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                          Storage::PropertyDeclarationTraits::IsList}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |         types.back().propertyDeclarations.push_back( | 
					
						
							|  |  |  |             Storage::PropertyDeclaration{"items", Storage::ExportedType{"Item"}, "children"}); | 
					
						
							|  |  |  |         types.back().propertyDeclarations.push_back( | 
					
						
							|  |  |  |             Storage::PropertyDeclaration{"objects", Storage::ExportedType{"Item"}, "objects"}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         types.push_back( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |             Storage::Type{Storage::Module{"/path/to"}, | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |                           "QObject2", | 
					
						
							|  |  |  |                           Storage::NativeType{}, | 
					
						
							|  |  |  |                           TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                           sourceId4, | 
					
						
							|  |  |  |                           {Storage::ExportedType{"Object2"}, Storage::ExportedType{"Obj2"}}}); | 
					
						
							|  |  |  |         types[3].propertyDeclarations.push_back( | 
					
						
							|  |  |  |             Storage::PropertyDeclaration{"objects", | 
					
						
							|  |  |  |                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                          Storage::PropertyDeclarationTraits::IsList}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return types; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     auto createTypesWithRecursiveAliases() | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |         auto types = createTypesWithAliases(); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |                                       "QAliasItem2", | 
					
						
							|  |  |  |                                       Storage::ExportedType{"Object"}, | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |                                       TypeAccessSemantics::Reference, | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |                                       sourceId5, | 
					
						
							|  |  |  |                                       {Storage::ExportedType{"AliasItem2"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |         types.back().propertyDeclarations.push_back( | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |             Storage::PropertyDeclaration{"objects", Storage::ExportedType{"AliasItem"}, "objects"}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |         return types; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto createTypesWithAliases2() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         auto types = createTypesWithAliases(); | 
					
						
							|  |  |  |         types[2].prototype = Storage::NativeType{"QObject"}; | 
					
						
							|  |  |  |         types[2].propertyDeclarations.erase(std::next(types[2].propertyDeclarations.begin())); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |         return types; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto createModuleDependencies() | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         moduleSourceId1 = sourcePathCache.sourceId(modulePath1); | 
					
						
							|  |  |  |         moduleSourceId2 = sourcePathCache.sourceId(modulePath2); | 
					
						
							|  |  |  |         moduleSourceId3 = sourcePathCache.sourceId(modulePath3); | 
					
						
							|  |  |  |         moduleSourceId5 = sourcePathCache.sourceId("/path/to/."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return Storage::ModuleDependencies{ | 
					
						
							|  |  |  |             Storage::ModuleDependency{"Qml", Storage::VersionNumber{2}, moduleSourceId1, {}}, | 
					
						
							|  |  |  |             Storage::ModuleDependency{"QtQuick", | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  |                                       Storage::VersionNumber{}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                       moduleSourceId2, | 
					
						
							|  |  |  |                                       {Storage::Module{"Qml", Storage::VersionNumber{2}}}}, | 
					
						
							|  |  |  |             Storage::ModuleDependency{"/path/to", | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  |                                       Storage::VersionNumber{}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                       moduleSourceId5, | 
					
						
							|  |  |  |                                       {Storage::Module{"QtQuick"}, | 
					
						
							|  |  |  |                                        Storage::Module{"Qml", Storage::VersionNumber{2}}}}}; | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::Modules createModules() | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         return Storage::Modules{Storage::Module{"Qml", Storage::VersionNumber{2}}, | 
					
						
							|  |  |  |                                 Storage::Module{"QtQuick", Storage::VersionNumber{}}, | 
					
						
							|  |  |  |                                 Storage::Module{"/path/to", Storage::VersionNumber{}}}; | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto createModuleDependencies2() | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         moduleSourceId4 = sourcePathCache.sourceId(modulePath4); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         auto newModuleDependencies = createModuleDependencies(); | 
					
						
							|  |  |  |         newModuleDependencies.push_back( | 
					
						
							|  |  |  |             Storage::ModuleDependency{"Qml2", Storage::VersionNumber{3}, moduleSourceId4, {}}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         return newModuleDependencies; | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     void setUpSourceIds() | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  |         sourceId1 = sourcePathCache.sourceId(path1); | 
					
						
							|  |  |  |         sourceId2 = sourcePathCache.sourceId(path2); | 
					
						
							|  |  |  |         sourceId3 = sourcePathCache.sourceId(path3); | 
					
						
							|  |  |  |         sourceId4 = sourcePathCache.sourceId(path4); | 
					
						
							|  |  |  |         sourceId5 = sourcePathCache.sourceId(path5); | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     void setUpModuleDependenciesAndDocuments() | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         setUpModules(); | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |         setUpSourceIds(); | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         moduleDependencies = createModuleDependencies(); | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         documents = {Storage::Document{sourceId1, modules}, | 
					
						
							|  |  |  |                      Storage::Document{sourceId2, modules}, | 
					
						
							|  |  |  |                      Storage::Document{sourceId3, modules}, | 
					
						
							|  |  |  |                      Storage::Document{sourceId4, modules}, | 
					
						
							|  |  |  |                      Storage::Document{sourceId5, modules}}; | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                             documents, | 
					
						
							|  |  |  |                             {}, | 
					
						
							|  |  |  |                             {sourceId1, | 
					
						
							|  |  |  |                              sourceId2, | 
					
						
							|  |  |  |                              sourceId3, | 
					
						
							|  |  |  |                              sourceId4, | 
					
						
							|  |  |  |                              sourceId5, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                              moduleSourceId1, | 
					
						
							|  |  |  |                              moduleSourceId2, | 
					
						
							|  |  |  |                              moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                             {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         moduleIds = storage.fetchModuleIds(modules); | 
					
						
							|  |  |  |         moduleId1 = moduleIds[0]; | 
					
						
							|  |  |  |         moduleId2 = moduleIds[1]; | 
					
						
							|  |  |  |         moduleId3 = moduleIds[2]; | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     void setUpModules() { modules = createModules(); } | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     template<typename Range> | 
					
						
							|  |  |  |     static FileStatuses convert(const Range &range) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return FileStatuses(range.begin(), range.end()); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | protected: | 
					
						
							|  |  |  |     Sqlite::Database database{":memory:", Sqlite::JournalMode::Memory}; | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  |     QmlDesigner::ProjectStorage<Sqlite::Database> storage{database, database.isInitialized()}; | 
					
						
							|  |  |  |     QmlDesigner::SourcePathCache<QmlDesigner::ProjectStorage<Sqlite::Database>> sourcePathCache{ | 
					
						
							|  |  |  |         storage}; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     QmlDesigner::SourcePathView path1{"/path1/to"}; | 
					
						
							|  |  |  |     QmlDesigner::SourcePathView path2{"/path2/to"}; | 
					
						
							|  |  |  |     QmlDesigner::SourcePathView path3{"/path3/to"}; | 
					
						
							|  |  |  |     QmlDesigner::SourcePathView path4{"/path4/to"}; | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     QmlDesigner::SourcePathView path5{"/path5/to"}; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     SourceId sourceId1; | 
					
						
							|  |  |  |     SourceId sourceId2; | 
					
						
							|  |  |  |     SourceId sourceId3; | 
					
						
							|  |  |  |     SourceId sourceId4; | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     SourceId sourceId5; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     QmlDesigner::SourcePathView modulePath1{"/module/path1/to"}; | 
					
						
							|  |  |  |     QmlDesigner::SourcePathView modulePath2{"/module/path2/to"}; | 
					
						
							|  |  |  |     QmlDesigner::SourcePathView modulePath3{"/module/aaaa/to"}; | 
					
						
							|  |  |  |     QmlDesigner::SourcePathView modulePath4{"/module/ooo/to"}; | 
					
						
							|  |  |  |     SourceId moduleSourceId1; | 
					
						
							|  |  |  |     SourceId moduleSourceId2; | 
					
						
							|  |  |  |     SourceId moduleSourceId3; | 
					
						
							|  |  |  |     SourceId moduleSourceId4; | 
					
						
							|  |  |  |     SourceId moduleSourceId5; | 
					
						
							|  |  |  |     Storage::Modules modules; | 
					
						
							|  |  |  |     ModuleId moduleId1; | 
					
						
							|  |  |  |     ModuleId moduleId2; | 
					
						
							|  |  |  |     ModuleId moduleId3; | 
					
						
							|  |  |  |     Storage::ModuleDependencies moduleDependencies; | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  |     Storage::Documents documents; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     QmlDesigner::ModuleIds moduleIds; | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceContextIdReturnsAlwaysTheSameIdForTheSamePath) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto newSourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(newSourceContextId, Eq(sourceContextId)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceContextIdReturnsNotTheSameIdForDifferentPath) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto newSourceContextId = storage.fetchSourceContextId("/path/to2"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(newSourceContextId, Ne(sourceContextId)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceContextPath) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto path = storage.fetchSourceContextPath(sourceContextId); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(path, Eq("/path/to")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchUnknownSourceContextPathThrows) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     ASSERT_THROW(storage.fetchSourceContextPath(SourceContextId{323}), | 
					
						
							|  |  |  |                  QmlDesigner::SourceContextIdDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchAllSourceContextsAreEmptyIfNoSourceContextsExists) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     auto sourceContexts = storage.fetchAllSourceContexts(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(toValues(sourceContexts), IsEmpty()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchAllSourceContexts) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  |     auto sourceContextId2 = storage.fetchSourceContextId("/path/to2"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto sourceContexts = storage.fetchAllSourceContexts(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(toValues(sourceContexts), | 
					
						
							|  |  |  |                 UnorderedElementsAre(IsSourceContext(sourceContextId, "/path/to"), | 
					
						
							|  |  |  |                                      IsSourceContext(sourceContextId2, "/path/to2"))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceIdFirstTime) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     addSomeDummyData(); | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto sourceId = storage.fetchSourceId(sourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_TRUE(sourceId.isValid()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchExistingSourceId) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     addSomeDummyData(); | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  |     auto createdSourceId = storage.fetchSourceId(sourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto sourceId = storage.fetchSourceId(sourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(sourceId, createdSourceId); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceIdWithDifferentContextIdAreNotEqual) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     addSomeDummyData(); | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  |     auto sourceContextId2 = storage.fetchSourceContextId("/path/to2"); | 
					
						
							|  |  |  |     auto sourceId2 = storage.fetchSourceId(sourceContextId2, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto sourceId = storage.fetchSourceId(sourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(sourceId, Ne(sourceId2)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceIdWithDifferentNameAreNotEqual) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     addSomeDummyData(); | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  |     auto sourceId2 = storage.fetchSourceId(sourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto sourceId = storage.fetchSourceId(sourceContextId, "foo2"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(sourceId, Ne(sourceId2)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceIdWithNonExistingSourceContextIdThrows) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     ASSERT_THROW(storage.fetchSourceId(SourceContextId{42}, "foo"), | 
					
						
							|  |  |  |                  Sqlite::ConstraintPreventsModification); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceNameAndSourceContextIdForNonExistingSourceId) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     ASSERT_THROW(storage.fetchSourceNameAndSourceContextId(SourceId{212}), | 
					
						
							|  |  |  |                  QmlDesigner::SourceIdDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceNameAndSourceContextIdForNonExistingEntry) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     addSomeDummyData(); | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  |     auto sourceId = storage.fetchSourceId(sourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto sourceNameAndSourceContextId = storage.fetchSourceNameAndSourceContextId(sourceId); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(sourceNameAndSourceContextId, IsSourceNameAndSourceContextId("foo", sourceContextId)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceContextIdForNonExistingSourceId) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     ASSERT_THROW(storage.fetchSourceContextId(SourceId{212}), QmlDesigner::SourceIdDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceContextIdForExistingSourceId) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     addSomeDummyData(); | 
					
						
							|  |  |  |     auto originalSourceContextId = storage.fetchSourceContextId("/path/to3"); | 
					
						
							|  |  |  |     auto sourceId = storage.fetchSourceId(originalSourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId(sourceId); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(sourceContextId, Eq(originalSourceContextId)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchAllSources) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     auto sources = storage.fetchAllSources(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(toValues(sources), IsEmpty()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceIdUnguardedFirstTime) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     addSomeDummyData(); | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  |     std::lock_guard lock{database}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto sourceId = storage.fetchSourceIdUnguarded(sourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_TRUE(sourceId.isValid()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchExistingSourceIdUnguarded) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     addSomeDummyData(); | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  |     std::lock_guard lock{database}; | 
					
						
							|  |  |  |     auto createdSourceId = storage.fetchSourceIdUnguarded(sourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto sourceId = storage.fetchSourceIdUnguarded(sourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(sourceId, createdSourceId); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceIdUnguardedWithDifferentContextIdAreNotEqual) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     addSomeDummyData(); | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  |     auto sourceContextId2 = storage.fetchSourceContextId("/path/to2"); | 
					
						
							|  |  |  |     std::lock_guard lock{database}; | 
					
						
							|  |  |  |     auto sourceId2 = storage.fetchSourceIdUnguarded(sourceContextId2, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto sourceId = storage.fetchSourceIdUnguarded(sourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(sourceId, Ne(sourceId2)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceIdUnguardedWithDifferentNameAreNotEqual) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     addSomeDummyData(); | 
					
						
							|  |  |  |     auto sourceContextId = storage.fetchSourceContextId("/path/to"); | 
					
						
							|  |  |  |     std::lock_guard lock{database}; | 
					
						
							|  |  |  |     auto sourceId2 = storage.fetchSourceIdUnguarded(sourceContextId, "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto sourceId = storage.fetchSourceIdUnguarded(sourceContextId, "foo2"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(sourceId, Ne(sourceId2)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchSourceIdUnguardedWithNonExistingSourceContextIdThrows) | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     std::lock_guard lock{database}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THROW(storage.fetchSourceIdUnguarded(SourceContextId{42}, "foo"), | 
					
						
							|  |  |  |                  Sqlite::ConstraintPreventsModification); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddsNewTypes) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 UnorderedElementsAre(AllOf(IsStorageType(Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId2), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object"), | 
					
						
							|  |  |  |                                                                       IsExportedType("Obj")))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QQuickItem", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId1), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Item")))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddsNewTypesWithExportedPrototypeName) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[0].prototype = Storage::ExportedType{"Object"}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 UnorderedElementsAre(AllOf(IsStorageType(Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId2), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object"), | 
					
						
							|  |  |  |                                                                       IsExportedType("Obj")))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QQuickItem", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId1), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Item")))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddsNewTypesThrowsWithWrongExportedPrototypeName) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[0].prototype = Storage::ExportedType{"Objec"}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddsNewTypesWithMissingModuleAndExportedPrototypeName) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types.push_back(Storage::Type{Storage::Module{"/path/to"}, | 
					
						
							| 
									
										
										
										
											2021-07-06 15:45:10 +02:00
										 |  |  |                                   "QObject2", | 
					
						
							|  |  |  |                                   Storage::NativeType{}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId4, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object2"}, Storage::ExportedType{"Obj2"}}}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({}, {Storage::Document{sourceId1, {modules[0]}}}, {}, {sourceId1}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-06 15:45:10 +02:00
										 |  |  |     types[1].prototype = Storage::ExportedType{"Object2"}; | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddsNewTypesWithMissingModule) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({}, {Storage::Document{sourceId1, {modules[0]}}}, {}, {sourceId1}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddsNewTypesReverseOrder) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     std::reverse(types.begin(), types.end()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 UnorderedElementsAre(AllOf(IsStorageType(Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId2), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object"), | 
					
						
							|  |  |  |                                                                       IsExportedType("Obj")))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QQuickItem", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId1), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Item")))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesOverwritesTypeAccessSemantics) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].accessSemantics = TypeAccessSemantics::Value; | 
					
						
							|  |  |  |     types[1].accessSemantics = TypeAccessSemantics::Value; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 UnorderedElementsAre(AllOf(IsStorageType(Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Value, | 
					
						
							|  |  |  |                                                          sourceId2), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object"), | 
					
						
							|  |  |  |                                                                       IsExportedType("Obj")))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QQuickItem", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Value, | 
					
						
							|  |  |  |                                                          sourceId1), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Item")))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesOverwritesSources) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].sourceId = sourceId3; | 
					
						
							|  |  |  |     types[1].sourceId = sourceId4; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 UnorderedElementsAre(AllOf(IsStorageType(Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId4), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object"), | 
					
						
							|  |  |  |                                                                       IsExportedType("Obj")))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QQuickItem", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId3), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Item")))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesInsertTypeIntoPrototypeChain) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     types[0].prototype = Storage::NativeType{"QQuickObject"}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                   "QQuickObject", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                   Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId1, | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  |                                   {Storage::ExportedType{"Object"}}}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 UnorderedElementsAre(AllOf(IsStorageType(Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId2), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object"), | 
					
						
							|  |  |  |                                                                       IsExportedType("Obj")))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QQuickObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId1), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object")))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QQuickItem", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QQuickObject"}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId1), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Item")))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddExplicitPrototype) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[0].prototype = Storage::ExplicitExportedType{"Object", Storage::Module{"QtQuick"}}; | 
					
						
							|  |  |  |     types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                   "QQuickObject", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId1, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 UnorderedElementsAre(AllOf(IsStorageType(Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId2), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object"), | 
					
						
							|  |  |  |                                                                       IsExportedType("Obj")))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QQuickObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId1), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object")))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QQuickItem", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QQuickObject"}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId1), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Item")))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesThrowsForMissingPrototype) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     setUpModuleDependenciesAndDocuments(); | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  |     sourceId1 = sourcePathCache.sourceId(path1); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::Types types{Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                        "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                        Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                        TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                        sourceId1, | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  |                                        {Storage::ExportedType{"Item"}}}}; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1}, {}), | 
					
						
							|  |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesThrowsForMissingModule) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     sourceId1 = sourcePathCache.sourceId(path1); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::Types types{Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                        "QQuickItem", | 
					
						
							|  |  |  |                                        Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                        TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                        sourceId1, | 
					
						
							|  |  |  |                                        {Storage::ExportedType{"Item"}}}}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1}, {}), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                  QmlDesigner::ModuleDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, TypeWithInvalidSourceIdThrows) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::Types types{Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                        "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                        Storage::NativeType{""}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                        TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                        SourceId{}, | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  |                                        {Storage::ExportedType{"Item"}}}}; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {}, {}), QmlDesigner::TypeHasInvalidSourceId); | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, DeleteTypeIfSourceIdIsSynchronized) | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |     types.erase(types.begin()); | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 UnorderedElementsAre(AllOf(IsStorageType(Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId2), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object"), | 
					
						
							|  |  |  |                                                                       IsExportedType("Obj")))))); | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, DontDeleteTypeIfSourceIdIsNotSynchronized) | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  |     types.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-31 18:13:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 UnorderedElementsAre(AllOf(IsStorageType(Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId2), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object"), | 
					
						
							|  |  |  |                                                                       IsExportedType("Obj")))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QQuickItem", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId1), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Item")))))); | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, UpdateExportedTypesIfTypeNameChanges) | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |     types[0].typeName = "QQuickItem2"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[0]}, {sourceId1}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 UnorderedElementsAre(AllOf(IsStorageType(Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |                                                          "QObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId2), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object"), | 
					
						
							|  |  |  |                                                                       IsExportedType("Obj")))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |                                                          "QQuickItem2", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId1), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Item")))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, BreakingPrototypeChainByDeletingBaseComponentThrows) | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |     types.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddPropertyDeclarations) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                 Contains( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                         "QQuickItem", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                         TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                         sourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                 UnorderedElementsAre( | 
					
						
							|  |  |  |                                     IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                           Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                           Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                                     IsPropertyDeclaration( | 
					
						
							|  |  |  |                                         "children", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                         Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                             | Storage::PropertyDeclarationTraits::IsReadOnly)))))); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddPropertyDeclarationsWithMissingModuleIdsForNativeTypes) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {Storage::Document{sourceId1, {}}}, {}, {sourceId1}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     types[0].propertyDeclarations.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {}, {}), QmlDesigner::TypeNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddPropertyDeclarationsWithMissingModuleIdsForExportedTypes) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({}, {Storage::Document{sourceId1, {modules[0]}}}, {}, {sourceId1}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExportedType{"Obj"}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {}, {}), QmlDesigner::TypeNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddPropertyDeclarationExplicitType) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"Object", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                   "QtQuick"}}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                   "QQuickObject", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId1, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                 Contains( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                         "QQuickItem", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                         TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                         sourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                 UnorderedElementsAre( | 
					
						
							|  |  |  |                                     IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                           Storage::NativeType{"QQuickObject"}, | 
					
						
							|  |  |  |                                                           Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                                     IsPropertyDeclaration( | 
					
						
							|  |  |  |                                         "children", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                         Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                             | Storage::PropertyDeclarationTraits::IsReadOnly)))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesPropertyDeclarationType) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     types[0].propertyDeclarations[0].typeName = Storage::NativeType{"QQuickItem"}; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                 Contains( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                         "QQuickItem", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                         TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                         sourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                 UnorderedElementsAre( | 
					
						
							|  |  |  |                                     IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                           Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                           Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                                     IsPropertyDeclaration( | 
					
						
							|  |  |  |                                         "children", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                         Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                             | Storage::PropertyDeclarationTraits::IsReadOnly)))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesDeclarationTraits) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |     types[0].propertyDeclarations[0].traits = Storage::PropertyDeclarationTraits::IsPointer; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                 Contains( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                         "QQuickItem", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                         TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                         sourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                 UnorderedElementsAre( | 
					
						
							|  |  |  |                                     IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                           Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                           Storage::PropertyDeclarationTraits::IsPointer), | 
					
						
							|  |  |  |                                     IsPropertyDeclaration( | 
					
						
							|  |  |  |                                         "children", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                         Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                             | Storage::PropertyDeclarationTraits::IsReadOnly)))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesDeclarationTraitsAndType) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |     types[0].propertyDeclarations[0].traits = Storage::PropertyDeclarationTraits::IsPointer; | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     types[0].propertyDeclarations[0].typeName = Storage::NativeType{"QQuickItem"}; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                 Contains( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                         "QQuickItem", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                         TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                         sourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                 UnorderedElementsAre( | 
					
						
							|  |  |  |                                     IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                           Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                           Storage::PropertyDeclarationTraits::IsPointer), | 
					
						
							|  |  |  |                                     IsPropertyDeclaration( | 
					
						
							|  |  |  |                                         "children", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                         Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                             | Storage::PropertyDeclarationTraits::IsReadOnly)))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesRemovesAPropertyDeclaration) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].propertyDeclarations.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::propertyDeclarations, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                      UnorderedElementsAre(IsPropertyDeclaration( | 
					
						
							|  |  |  |                                          "data", | 
					
						
							|  |  |  |                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                          Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddsAPropertyDeclaration) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].propertyDeclarations.push_back( | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |         Storage::PropertyDeclaration{"object", | 
					
						
							|  |  |  |                                      Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                      Storage::PropertyDeclarationTraits::IsPointer}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |     ASSERT_THAT( | 
					
						
							|  |  |  |         storage.fetchTypes(), | 
					
						
							|  |  |  |         Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |             IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                           "QQuickItem", | 
					
						
							|  |  |  |                           Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                           TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                           sourceId1), | 
					
						
							|  |  |  |             Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                   UnorderedElementsAre( | 
					
						
							|  |  |  |                       IsPropertyDeclaration("object", | 
					
						
							|  |  |  |                                             Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                             Storage::PropertyDeclarationTraits::IsPointer), | 
					
						
							|  |  |  |                       IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                             Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                             Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                       IsPropertyDeclaration("children", | 
					
						
							|  |  |  |                                             Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                             Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                 | Storage::PropertyDeclarationTraits::IsReadOnly)))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesRenameAPropertyDeclaration) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].propertyDeclarations[1].name = "objects"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                 Contains( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                         "QQuickItem", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                         TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                         sourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                 UnorderedElementsAre( | 
					
						
							|  |  |  |                                     IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                           Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                           Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                                     IsPropertyDeclaration( | 
					
						
							|  |  |  |                                         "objects", | 
					
						
							|  |  |  |                                         Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                         Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                             | Storage::PropertyDeclarationTraits::IsReadOnly)))))); | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, UsingNonExistingNativePropertyTypeThrows) | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     types[0].propertyDeclarations[0].typeName = Storage::NativeType{"QObject2"}; | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |     types.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, UsingNonExistingExportedPropertyTypeThrows) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExportedType{"QObject2"}; | 
					
						
							|  |  |  |     types.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, UsingNonExistingExplicitExportedPropertyTypeWithWrongNameThrows) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"QObject2", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                   "Qml"}}; | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     types.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, UsingNonExistingExplicitExportedPropertyTypeWithWrongModuleThrows) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"QObject", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                   "QtQuick"}}; | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     types.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, BreakingPropertyDeclarationTypeDependencyByDeletingTypeThrows) | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |     types[0].prototype = Storage::NativeType{}; | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |     types.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddFunctionDeclarations) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::functionDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].functionDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].functionDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesFunctionDeclarationReturnType) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].functionDeclarations[1].returnTypeName = "item"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::functionDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].functionDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].functionDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesFunctionDeclarationName) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].functionDeclarations[1].name = "name"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::functionDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].functionDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].functionDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesFunctionDeclarationPopParameters) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].functionDeclarations[1].parameters.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::functionDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].functionDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].functionDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesFunctionDeclarationAppendParameters) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].functionDeclarations[1].parameters.push_back(Storage::ParameterDeclaration{"arg4", "int"}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::functionDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].functionDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].functionDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesFunctionDeclarationChangeParameterName) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].functionDeclarations[1].parameters[0].name = "other"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::functionDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].functionDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].functionDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesFunctionDeclarationChangeParameterTypeName) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].functionDeclarations[1].parameters[0].name = "long long"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::functionDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].functionDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].functionDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesFunctionDeclarationChangeParameterTraits) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |     types[0].functionDeclarations[1].parameters[0].traits = QmlDesigner::Storage::PropertyDeclarationTraits::IsList; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::functionDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].functionDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].functionDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesRemovesFunctionDeclaration) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].functionDeclarations.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::functionDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].functionDeclarations[0])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddFunctionDeclaration) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].functionDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::FunctionDeclaration{"name", "string", {Storage::ParameterDeclaration{"arg", "int"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::functionDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].functionDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].functionDeclarations[1]), | 
					
						
							|  |  |  |                                                           Eq(types[0].functionDeclarations[2])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddSignalDeclarations) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::signalDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].signalDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].signalDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesSignalDeclarationName) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].signalDeclarations[1].name = "name"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::signalDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].signalDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].signalDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesSignalDeclarationPopParameters) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].signalDeclarations[1].parameters.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::signalDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].signalDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].signalDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesSignalDeclarationAppendParameters) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].signalDeclarations[1].parameters.push_back(Storage::ParameterDeclaration{"arg4", "int"}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::signalDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].signalDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].signalDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesSignalDeclarationChangeParameterName) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].signalDeclarations[1].parameters[0].name = "other"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::signalDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].signalDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].signalDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesSignalDeclarationChangeParameterTypeName) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].signalDeclarations[1].parameters[0].typeName = "long long"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::signalDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].signalDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].signalDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesSignalDeclarationChangeParameterTraits) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |     types[0].signalDeclarations[1].parameters[0].traits = QmlDesigner::Storage::PropertyDeclarationTraits::IsList; | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::signalDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].signalDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].signalDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesRemovesSignalDeclaration) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].signalDeclarations.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::signalDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].signalDeclarations[0])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddSignalDeclaration) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].signalDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::SignalDeclaration{"name", {Storage::ParameterDeclaration{"arg", "int"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::signalDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].signalDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].signalDeclarations[1]), | 
					
						
							|  |  |  |                                                           Eq(types[0].signalDeclarations[2])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddEnumerationDeclarations) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::enumerationDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].enumerationDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].enumerationDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesEnumerationDeclarationName) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].enumerationDeclarations[1].name = "Name"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::enumerationDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].enumerationDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].enumerationDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesEnumerationDeclarationPopEnumeratorDeclaration) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].enumerationDeclarations[1].enumeratorDeclarations.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::enumerationDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].enumerationDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].enumerationDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesEnumerationDeclarationAppendEnumeratorDeclaration) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].enumerationDeclarations[1].enumeratorDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::EnumeratorDeclaration{"Haa", 54}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::enumerationDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].enumerationDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].enumerationDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesEnumerationDeclarationChangeEnumeratorDeclarationName) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].enumerationDeclarations[1].enumeratorDeclarations[0].name = "Hoo"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::enumerationDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].enumerationDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].enumerationDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangesEnumerationDeclarationChangeEnumeratorDeclarationValue) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].enumerationDeclarations[1].enumeratorDeclarations[1].value = 11; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::enumerationDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].enumerationDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].enumerationDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |        SynchronizeTypesChangesEnumerationDeclarationAddThatEnumeratorDeclarationHasValue) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].enumerationDeclarations[1].enumeratorDeclarations[0].value = 11; | 
					
						
							|  |  |  |     types[0].enumerationDeclarations[1].enumeratorDeclarations[0].hasValue = true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::enumerationDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].enumerationDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].enumerationDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |        SynchronizeTypesChangesEnumerationDeclarationRemoveThatEnumeratorDeclarationHasValue) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].enumerationDeclarations[1].enumeratorDeclarations[0].hasValue = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::enumerationDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].enumerationDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].enumerationDeclarations[1])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesRemovesEnumerationDeclaration) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].enumerationDeclarations.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::enumerationDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].enumerationDeclarations[0])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddEnumerationDeclaration) | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  |     types[0].enumerationDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::EnumerationDeclaration{"name", {Storage::EnumeratorDeclaration{"Foo", 98, true}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {}, {}); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::enumerationDeclarations, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(Eq(types[0].enumerationDeclarations[0]), | 
					
						
							|  |  |  |                                                           Eq(types[0].enumerationDeclarations[1]), | 
					
						
							|  |  |  |                                                           Eq(types[0].enumerationDeclarations[2])))))); | 
					
						
							| 
									
										
										
										
											2021-05-06 15:52:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesAddModules) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                     IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                     IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5))); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesAddModulesAgain) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                     IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                     IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5))); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesUpdateToMoreModules) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     moduleDependencies.push_back( | 
					
						
							|  |  |  |         Storage::ModuleDependency{"QtQuick.Foo", Storage::VersionNumber{1}, moduleSourceId3}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId3, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                     IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                     IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5), | 
					
						
							|  |  |  |                     IsModuleDependency("QtQuick.Foo", Storage::VersionNumber{1}, moduleSourceId3))); | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesAddOneMoreModules) | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto newModuleDependency = Storage::ModuleDependency{"QtQuick.Foo", | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                                                          Storage::VersionNumber{1}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                          moduleSourceId3}; | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({newModuleDependency}, {}, {}, {moduleSourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                     IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                     IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5), | 
					
						
							|  |  |  |                     IsModuleDependency("QtQuick.Foo", Storage::VersionNumber{1}, moduleSourceId3))); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesAddSameModuleNameButDifferentVersion) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto moduleSourceIdQml4 = sourcePathCache.sourceId("/path/Qml.4"); | 
					
						
							|  |  |  |     auto moduleSourceIdQml3 = sourcePathCache.sourceId("/path/Qml.3"); | 
					
						
							|  |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     moduleDependencies.push_back( | 
					
						
							|  |  |  |         Storage::ModuleDependency{"Qml", Storage::VersionNumber{4}, moduleSourceIdQml4}); | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto newModuleDependency = Storage::ModuleDependency{"Qml", | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                                                          Storage::VersionNumber{3}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                          moduleSourceIdQml3}; | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({newModuleDependency}, {}, {}, {moduleSourceIdQml4, moduleSourceIdQml3}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                     IsModuleDependency("Qml", Storage::VersionNumber{3}, moduleSourceIdQml3), | 
					
						
							|  |  |  |                     IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                     IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5))); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesRemoveModule) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({}, {}, {}, {moduleSourceId5}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                     IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2))); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesChangeSourceId) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     moduleDependencies[1].sourceId = moduleSourceId3; | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({moduleDependencies[1]}, {}, {}, {moduleSourceId2, moduleSourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                     IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId3), | 
					
						
							|  |  |  |                     IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5))); | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesChangeName) | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     moduleDependencies[0].name = "Qml2"; | 
					
						
							|  |  |  |     moduleDependencies[1].dependencies[0].name = "Qml2"; | 
					
						
							|  |  |  |     moduleDependencies[2].dependencies[1].name = "Qml2"; | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsModuleDependency("Qml2", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                     IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                     IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5))); | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesChangeVersion) | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     moduleDependencies[0].version = Storage::VersionNumber{3}; | 
					
						
							|  |  |  |     moduleDependencies[1].dependencies[0].version = Storage::VersionNumber{3}; | 
					
						
							|  |  |  |     moduleDependencies[2].dependencies[1].version = Storage::VersionNumber{3}; | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsModuleDependency("Qml", Storage::VersionNumber{3}, moduleSourceId1), | 
					
						
							|  |  |  |                     IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                     IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5))); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesAddModuleDependecies) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 ElementsAre(IsModule("Qml", Storage::VersionNumber{2})))), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 UnorderedElementsAre(IsModule("Qml", Storage::VersionNumber{2}), | 
					
						
							|  |  |  |                                                      IsModule("QtQuick", Storage::VersionNumber{})))))); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesAddModuleDependeciesWhichDoesNotExitsThrows) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     moduleDependencies[1].dependencies.push_back(Storage::Module{"QmlBase", Storage::VersionNumber{2}}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                                      {}, | 
					
						
							|  |  |  |                                      {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                                      {}), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                  QmlDesigner::ModuleDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesRemovesDependeciesForRemovedModules) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto last = moduleDependencies.back(); | 
					
						
							|  |  |  |     moduleDependencies.pop_back(); | 
					
						
							|  |  |  |     storage.synchronize({}, {}, {}, {moduleSourceId5}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |     last.dependencies.pop_back(); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     moduleDependencies.push_back(last); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({moduleDependencies[2]}, {}, {}, {moduleSourceId5}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 ElementsAre(IsModule("Qml", Storage::VersionNumber{2})))), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 UnorderedElementsAre(IsModule("QtQuick", Storage::VersionNumber{})))))); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeModulesAddMoreModuleDependecies) | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto moduleSourceIdQmlBase = sourcePathCache.sourceId("/path/QmlBase"); | 
					
						
							|  |  |  |     moduleDependencies.push_back( | 
					
						
							|  |  |  |         Storage::ModuleDependency{"QmlBase", Storage::VersionNumber{2}, moduleSourceIdQmlBase}); | 
					
						
							|  |  |  |     moduleDependencies[1].dependencies.push_back(Storage::Module{"QmlBase", Storage::VersionNumber{2}}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({moduleDependencies[1], moduleDependencies[3]}, | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId2, moduleSourceIdQmlBase}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  |         UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |             AllOf(IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                   Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |             AllOf(IsModuleDependency("QmlBase", Storage::VersionNumber{2}, moduleSourceIdQmlBase), | 
					
						
							|  |  |  |                   Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |             AllOf(IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                   Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                         UnorderedElementsAre(IsModule("Qml", Storage::VersionNumber{2}), | 
					
						
							|  |  |  |                                              IsModule("QmlBase", Storage::VersionNumber{2})))), | 
					
						
							|  |  |  |             AllOf(IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5), | 
					
						
							|  |  |  |                   Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                         UnorderedElementsAre(IsModule("Qml", Storage::VersionNumber{2}), | 
					
						
							|  |  |  |                                              IsModule("QtQuick", Storage::VersionNumber{})))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(ProjectStorage, SynchronizeModulesAddMoreModuleDependeciesWithDifferentVersionNumber) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto moduleSourceIdQml3 = sourcePathCache.sourceId("/path/Qml.3"); | 
					
						
							|  |  |  |     moduleDependencies.push_back( | 
					
						
							|  |  |  |         Storage::ModuleDependency{"Qml", Storage::VersionNumber{3}, moduleSourceIdQml3, {}}); | 
					
						
							|  |  |  |     moduleDependencies[1].dependencies.push_back(Storage::Module{"Qml", Storage::VersionNumber{3}}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({moduleDependencies[1], moduleDependencies[3]}, | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId2, moduleSourceIdQml3}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("Qml", Storage::VersionNumber{3}, moduleSourceIdQml3), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 UnorderedElementsAre(IsModule("Qml", Storage::VersionNumber{2}), | 
					
						
							|  |  |  |                                                      IsModule("Qml", Storage::VersionNumber{3})))), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 UnorderedElementsAre(IsModule("Qml", Storage::VersionNumber{2}), | 
					
						
							|  |  |  |                                                      IsModule("QtQuick", Storage::VersionNumber{})))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(ProjectStorage, SynchronizeModulesDependencyGetsHighestVersionIfNoVersionIsSupplied) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto moduleSourceIdQml3 = sourcePathCache.sourceId("/path/Qml.3"); | 
					
						
							|  |  |  |     moduleDependencies.push_back( | 
					
						
							|  |  |  |         Storage::ModuleDependency{"Qml", Storage::VersionNumber{3}, moduleSourceIdQml3, {}}); | 
					
						
							|  |  |  |     moduleDependencies[1].dependencies.push_back(Storage::Module{"Qml"}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({moduleDependencies[1], moduleDependencies[3]}, | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId2, moduleSourceIdQml3}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("Qml", Storage::VersionNumber{3}, moduleSourceIdQml3), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 UnorderedElementsAre(IsModule("Qml", Storage::VersionNumber{2}), | 
					
						
							|  |  |  |                                                      IsModule("Qml", Storage::VersionNumber{3})))), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 UnorderedElementsAre(IsModule("Qml", Storage::VersionNumber{2}), | 
					
						
							|  |  |  |                                                      IsModule("QtQuick", Storage::VersionNumber{})))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(ProjectStorage, SynchronizeModulesDependencyGetsOnlyTheHighestDependency) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto moduleSourceIdQml1 = sourcePathCache.sourceId("/path/Qml.1"); | 
					
						
							|  |  |  |     moduleDependencies.push_back( | 
					
						
							|  |  |  |         Storage::ModuleDependency{"Qml", Storage::VersionNumber{1}, moduleSourceIdQml1, {}}); | 
					
						
							|  |  |  |     moduleDependencies[1].dependencies.push_back(Storage::Module{"Qml"}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({moduleDependencies[1], moduleDependencies[3]}, | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId2, moduleSourceIdQml1}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("Qml", Storage::VersionNumber{1}, moduleSourceIdQml1), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 UnorderedElementsAre(IsModule("Qml", Storage::VersionNumber{2})))), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 UnorderedElementsAre(IsModule("Qml", Storage::VersionNumber{2}), | 
					
						
							|  |  |  |                                                      IsModule("QtQuick", Storage::VersionNumber{})))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(ProjectStorage, SynchronizeModulesDependencyRemoveDuplicateDependencies) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     storage.synchronize(moduleDependencies, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId1, moduleSourceId2, moduleSourceId5}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto moduleSourceIdQml3 = sourcePathCache.sourceId("/path/Qml.3"); | 
					
						
							|  |  |  |     moduleDependencies.push_back( | 
					
						
							|  |  |  |         Storage::ModuleDependency{"Qml", Storage::VersionNumber{3}, moduleSourceIdQml3}); | 
					
						
							|  |  |  |     moduleDependencies[2].dependencies.push_back(Storage::Module{"Qml", Storage::VersionNumber{3}}); | 
					
						
							|  |  |  |     moduleDependencies[2].dependencies.push_back(Storage::Module{"Qml", Storage::VersionNumber{2}}); | 
					
						
							|  |  |  |     moduleDependencies[2].dependencies.push_back(Storage::Module{"Qml", Storage::VersionNumber{3}}); | 
					
						
							|  |  |  |     moduleDependencies[2].dependencies.push_back(Storage::Module{"Qml", Storage::VersionNumber{2}}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     storage.synchronize({moduleDependencies[2], moduleDependencies[3]}, | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         {}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {moduleSourceId5, moduleSourceIdQml3}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchAllModules(), | 
					
						
							| 
									
										
										
										
											2021-07-21 14:53:14 +02:00
										 |  |  |                 UnorderedElementsAre( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     AllOf(IsModuleDependency("Qml", Storage::VersionNumber{2}, moduleSourceId1), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("Qml", Storage::VersionNumber{3}, moduleSourceIdQml3), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, IsEmpty())), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("QtQuick", Storage::VersionNumber{}, moduleSourceId2), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 UnorderedElementsAre(IsModule("Qml", Storage::VersionNumber{2})))), | 
					
						
							|  |  |  |                     AllOf(IsModuleDependency("/path/to", Storage::VersionNumber{}, moduleSourceId5), | 
					
						
							|  |  |  |                           Field(&Storage::ModuleDependency::dependencies, | 
					
						
							|  |  |  |                                 UnorderedElementsAre(IsModule("Qml", Storage::VersionNumber{2}), | 
					
						
							|  |  |  |                                                      IsModule("Qml", Storage::VersionNumber{3}), | 
					
						
							|  |  |  |                                                      IsModule("QtQuick", Storage::VersionNumber{})))))); | 
					
						
							| 
									
										
										
										
											2021-06-01 17:46:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, RemovingModuleRemovesDependentTypesToo) | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     Storage::ModuleDependencies moduleDependencies{createModuleDependencies()}; | 
					
						
							|  |  |  |     moduleDependencies.pop_back(); | 
					
						
							|  |  |  |     moduleDependencies.pop_back(); | 
					
						
							|  |  |  |     storage.synchronize({}, {}, {}, {moduleSourceId2, moduleSourceId5}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 UnorderedElementsAre(AllOf(IsStorageType(Storage::Module{"Qml", 2}, | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  |                                                          "QObject", | 
					
						
							|  |  |  |                                                          Storage::NativeType{}, | 
					
						
							|  |  |  |                                                          TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                          sourceId2), | 
					
						
							|  |  |  |                                            Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                                  UnorderedElementsAre(IsExportedType("Object"), | 
					
						
							|  |  |  |                                                                       IsExportedType("Obj")))))); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchTypeIdByModuleIdAndName) | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto typeId = storage.fetchTypeIdByName(moduleId1, "QObject"); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypeIdByExportedName("Object"), Eq(typeId)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchTypeIdByExportedName) | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     auto typeId = storage.fetchTypeIdByExportedName("Object"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypeIdByName(moduleId1, "QObject"), Eq(typeId)); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchTypeIdByImporIdsAndExportedName) | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto typeId = storage.fetchTypeIdByModuleIdsAndExportedName({moduleId1, moduleId2}, "Object"); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(storage.fetchTypeIdByName(moduleId1, "QObject"), Eq(typeId)); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchInvalidTypeIdByImporIdsAndExportedNameIfModuleIdsAreEmpty) | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto typeId = storage.fetchTypeIdByModuleIdsAndExportedName({}, "Object"); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_FALSE(typeId.isValid()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchInvalidTypeIdByImporIdsAndExportedNameIfModuleIdsAreInvalid) | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto typeId = storage.fetchTypeIdByModuleIdsAndExportedName({ModuleId{}}, "Object"); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_FALSE(typeId.isValid()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchInvalidTypeIdByImporIdsAndExportedNameIfNotInModule) | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto typeId = storage.fetchTypeIdByModuleIdsAndExportedName({moduleId2, moduleId3}, "Object"); | 
					
						
							| 
									
										
										
										
											2021-06-07 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_FALSE(typeId.isValid()); | 
					
						
							| 
									
										
										
										
											2021-06-03 13:06:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchModuleDepencencyIds) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto moduleIds = storage.fetchModuleDependencyIds({moduleId3}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(moduleIds, UnorderedElementsAre(moduleId1, moduleId2, moduleId3)); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchModuleDepencencyIdsForRootDepencency) | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto moduleIds = storage.fetchModuleDependencyIds({moduleId1}); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THAT(moduleIds, ElementsAre(moduleId1)); | 
					
						
							| 
									
										
										
										
											2021-06-07 16:16:24 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddAliasDeclarations) | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                   sourceId3), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddAliasDeclarationsAgain) | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                   sourceId3), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesRemoveAliasDeclarations) | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations.pop_back(); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[2]}, {sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                   sourceId3), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddAliasDeclarationsThrowsForWrongTypeName) | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations[1].typeName = Storage::NativeType{"QQuickItemWrong"}; | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {types[2]}, {sourceId4}, {}), | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesAddAliasDeclarationsThrowsForWrongPropertyName) | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations[1].aliasPropertyName = "childrenWrong"; | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId4}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  |                  QmlDesigner::PropertyNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangeAliasDeclarationsTypeName) | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations[2].typeName = Storage::ExportedType{"Obj2"}; | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[2]}, {sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                   sourceId3), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("objects", | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                                     Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangeAliasDeclarationsPropertyName) | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations[2].aliasPropertyName = "children"; | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[2]}, {sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT( | 
					
						
							|  |  |  |         storage.fetchTypes(), | 
					
						
							|  |  |  |         Contains( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |             AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                 "QAliasItem", | 
					
						
							|  |  |  |                                 Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                 TypeAccessSemantics::Reference, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                 sourceId3), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                   Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                         UnorderedElementsAre( | 
					
						
							|  |  |  |                             IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                       | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                             IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                       | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                             IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangeAliasDeclarationsToPropertyDeclaration) | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations.pop_back(); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |     types[2].propertyDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::PropertyDeclaration{"objects", | 
					
						
							|  |  |  |                                      Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                      Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                          | Storage::PropertyDeclarationTraits::IsReadOnly}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[2]}, {sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT( | 
					
						
							|  |  |  |         storage.fetchTypes(), | 
					
						
							|  |  |  |         Contains( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |             AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                 "QAliasItem", | 
					
						
							|  |  |  |                                 Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                 TypeAccessSemantics::Reference, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                 sourceId3), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                   Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                         UnorderedElementsAre( | 
					
						
							|  |  |  |                             IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                       | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                             IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                       | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                             IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangePropertyDeclarationsToAliasDeclaration) | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  |     auto typesChanged = types; | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     typesChanged[2].propertyDeclarations.pop_back(); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |     typesChanged[2].propertyDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::PropertyDeclaration{"objects", | 
					
						
							|  |  |  |                                      Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                      Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                          | Storage::PropertyDeclarationTraits::IsReadOnly}); | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, typesChanged, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                   sourceId3), | 
					
						
							| 
									
										
										
										
											2021-06-09 17:56:34 +02:00
										 |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangeAliasTargetPropertyDeclarationTraits) | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |     types[1].propertyDeclarations[0].traits = Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                               | Storage::PropertyDeclarationTraits::IsReadOnly; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT( | 
					
						
							|  |  |  |         storage.fetchTypes(), | 
					
						
							|  |  |  |         Contains( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |             AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                 "QAliasItem", | 
					
						
							|  |  |  |                                 Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                 TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                 sourceId3), | 
					
						
							|  |  |  |                   Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                         UnorderedElementsAre( | 
					
						
							|  |  |  |                             IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                       | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                             IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                       | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                             IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesChangeAliasTargetPropertyDeclarationTypeName) | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |     types[1].propertyDeclarations[0].typeName = Storage::ExportedType{"Item"}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3), | 
					
						
							|  |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesRemovePropertyDeclarationWithAnAliasThrows) | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |     types[1].propertyDeclarations.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                  Sqlite::ConstraintPreventsModification); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesRemovePropertyDeclarationAndAlias) | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |     types[1].propertyDeclarations.pop_back(); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations.pop_back(); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[1], types[2]}, {sourceId2, sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3), | 
					
						
							|  |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesRemoveTypeWithAliasTargetPropertyDeclarationThrows) | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations[2].typeName = Storage::ExportedType{"Object2"}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {}, {sourceId4}, {}), QmlDesigner::TypeNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, SynchronizeTypesRemoveTypeAndAliasPropertyDeclaration) | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations[2].typeName = Storage::ExportedType{"Object2"}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations.pop_back(); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[0], types[2]}, {sourceId1, sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-10 16:39:29 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3), | 
					
						
							|  |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, UpdateAliasPropertyIfPropertyIsOverloaded) | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  |     types[0].propertyDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::PropertyDeclaration{"objects", | 
					
						
							|  |  |  |                                      Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                      Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                          | Storage::PropertyDeclarationTraits::IsReadOnly}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[0]}, {sourceId1}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT( | 
					
						
							|  |  |  |         storage.fetchTypes(), | 
					
						
							|  |  |  |         Contains( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |             AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  |                                 "QAliasItem", | 
					
						
							|  |  |  |                                 Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                 TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                 sourceId3), | 
					
						
							|  |  |  |                   Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                         UnorderedElementsAre( | 
					
						
							|  |  |  |                             IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                       | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                             IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                       | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                             IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, AliasPropertyIsOverloaded) | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  |     types[0].propertyDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::PropertyDeclaration{"objects", | 
					
						
							|  |  |  |                                      Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                      Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                          | Storage::PropertyDeclarationTraits::IsReadOnly}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT( | 
					
						
							|  |  |  |         storage.fetchTypes(), | 
					
						
							|  |  |  |         Contains( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |             AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  |                                 "QAliasItem", | 
					
						
							|  |  |  |                                 Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                 TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                 sourceId3), | 
					
						
							|  |  |  |                   Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                         UnorderedElementsAre( | 
					
						
							|  |  |  |                             IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                       | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                             IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                       | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                             IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                   Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                   Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, UpdateAliasPropertyIfOverloadedPropertyIsRemoved) | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  |     types[0].propertyDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::PropertyDeclaration{"objects", | 
					
						
							|  |  |  |                                      Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                      Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                          | Storage::PropertyDeclarationTraits::IsReadOnly}); | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  |     types[0].propertyDeclarations.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[0]}, {sourceId1}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3), | 
					
						
							|  |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, RelinkAliasProperty) | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  |     types[1].propertyDeclarations[0].typeName = Storage::NativeType{"QObject2"}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[3].module = Storage::Module{"QtQuick"}; | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[3]}, {sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3), | 
					
						
							|  |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject2"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, DoNotRelinkAliasPropertyForExplicitExportedTypeName) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  |     types[1].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"Object2", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                   "/path/to"}}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[3].module = Storage::Module{"QtQuick"}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {types[3]}, {sourceId4}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |        DoRelinkAliasPropertyForExplicitExportedTypeNameEvenIfAnOtherSimilarTimeNameExists) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  |     types[1].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"Object2", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                   "/path/to"}}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                   "QObject2", | 
					
						
							|  |  |  |                                   Storage::NativeType{}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId5, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object2"}, Storage::ExportedType{"Obj2"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4, sourceId5}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-06-15 12:32:55 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3), | 
					
						
							|  |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject2"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, RelinkAliasPropertyReactToTypeNameChange) | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases2()}; | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::PropertyDeclaration{"items", Storage::ExportedType{"Item"}, "children"}); | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |     types[0].typeName = "QQuickItem2"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[0]}, {sourceId1}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains(AllOf( | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                     IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |                                   "QAliasItem", | 
					
						
							|  |  |  |                                   Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3), | 
					
						
							|  |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           UnorderedElementsAre( | 
					
						
							|  |  |  |                               IsPropertyDeclaration("items", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QQuickItem2"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                         | Storage::PropertyDeclarationTraits::IsReadOnly), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("objects", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList), | 
					
						
							|  |  |  |                               IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                     Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                     Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, DoNotRelinkAliasPropertyForDeletedType) | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  |     types[1].propertyDeclarations[0].typeName = Storage::NativeType{"QObject2"}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |     types.erase(std::next(types.begin(), 2)); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[2].module = Storage::Module{"QtQuick"}; | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[2]}, {sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Not(Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |                                                  "QAliasItem", | 
					
						
							|  |  |  |                                                  Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                  TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                  sourceId3))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, DoNotRelinkAliasPropertyForDeletedTypeAndPropertyType) | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  |     types[1].propertyDeclarations[0].typeName = Storage::NativeType{"QObject2"}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |     types.pop_back(); | 
					
						
							|  |  |  |     types.pop_back(); | 
					
						
							|  |  |  |     types[1].propertyDeclarations[0].typeName = Storage::NativeType{"QObject"}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[1]}, {sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), SizeIs(2)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, DoNotRelinkAliasPropertyForDeletedTypeAndPropertyTypeNameChange) | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  |     types[1].propertyDeclarations[0].typeName = Storage::NativeType{"QObject2"}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |     types.erase(std::next(types.begin(), 2)); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[2].module = Storage::Module{"QtQuick"}; | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |     types[1].propertyDeclarations[0].typeName = Storage::NativeType{"QObject"}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[2]}, {sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Not(Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |                                                  "QAliasItem", | 
					
						
							|  |  |  |                                                  Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                  TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                  sourceId3))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, DoNotRelinkPropertyTypeDoesNotExists) | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  |     types[1].propertyDeclarations[0].typeName = Storage::NativeType{"QObject2"}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |     types.pop_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {}, {sourceId4}, {}), QmlDesigner::TypeNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, DoNotRelinkAliasPropertyTypeDoesNotExists) | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases2()}; | 
					
						
							|  |  |  |     types[1].propertyDeclarations[0].typeName = Storage::NativeType{"QObject2"}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  |     types.erase(types.begin()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {}, {sourceId1}, {}), QmlDesigner::TypeNameDoesNotExists); | 
					
						
							| 
									
										
										
										
											2021-07-01 10:42:38 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ChangePrototypeTypeName) | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     Storage::Types types{createTypesWithExportedTypeNamesOnly()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  |     types[1].typeName = "QObject3"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  |                                        "QQuickItem", | 
					
						
							|  |  |  |                                        Storage::NativeType{"QObject3"}, | 
					
						
							|  |  |  |                                        TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                        sourceId1))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, ChangePrototypeTypeModuleId) | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[1].module = Storage::Module{"QtQuick"}; | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                        "QQuickItem", | 
					
						
							|  |  |  |                                        Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                        TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                        sourceId1))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, ChangeExplicitPrototypeTypeModuleIdThows) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[0].prototype = Storage::ExplicitExportedType{"Object", Storage::Module{"Qml"}}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[1].module = Storage::Module{"QtQuick"}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, ChangeExplicitPrototypeTypeModuleId) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[0].prototype = Storage::ExplicitExportedType{"Object", Storage::Module{"Qml"}}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[1].module = Storage::Module{"QtQuick"}; | 
					
						
							|  |  |  |     types[0].prototype = Storage::ExplicitExportedType{"Object", Storage::Module{"QtQuick"}}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[0], types[1]}, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  |                                        "QQuickItem", | 
					
						
							|  |  |  |                                        Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                        TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                        sourceId1))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, ChangePrototypeTypeNameAndModuleId) | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     Storage::Types types{createTypesWithExportedTypeNamesOnly()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[1].module = Storage::Module{"QtQuick"}; | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  |     types[1].typeName = "QObject3"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  |                                        "QQuickItem", | 
					
						
							|  |  |  |                                        Storage::NativeType{"QObject3"}, | 
					
						
							|  |  |  |                                        TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                        sourceId1))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ChangePrototypeTypeNameThrowsForWrongNativePrototupeTypeName) | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExportedType{"Object"}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  |     types[1].typeName = "QObject3"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-01 16:28:02 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ThrowForPrototypeChainCycles) | 
					
						
							| 
									
										
										
										
											2021-07-06 15:45:10 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[1].prototype = Storage::ExportedType{"Object2"}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types.push_back(Storage::Type{Storage::Module{"/path/to"}, | 
					
						
							| 
									
										
										
										
											2021-07-06 15:45:10 +02:00
										 |  |  |                                   "QObject2", | 
					
						
							|  |  |  |                                   Storage::ExportedType{"Item"}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object2"}, Storage::ExportedType{"Obj2"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-06 15:45:10 +02:00
										 |  |  |                  QmlDesigner::PrototypeChainCycle); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ThrowForTypeIdAndPrototypeIdAreTheSame) | 
					
						
							| 
									
										
										
										
											2021-07-06 15:45:10 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[1].prototype = Storage::ExportedType{"Object"}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-06 15:45:10 +02:00
										 |  |  |                  QmlDesigner::PrototypeChainCycle); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ThrowForTypeIdAndPrototypeIdAreTheSameForRelinking) | 
					
						
							| 
									
										
										
										
											2021-07-06 15:45:10 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     Storage::Types types{createTypesWithExportedTypeNamesOnly()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-06 15:45:10 +02:00
										 |  |  |     types[1].prototype = Storage::ExportedType{"Item"}; | 
					
						
							|  |  |  |     types[1].typeName = "QObject2"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-15 13:46:17 +02:00
										 |  |  |                  QmlDesigner::PrototypeChainCycle); | 
					
						
							| 
									
										
										
										
											2021-07-06 15:45:10 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, RecursiveAliases) | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithRecursiveAliases()}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4, sourceId5}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |                                              "QAliasItem2", | 
					
						
							|  |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId5), | 
					
						
							|  |  |  |                                Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                      ElementsAre(IsPropertyDeclaration( | 
					
						
							|  |  |  |                                          "objects", | 
					
						
							|  |  |  |                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                          Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, RecursiveAliasesChangePropertyType) | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithRecursiveAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4, sourceId5}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[1].propertyDeclarations[0].typeName = Storage::ExportedType{"Object2"}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |                                              "QAliasItem2", | 
					
						
							|  |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId5), | 
					
						
							|  |  |  |                                Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                      ElementsAre(IsPropertyDeclaration( | 
					
						
							|  |  |  |                                          "objects", | 
					
						
							|  |  |  |                                          Storage::NativeType{"QObject2"}, | 
					
						
							|  |  |  |                                          Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, UpdateAliasesAfterInjectingProperty) | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithRecursiveAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4, sourceId5}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[0].propertyDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::PropertyDeclaration{"objects", | 
					
						
							|  |  |  |                                      Storage::ExportedType{"Item"}, | 
					
						
							|  |  |  |                                      Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                          | Storage::PropertyDeclarationTraits::IsReadOnly}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[0]}, {sourceId1}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |                                              "QAliasItem2", | 
					
						
							|  |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId5), | 
					
						
							|  |  |  |                                Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                      ElementsAre(IsPropertyDeclaration( | 
					
						
							|  |  |  |                                          "objects", | 
					
						
							|  |  |  |                                          Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                          Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                              | Storage::PropertyDeclarationTraits::IsReadOnly)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, UpdateAliasesAfterChangeAliasToProperty) | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithRecursiveAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4, sourceId5}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[2].propertyDeclarations.clear(); | 
					
						
							|  |  |  |     types[2].propertyDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::PropertyDeclaration{"objects", | 
					
						
							|  |  |  |                                      Storage::ExportedType{"Item"}, | 
					
						
							|  |  |  |                                      Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                          | Storage::PropertyDeclarationTraits::IsReadOnly}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[2]}, {sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 AllOf(Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |                                                    "QAliasItem2", | 
					
						
							|  |  |  |                                                    Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                    TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                    sourceId5), | 
					
						
							|  |  |  |                                      Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                            ElementsAre(IsPropertyDeclaration( | 
					
						
							|  |  |  |                                                "objects", | 
					
						
							|  |  |  |                                                Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                    | Storage::PropertyDeclarationTraits::IsReadOnly, | 
					
						
							|  |  |  |                                                "objects"))))), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                       Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |                                                    "QAliasItem", | 
					
						
							|  |  |  |                                                    Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                    TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                                    sourceId3), | 
					
						
							|  |  |  |                                      Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                            ElementsAre(IsPropertyDeclaration( | 
					
						
							|  |  |  |                                                "objects", | 
					
						
							|  |  |  |                                                Storage::NativeType{"QQuickItem"}, | 
					
						
							|  |  |  |                                                Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                                    | Storage::PropertyDeclarationTraits::IsReadOnly, | 
					
						
							|  |  |  |                                                ""))))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, UpdateAliasesAfterChangePropertyToAlias) | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithRecursiveAliases()}; | 
					
						
							|  |  |  |     types[3].propertyDeclarations[0].traits = Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                               | Storage::PropertyDeclarationTraits::IsReadOnly; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4, sourceId5}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |     types[1].propertyDeclarations.clear(); | 
					
						
							|  |  |  |     types[1].propertyDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::PropertyDeclaration{"objects", Storage::ExportedType{"Object2"}, "objects"}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-07 16:38:08 +02:00
										 |  |  |                                              "QAliasItem2", | 
					
						
							|  |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId5), | 
					
						
							|  |  |  |                                Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                      ElementsAre(IsPropertyDeclaration( | 
					
						
							|  |  |  |                                          "objects", | 
					
						
							|  |  |  |                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                          Storage::PropertyDeclarationTraits::IsList | 
					
						
							|  |  |  |                                              | Storage::PropertyDeclarationTraits::IsReadOnly, | 
					
						
							|  |  |  |                                          "objects")))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, CheckForProtoTypeCycleThrows) | 
					
						
							| 
									
										
										
										
											2021-07-15 10:21:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithRecursiveAliases()}; | 
					
						
							|  |  |  |     types[1].propertyDeclarations.clear(); | 
					
						
							|  |  |  |     types[1].propertyDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::PropertyDeclaration{"objects", Storage::ExportedType{"AliasItem2"}, "objects"}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize( | 
					
						
							|  |  |  |                      {}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4, sourceId5}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-15 10:21:56 +02:00
										 |  |  |                  QmlDesigner::AliasChainCycle); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, CheckForProtoTypeCycleAfterUpdateThrows) | 
					
						
							| 
									
										
										
										
											2021-07-15 10:21:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithRecursiveAliases()}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4, sourceId5}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-15 10:21:56 +02:00
										 |  |  |     types[1].propertyDeclarations.clear(); | 
					
						
							|  |  |  |     types[1].propertyDeclarations.push_back( | 
					
						
							|  |  |  |         Storage::PropertyDeclaration{"objects", Storage::ExportedType{"AliasItem2"}, "objects"}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}), | 
					
						
							|  |  |  |                  QmlDesigner::AliasChainCycle); | 
					
						
							| 
									
										
										
										
											2021-07-15 10:21:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ExplicitPrototype) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[0].prototype = Storage::ExplicitExportedType{"Object", Storage::Module{"Qml"}}; | 
					
						
							|  |  |  |     types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                   "QQuickObject", | 
					
						
							|  |  |  |                                   Storage::NativeType{}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                        "QQuickItem", | 
					
						
							|  |  |  |                                        Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                        TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                        sourceId1))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, ExplicitPrototypeUpperDownTheModuleChainThrows) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[0].prototype = Storage::ExplicitExportedType{"Object", Storage::Module{"QtQuick"}}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, ExplicitPrototypeUpperInTheModuleChain) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[0].prototype = Storage::ExplicitExportedType{"Object", Storage::Module{"QtQuick"}}; | 
					
						
							|  |  |  |     types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                   "QQuickObject", | 
					
						
							|  |  |  |                                   Storage::NativeType{}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                        "QQuickItem", | 
					
						
							|  |  |  |                                        Storage::NativeType{"QQuickObject"}, | 
					
						
							|  |  |  |                                        TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                        sourceId1))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ExplicitPrototypeWithWrongVersionThrows) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[0].prototype = Storage::ExplicitExportedType{"Object", Storage::Module{"Qml", 4}}; | 
					
						
							|  |  |  |     types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                   "QQuickObject", | 
					
						
							|  |  |  |                                   Storage::NativeType{}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ExplicitPrototypeWithVersion) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[0].prototype = Storage::ExplicitExportedType{"Object", Storage::Module{"Qml", 2}}; | 
					
						
							|  |  |  |     types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                   "QQuickObject", | 
					
						
							|  |  |  |                                   Storage::NativeType{}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                        "QQuickItem", | 
					
						
							|  |  |  |                                        Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                        TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                        sourceId1))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ExplicitPrototypeWithVersionInTheProtoTypeChain) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto moduleDependencyQtQuick2 = Storage::ModuleDependency{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |         "QtQuick", | 
					
						
							|  |  |  |         Storage::VersionNumber{2}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         moduleSourceId2, | 
					
						
							|  |  |  |         {Storage::Module{"Qml", Storage::VersionNumber{2}}}}; | 
					
						
							|  |  |  |     types[0].prototype = Storage::ExplicitExportedType{"Object", Storage::Module{"QtQuick", 2}}; | 
					
						
							|  |  |  |     types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                   "QQuickObject", | 
					
						
							|  |  |  |                                   Storage::NativeType{}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     storage.synchronize({moduleDependencyQtQuick2}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                         {}, | 
					
						
							|  |  |  |                         types, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                         {sourceId1, sourceId2, sourceId3, moduleSourceId2}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                         {}); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(IsStorageType(Storage::Module{"QtQuick", 2}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                        "QQuickItem", | 
					
						
							|  |  |  |                                        Storage::NativeType{"QQuickObject"}, | 
					
						
							|  |  |  |                                        TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                        sourceId1))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ExplicitPrototypeWithVersionDownTheProtoTypeChainThrows) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto moduleDependencyQtQuick2 = Storage::ModuleDependency{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |         "QtQuick", | 
					
						
							|  |  |  |         Storage::VersionNumber{2}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         moduleSourceId2, | 
					
						
							|  |  |  |         {Storage::Module{"Qml", Storage::VersionNumber{2}}}}; | 
					
						
							|  |  |  |     types[0].prototype = Storage::ExplicitExportedType{"Object", Storage::Module{"QtQuick", 2}}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({moduleDependencyQtQuick2}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                      {}, | 
					
						
							|  |  |  |                                      types, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      {sourceId1, sourceId2, sourceId3, moduleSourceId2}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                                      {}), | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ExplicitPropertyDeclarationTypeName) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"Object", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                   "Qml"}}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                   "QQuickObject", | 
					
						
							|  |  |  |                                   Storage::NativeType{}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains( | 
					
						
							|  |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           Contains(IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                          Storage::PropertyDeclarationTraits::IsList))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, ExplicitPropertyDeclarationTypeNameDownTheModuleChainThrows) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"Object", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                   "QtQuick"}}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, ExplicitPropertyDeclarationTypeNameInTheModuleChain) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"Object", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                   "QtQuick"}}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types.push_back(Storage::Type{Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                   "QQuickObject", | 
					
						
							|  |  |  |                                   Storage::NativeType{}, | 
					
						
							|  |  |  |                                   TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                   sourceId3, | 
					
						
							|  |  |  |                                   {Storage::ExportedType{"Object"}}}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains( | 
					
						
							|  |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           Contains(IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QQuickObject"}, | 
					
						
							|  |  |  |                                                          Storage::PropertyDeclarationTraits::IsList))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ExplicitPropertyDeclarationTypeNameWithVersion) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"Object", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{"Qml", | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                               2}}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							|  |  |  |                 Contains( | 
					
						
							|  |  |  |                     Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                           Contains(IsPropertyDeclaration("data", | 
					
						
							|  |  |  |                                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                                          Storage::PropertyDeclarationTraits::IsList))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, PrototypeWithVersionDownTheProtoTypeChainThrows) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto moduleDependencyQtQuick2 = Storage::ModuleDependency{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |         "QtQuick", | 
					
						
							|  |  |  |         Storage::VersionNumber{2}, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |         moduleSourceId2, | 
					
						
							|  |  |  |         {Storage::Module{"Qml", Storage::VersionNumber{2}}}}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |     types[0].prototype = Storage::ExportedType{"Object"}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     auto document = Storage::Document{sourceId1, {Storage::Module{"QtQuick"}}}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({moduleDependencyQtQuick2}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                      {document}, | 
					
						
							|  |  |  |                                      types, | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                      {sourceId1, sourceId2, sourceId3, moduleSourceId2}, | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |                                      {}), | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, ChangePropertyTypeModuleIdWithExplicitTypeThrows) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"Object", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                   "Qml"}}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[1].module = Storage::Module{"QtQuick"}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {types[1]}, {sourceId2}, {}), | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                  QmlDesigner::TypeNameDoesNotExists); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  | TEST_F(ProjectStorage, ChangePropertyTypeModuleIdWithExplicitType) | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypes()}; | 
					
						
							|  |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"Object", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                   "Qml"}}; | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |     types[0].propertyDeclarations[0].typeName = Storage::ExplicitExportedType{"Object", | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                                                                               Storage::Module{ | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                                                                   "QtQuick"}}; | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[1].module = Storage::Module{"QtQuick"}; | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2}, {}); | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"QtQuick"}, | 
					
						
							| 
									
										
										
										
											2021-07-22 17:26:53 +02:00
										 |  |  |                                              "QQuickItem", | 
					
						
							|  |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId1), | 
					
						
							|  |  |  |                                Field(&Storage::Type::propertyDeclarations, | 
					
						
							|  |  |  |                                      Contains(IsPropertyDeclaration( | 
					
						
							|  |  |  |                                          "data", | 
					
						
							|  |  |  |                                          Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                          Storage::PropertyDeclarationTraits::IsList)))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, AddFileStatuses) | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     setUpSourceIds(); | 
					
						
							|  |  |  |     FileStatus fileStatus1{sourceId1, 100, 100}; | 
					
						
							|  |  |  |     FileStatus fileStatus2{sourceId2, 101, 101}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     storage.synchronize({}, {}, {}, {sourceId1, sourceId2}, {fileStatus1, fileStatus2}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(convert(storage.fetchAllFileStatuses()), | 
					
						
							|  |  |  |                 UnorderedElementsAre(fileStatus1, fileStatus2)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, RemoveFileStatus) | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     setUpSourceIds(); | 
					
						
							|  |  |  |     FileStatus fileStatus1{sourceId1, 100, 100}; | 
					
						
							|  |  |  |     FileStatus fileStatus2{sourceId2, 101, 101}; | 
					
						
							|  |  |  |     storage.synchronize({}, {}, {}, {sourceId1, sourceId2}, {fileStatus1, fileStatus2}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     storage.synchronize({}, {}, {}, {sourceId1, sourceId2}, {fileStatus1}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(convert(storage.fetchAllFileStatuses()), UnorderedElementsAre(fileStatus1)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, UpdateFileStatus) | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     setUpSourceIds(); | 
					
						
							|  |  |  |     FileStatus fileStatus1{sourceId1, 100, 100}; | 
					
						
							|  |  |  |     FileStatus fileStatus2{sourceId2, 101, 101}; | 
					
						
							|  |  |  |     FileStatus fileStatus2b{sourceId2, 102, 102}; | 
					
						
							|  |  |  |     storage.synchronize({}, {}, {}, {sourceId1, sourceId2}, {fileStatus1, fileStatus2}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     storage.synchronize({}, {}, {}, {sourceId1, sourceId2}, {fileStatus1, fileStatus2b}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(convert(storage.fetchAllFileStatuses()), | 
					
						
							|  |  |  |                 UnorderedElementsAre(fileStatus1, fileStatus2b)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, ThrowForInvalidSourceId) | 
					
						
							| 
									
										
										
										
											2021-08-03 15:03:36 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     setUpSourceIds(); | 
					
						
							|  |  |  |     FileStatus fileStatus1{SourceId{}, 100, 100}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THROW(storage.synchronize({}, {}, {}, {sourceId1}, {fileStatus1}), | 
					
						
							|  |  |  |                  Sqlite::ConstraintPreventsModification); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchAllFileStatuses) | 
					
						
							| 
									
										
										
										
											2021-08-03 17:13:29 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     setUpSourceIds(); | 
					
						
							|  |  |  |     FileStatus fileStatus1{sourceId1, 100, 100}; | 
					
						
							|  |  |  |     FileStatus fileStatus2{sourceId2, 101, 101}; | 
					
						
							|  |  |  |     storage.synchronize({}, {}, {}, {sourceId1, sourceId2}, {fileStatus1, fileStatus2}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto fileStatuses = convert(storage.fetchAllFileStatuses()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(fileStatuses, ElementsAre(fileStatus1, fileStatus2)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchAllFileStatusesReverse) | 
					
						
							| 
									
										
										
										
											2021-08-03 17:13:29 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     setUpSourceIds(); | 
					
						
							|  |  |  |     FileStatus fileStatus1{sourceId1, 100, 100}; | 
					
						
							|  |  |  |     FileStatus fileStatus2{sourceId2, 101, 101}; | 
					
						
							|  |  |  |     storage.synchronize({}, {}, {}, {sourceId1, sourceId2}, {fileStatus2, fileStatus1}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto fileStatuses = convert(storage.fetchAllFileStatuses()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(fileStatuses, ElementsAre(fileStatus1, fileStatus2)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  | TEST_F(ProjectStorage, FetchFileStatus) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     setUpSourceIds(); | 
					
						
							|  |  |  |     FileStatus fileStatus1{sourceId1, 100, 100}; | 
					
						
							|  |  |  |     FileStatus fileStatus2{sourceId2, 101, 101}; | 
					
						
							|  |  |  |     storage.synchronize({}, {}, {}, {sourceId1, sourceId2}, {fileStatus1, fileStatus2}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto fileStatus = storage.fetchFileStatus(sourceId1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(fileStatus, Eq(fileStatus1)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(ProjectStorage, SynchronizeTypesWithoutTypeName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Storage::Types types{createTypesWithAliases()}; | 
					
						
							|  |  |  |     storage.synchronize({}, {}, types, {sourceId1, sourceId2, sourceId3, sourceId4}, {}); | 
					
						
							|  |  |  |     types[3].typeName.clear(); | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |     types[3].module.name.clear(); | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  |     types[3].prototype = Storage::ExportedType{"Object"}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     storage.synchronize({}, {}, {types[3]}, {sourceId4}, {}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(storage.fetchTypes(), | 
					
						
							| 
									
										
										
										
											2021-08-24 11:53:15 +02:00
										 |  |  |                 Contains(AllOf(IsStorageType(Storage::Module{"/path/to"}, | 
					
						
							| 
									
										
										
										
											2021-09-16 17:19:56 +02:00
										 |  |  |                                              "QObject2", | 
					
						
							|  |  |  |                                              Storage::NativeType{"QObject"}, | 
					
						
							|  |  |  |                                              TypeAccessSemantics::Reference, | 
					
						
							|  |  |  |                                              sourceId4), | 
					
						
							|  |  |  |                                Field(&Storage::Type::exportedTypes, | 
					
						
							|  |  |  |                                      UnorderedElementsAre(IsExportedType("Object2"), | 
					
						
							|  |  |  |                                                           IsExportedType("Obj2")))))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-28 16:18:59 +02:00
										 |  |  | } // namespace
 |