diff options
Diffstat (limited to 'sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp')
-rw-r--r-- | sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp | 61 |
1 files changed, 19 insertions, 42 deletions
diff --git a/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp b/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp index 48e4c60e3..10ca1a0f6 100644 --- a/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp +++ b/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp @@ -1,35 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of Qt for Python. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "testnestedtypes.h" #include "testutil.h" #include <abstractmetafunction.h> #include <abstractmetalang.h> +#include <abstractmetatype.h> #include <codesnip.h> #include <modifications.h> #include <complextypeentry.h> @@ -43,7 +19,7 @@ using namespace Qt::StringLiterals; void TestNestedTypes::testNestedTypesModifications() { - const char* cppCode ="\ + const char cppCode[] = "\ namespace OuterNamespace {\n\ namespace InnerNamespace {\n\ struct SomeClass {\n\ @@ -51,7 +27,7 @@ void TestNestedTypes::testNestedTypesModifications() };\n\ };\n\ };\n"; - const char* xmlCode = "\ + const char xmlCode[] = "\ <typesystem package='Foo'>\n\ <namespace-type name='OuterNamespace'>\n\ <namespace-type name='InnerNamespace'>\n\ @@ -67,13 +43,13 @@ void TestNestedTypes::testNestedTypesModifications() </typesystem>\n"; QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false)); - QVERIFY(!builder.isNull()); + QVERIFY(builder); AbstractMetaClassList classes = builder->classes(); - auto *ons = AbstractMetaClass::findClass(classes, u"OuterNamespace"); + const auto ons = AbstractMetaClass::findClass(classes, "OuterNamespace"); QVERIFY(ons); - auto *ins = AbstractMetaClass::findClass(classes, u"OuterNamespace::InnerNamespace"); + const auto ins = AbstractMetaClass::findClass(classes, "OuterNamespace::InnerNamespace"); QVERIFY(ins); QCOMPARE(ins->functions().size(), 1); QCOMPARE(ins->typeEntry()->codeSnips().size(), 1); @@ -92,8 +68,9 @@ void TestNestedTypes::testNestedTypesModifications() snip = addedFunc->modifications().constFirst().snips().constFirst(); QCOMPARE(snip.code().trimmed(), u"custom_code2();"); - auto *sc = AbstractMetaClass::findClass(classes, u"OuterNamespace::InnerNamespace::SomeClass"); - QVERIFY(ins); + const auto sc = + AbstractMetaClass::findClass(classes, "OuterNamespace::InnerNamespace::SomeClass"); + QVERIFY(sc); QCOMPARE(sc->functions().size(), 2); // default constructor and removed method const auto removedFunc = sc->functions().constLast(); QVERIFY(removedFunc->isModifiedRemoved()); @@ -102,11 +79,11 @@ void TestNestedTypes::testNestedTypesModifications() void TestNestedTypes::testDuplicationOfNestedTypes() { - const char* cppCode ="\ + const char cppCode[] = "\ namespace Namespace {\n\ class SomeClass {};\n\ };\n"; - const char* xmlCode = "\ + const char xmlCode[] = "\ <typesystem package='Foo'>\n\ <namespace-type name='Namespace'>\n\ <value-type name='SomeClass'>\n\ @@ -116,22 +93,22 @@ void TestNestedTypes::testDuplicationOfNestedTypes() </typesystem>\n"; QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false)); - QVERIFY(!builder.isNull()); + QVERIFY(builder); AbstractMetaClassList classes = builder->classes(); QCOMPARE(classes.size(), 2); - auto *nspace = AbstractMetaClass::findClass(classes, u"Namespace"); + const auto nspace = AbstractMetaClass::findClass(classes, "Namespace"); QVERIFY(nspace); - auto *cls1 = AbstractMetaClass::findClass(classes, u"SomeClass"); + const auto cls1 = AbstractMetaClass::findClass(classes, "SomeClass"); QVERIFY(cls1); - auto *cls2 = AbstractMetaClass::findClass(classes, u"Namespace::SomeClass"); + const auto cls2 = AbstractMetaClass::findClass(classes, "Namespace::SomeClass"); QVERIFY(cls2); QCOMPARE(cls1, cls2); QCOMPARE(cls1->name(), u"SomeClass"); QCOMPARE(cls1->qualifiedCppName(), u"Namespace::SomeClass"); - TypeEntry* t1 = TypeDatabase::instance()->findType(u"Namespace::SomeClass"_s); + auto t1 = TypeDatabase::instance()->findType(u"Namespace::SomeClass"_s); QVERIFY(t1); - TypeEntry* t2 = TypeDatabase::instance()->findType(u"SomeClass"_s); + auto t2 = TypeDatabase::instance()->findType(u"SomeClass"_s); QVERIFY(!t2); } |