summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2022-08-24 13:11:33 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2022-08-26 15:02:24 +0000
commitda36459759414c582fbc3bb65f4b9edc28fdc34a (patch)
tree6ab54118dc2dbead43231674b884de1f0603b55b /tests/unit
parentfa033876e6b7274a46123f5cbd362de70c785cac (diff)
downloadqt-creator-da36459759414c582fbc3bb65f4b9edc28fdc34a.tar.gz
QmlDesigner: Refactor isSubClass
IsSubClass is renamed to isBasedOn and takes now NodeMetaInfo as a parameter. But for most cases there are is... functions as short cut. The model is providing shortcut NodeMetaInfos too. This is done in the sake of caching. Task-number: QDS-7445 Change-Id: Iff2dea66e253b412105427134bd49cb16ed76193 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/mockup/qmldesigner/designercore/include/nodemetainfo.h12
-rw-r--r--tests/unit/unittest/projectstorage-test.cpp14
2 files changed, 17 insertions, 9 deletions
diff --git a/tests/unit/mockup/qmldesigner/designercore/include/nodemetainfo.h b/tests/unit/mockup/qmldesigner/designercore/include/nodemetainfo.h
index 789b1f7f63..9a35096103 100644
--- a/tests/unit/mockup/qmldesigner/designercore/include/nodemetainfo.h
+++ b/tests/unit/mockup/qmldesigner/designercore/include/nodemetainfo.h
@@ -47,7 +47,6 @@ public:
std::vector<NodeMetaInfo> classHierarchy() const { return {}; }
std::vector<NodeMetaInfo> superClasses() const { return {}; }
- NodeMetaInfo directSuperClass() const { return {}; }
bool defaultPropertyIsComponent() const { return {}; }
@@ -62,12 +61,21 @@ public:
bool hasCustomParser() const { return {}; }
bool availableInVersion(int, int) const { return {}; }
- bool isSubclassOf(const TypeName &, int = -1, int = -1) const { return {}; }
+ bool isBasedOn(const NodeMetaInfo &) const { return {}; }
+ bool isBasedOn(const NodeMetaInfo &, const NodeMetaInfo &) const { return {}; }
+ bool isBasedOn(const NodeMetaInfo &, const NodeMetaInfo &, const NodeMetaInfo &) const
+ {
+ return {};
+ }
bool isGraphicalItem() const { return {}; }
bool isLayoutable() const { return {}; }
bool isView() const { return {}; }
bool isTabView() const { return {}; }
+ bool isQtQuick3DNode() const { return {}; }
+ bool isQtQuick3DModel() const { return {}; }
+ bool isQtQuick3DMaterial() const { return {}; }
+ bool isQtQuickLoader() const { return {}; }
QString importDirectoryPath() const { return {}; }
diff --git a/tests/unit/unittest/projectstorage-test.cpp b/tests/unit/unittest/projectstorage-test.cpp
index 6bc7e50fa8..ebfff84034 100644
--- a/tests/unit/unittest/projectstorage-test.cpp
+++ b/tests/unit/unittest/projectstorage-test.cpp
@@ -6792,7 +6792,7 @@ TEST_F(ProjectStorage, GetPrototypeAndSelfIdsWithExtension)
fetchTypeId(sourceId1, "QObject")));
}
-TEST_F(ProjectStorage, IsBaseOfForDirectPrototype)
+TEST_F(ProjectStorage, IsBasedOnForDirectPrototype)
{
auto package{createPackageWithProperties()};
storage.synchronize(package);
@@ -6805,7 +6805,7 @@ TEST_F(ProjectStorage, IsBaseOfForDirectPrototype)
ASSERT_TRUE(isBasedOn);
}
-TEST_F(ProjectStorage, IsBaseOfForIndirectPrototype)
+TEST_F(ProjectStorage, IsBasedOnForIndirectPrototype)
{
auto package{createPackageWithProperties()};
storage.synchronize(package);
@@ -6817,7 +6817,7 @@ TEST_F(ProjectStorage, IsBaseOfForIndirectPrototype)
ASSERT_TRUE(isBasedOn);
}
-TEST_F(ProjectStorage, IsBaseOfForDirectExtension)
+TEST_F(ProjectStorage, IsBasedOnForDirectExtension)
{
auto package{createPackageWithProperties()};
std::swap(package.types[1].extension, package.types[1].prototype);
@@ -6830,7 +6830,7 @@ TEST_F(ProjectStorage, IsBaseOfForDirectExtension)
ASSERT_TRUE(isBasedOn);
}
-TEST_F(ProjectStorage, IsBaseOfForIndirectExtension)
+TEST_F(ProjectStorage, IsBasedOnForIndirectExtension)
{
auto package{createPackageWithProperties()};
std::swap(package.types[1].extension, package.types[1].prototype);
@@ -6843,7 +6843,7 @@ TEST_F(ProjectStorage, IsBaseOfForIndirectExtension)
ASSERT_TRUE(isBasedOn);
}
-TEST_F(ProjectStorage, IsBaseOfForSelf)
+TEST_F(ProjectStorage, IsBasedOnForSelf)
{
auto package{createPackageWithProperties()};
storage.synchronize(package);
@@ -6855,7 +6855,7 @@ TEST_F(ProjectStorage, IsBaseOfForSelf)
ASSERT_TRUE(isBasedOn);
}
-TEST_F(ProjectStorage, IsNotBaseOf)
+TEST_F(ProjectStorage, IsNotBasedOn)
{
auto package{createPackageWithProperties()};
storage.synchronize(package);
@@ -6868,7 +6868,7 @@ TEST_F(ProjectStorage, IsNotBaseOf)
ASSERT_FALSE(isBasedOn);
}
-TEST_F(ProjectStorage, IsNotBaseOfIfNoBaseTypeIsGiven)
+TEST_F(ProjectStorage, IsNotBasedOnIfNoBaseTypeIsGiven)
{
auto package{createPackageWithProperties()};
storage.synchronize(package);