From 804ea316c174ef5b18658a46d072eedbe03c534b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 25 Oct 2019 15:36:38 +0200 Subject: Properly nest types in type system files Nesting types by specifying "::" currently works by coincidence (as long as no modifications or further elements apppear) since the lookup is mostly name-based. It might be removed in a follow-up step. Task-number: PYSIDE-990 Task-number: PYSIDE-1074 Change-Id: I43db8a25a192e94b6a6d51f78233c3526f719406 Reviewed-by: Cristian Maureira-Fredes --- .../PySide2/QtCore/typesystem_core_common.xml | 6 +- .../ApiExtractor/tests/testabstractmetaclass.cpp | 66 ++++++++++++---------- .../ApiExtractor/tests/testcodeinjection.cpp | 2 +- .../ApiExtractor/tests/testresolvetype.cpp | 16 +++--- .../shiboken2/ApiExtractor/tests/testtemplates.cpp | 32 ++++++----- 5 files changed, 66 insertions(+), 56 deletions(-) diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index d3ca86b17..470e253b1 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -2844,9 +2844,9 @@ - - - + + + diff --git a/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp b/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp index 98b493c67..b85a022b3 100644 --- a/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp @@ -47,11 +47,12 @@ void TestAbstractMetaClass::testClassName() void TestAbstractMetaClass::testClassNameUnderNamespace() { const char* cppCode ="namespace Namespace { class ClassName {}; }\n"; - const char* xmlCode = "\ - \n\ - \n\ - \n\ - \n"; + const char* xmlCode = R"XML( + + + + + )XML"; QScopedPointer builder(TestUtil::parse(cppCode, xmlCode)); QVERIFY(!builder.isNull()); AbstractMetaClassList classes = builder->classes(); @@ -201,11 +202,12 @@ void TestAbstractMetaClass::testDefaultValues() class B {};\n\ void method(B b = B());\n\ };\n"; - const char* xmlCode = "\ - \n\ - \n\ - \n\ - \n"; + const char* xmlCode = R"XML( + + + + + )XML"; QScopedPointer builder(TestUtil::parse(cppCode, xmlCode)); QVERIFY(!builder.isNull()); AbstractMetaClassList classes = builder->classes(); @@ -224,17 +226,17 @@ void TestAbstractMetaClass::testModifiedDefaultValues() class B {};\n\ void method(B b = B());\n\ };\n"; - const char* xmlCode = "\ - \n\ - \n\ - \n\ - \n\ - \n\ - \n\ - \n\ - \n\ - \n\ - \n"; + const char* xmlCode = R"XML( + + + + + + + + + + )XML"; QScopedPointer builder(TestUtil::parse(cppCode, xmlCode)); QVERIFY(!builder.isNull()); AbstractMetaClassList classes = builder->classes(); @@ -254,11 +256,12 @@ void TestAbstractMetaClass::testInnerClassOfAPolymorphicOne() class B {};\n\ virtual void method();\n\ };\n"; - const char* xmlCode = "\ - \n\ - \n\ - \n\ - \n"; + const char* xmlCode = R"XML( + + + + + )XML"; QScopedPointer builder(TestUtil::parse(cppCode, xmlCode)); QVERIFY(!builder.isNull()); AbstractMetaClassList classes = builder->classes(); @@ -281,11 +284,12 @@ void TestAbstractMetaClass::testForwardDeclaredInnerClass() public:\n\ void foo();\n\ };\n"; - const char xmlCode[] = "\ - \n\ - \n\ - \n\ - \n"; + const char xmlCode[] = R"XML( + + + + + )XML"; QScopedPointer builder(TestUtil::parse(cppCode, xmlCode)); QVERIFY(!builder.isNull()); AbstractMetaClassList classes = builder->classes(); diff --git a/sources/shiboken2/ApiExtractor/tests/testcodeinjection.cpp b/sources/shiboken2/ApiExtractor/tests/testcodeinjection.cpp index c438e0c37..aeca2d3f4 100644 --- a/sources/shiboken2/ApiExtractor/tests/testcodeinjection.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testcodeinjection.cpp @@ -71,8 +71,8 @@ void TestCodeInjections::testReadFile() \n\ \n\ \n\ + \n\ \n\ - \n\ \n"); QScopedPointer builder(TestUtil::parse(cppCode, xmlCode.toLocal8Bit().constData())); QVERIFY(!builder.isNull()); diff --git a/sources/shiboken2/ApiExtractor/tests/testresolvetype.cpp b/sources/shiboken2/ApiExtractor/tests/testresolvetype.cpp index 2e5a5759a..2203f3648 100644 --- a/sources/shiboken2/ApiExtractor/tests/testresolvetype.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testresolvetype.cpp @@ -44,13 +44,15 @@ void TestResolveType::testResolveReturnTypeFromParentScope() C* method();\n\ };\n\ };"; - const char* xmlCode = "\n\ - \n\ - \n\ - \n\ - \n\ - \n\ - "; + const char* xmlCode = R"XML( + + + + + + + + )XML"; QScopedPointer builder(TestUtil::parse(cppCode, xmlCode, false)); QVERIFY(!builder.isNull()); AbstractMetaClassList classes = builder->classes(); diff --git a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp index 59b601f3b..5191cb38d 100644 --- a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp @@ -63,9 +63,10 @@ namespace Internet { - - - + + + + )XML").arg(file.fileName()); QScopedPointer builder(TestUtil::parse(cppCode, qPrintable(xmlCode1), false)); @@ -97,11 +98,12 @@ namespace Namespace { const char xmlCode[] = R"XML( - - + + + + + - - )XML"; QScopedPointer builder(TestUtil::parse(cppCode, xmlCode, false)); @@ -211,8 +213,9 @@ struct List { const char xmlCode[] = R"XML( - - + + + )XML"; QScopedPointer builder(TestUtil::parse(cppCode, xmlCode, false)); @@ -324,11 +327,12 @@ template struct Future {}; const char xmlCode[] = R"XML( - - - - - + + + + + + )XML"; QScopedPointer builder(TestUtil::parse(cppCode, xmlCode, false)); -- cgit v1.2.3