diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-30 07:55:46 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-30 07:55:46 +0200 |
commit | 7af97fa4136d66bbad6c7907de6e7bd823de2e43 (patch) | |
tree | 94123be1810104d257aa50fe4b387dd8a1bf2a6c /sources/shiboken2/tests/samplebinding | |
parent | 3bbcb7b0e6e0342569aa155d695bca46a7459eb0 (diff) | |
parent | ff792fd2e6842b990aff61a4e953dab5efbd89ae (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I13721e13d2fab13945385fe529afe4ab431e0532
Diffstat (limited to 'sources/shiboken2/tests/samplebinding')
4 files changed, 25 insertions, 23 deletions
diff --git a/sources/shiboken2/tests/samplebinding/CMakeLists.txt b/sources/shiboken2/tests/samplebinding/CMakeLists.txt index ad52565ad..6bbfdb5bc 100644 --- a/sources/shiboken2/tests/samplebinding/CMakeLists.txt +++ b/sources/shiboken2/tests/samplebinding/CMakeLists.txt @@ -97,6 +97,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/rectf_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/reference_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/referentmodelindex_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/toberenamedvalue_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/sample/removednamespace1_objectoninvisiblenamespace_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/renameduser_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/sample_module_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/sample_wrapper.cpp @@ -127,7 +128,6 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/filter_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/data_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/intersection_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/union_wrapper.cpp -${CMAKE_CURRENT_BINARY_DIR}/sample/invisible_objectoninvisiblenamespace_wrapper.cpp ) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/sample-binding.txt.in" diff --git a/sources/shiboken2/tests/samplebinding/enumfromremovednamespace_test.py b/sources/shiboken2/tests/samplebinding/enumfromremovednamespace_test.py index 4b0866c4e..168a609dc 100644 --- a/sources/shiboken2/tests/samplebinding/enumfromremovednamespace_test.py +++ b/sources/shiboken2/tests/samplebinding/enumfromremovednamespace_test.py @@ -38,15 +38,33 @@ from shiboken_paths import init_paths init_paths() import sample +from shiboken_test_helper import objectFullname + class TestEnumFromRemovedNamespace(unittest.TestCase): def testEnumPromotedToGlobal(self): sample.RemovedNamespace1_Enum - sample.RemovedNamespace1_Enum_Value0 + self.assertEqual(sample.RemovedNamespace1_Enum_Value0, 0) + self.assertEqual(sample.RemovedNamespace1_Enum_Value1, 1) sample.RemovedNamespace1_AnonymousEnum_Value0 sample.RemovedNamespace2_Enum sample.RemovedNamespace2_Enum_Value0 + def testNames(self): + # Test if invisible namespace does not appear on type name + self.assertEqual(objectFullname(sample.RemovedNamespace1_Enum), + "sample.RemovedNamespace1_Enum") + self.assertEqual(objectFullname(sample.ObjectOnInvisibleNamespace), + "sample.ObjectOnInvisibleNamespace") + + # Function arguments + signature = sample.ObjectOnInvisibleNamespace.toInt.__signature__ + self.assertEqual(objectFullname(signature.parameters['e'].annotation), + "sample.RemovedNamespace1_Enum") + signature = sample.ObjectOnInvisibleNamespace.consume.__signature__ + self.assertEqual(objectFullname(signature.parameters['other'].annotation), + "sample.ObjectOnInvisibleNamespace") + def testEnumPromotedToUpperNamespace(self): sample.UnremovedNamespace sample.UnremovedNamespace.RemovedNamespace3_Enum diff --git a/sources/shiboken2/tests/samplebinding/namespace_test.py b/sources/shiboken2/tests/samplebinding/namespace_test.py index 8171e0e43..807e7bfc9 100644 --- a/sources/shiboken2/tests/samplebinding/namespace_test.py +++ b/sources/shiboken2/tests/samplebinding/namespace_test.py @@ -43,20 +43,15 @@ from sample import * from shiboken_test_helper import objectFullname +# For tests of invisible namespaces, see +# enumfromremovednamespace_test.py / removednamespaces.h + + class TestVariablesUnderNamespace(unittest.TestCase): def testIt(self): self.assertEqual(SampleNamespace.variableInNamespace, 42) -class TestEnumUnderNamespace(unittest.TestCase): - def testInvisibleNamespace(self): - o1 = EnumOnNamespace.Option1 - self.assertEqual(o1, 1) - def testTpNames(self): - self.assertEqual(objectFullname(EnumOnNamespace), "sample.EnumOnNamespace") - self.assertEqual(str(EnumOnNamespace.Option1), - "sample.EnumOnNamespace.Option1") - class TestClassesUnderNamespace(unittest.TestCase): def testIt(self): c1 = SampleNamespace.SomeClass() @@ -87,14 +82,7 @@ class TestClassesUnderNamespace(unittest.TestCase): "sample.SampleNamespace.InValue") self.assertEqual(objectFullname(SampleNamespace.enumAsInt.__signature__.parameters['value'].annotation), "sample.SampleNamespace.SomeClass.PublicScopedEnum") - self.assertEqual(objectFullname(ObjectOnInvisibleNamespace.toInt.__signature__.parameters['e'].annotation), - "sample.EnumOnNamespace") - # Test if enum on namespace that was marked as not gerenated does not appear on type name - self.assertEqual(objectFullname(ObjectOnInvisibleNamespace), - "sample.ObjectOnInvisibleNamespace") - self.assertEqual(objectFullname(ObjectOnInvisibleNamespace.consume.__signature__.parameters['other'].annotation), - "sample.ObjectOnInvisibleNamespace") if __name__ == '__main__': unittest.main() diff --git a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml index fdddb80f2..e4963721b 100644 --- a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml +++ b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml @@ -536,11 +536,6 @@ <enum-type identified-by-value="AnonymousGlobalEnum_Value0"/> - <namespace-type name="Invisible" visible="no"> - <enum-type name="EnumOnNamespace" /> - <value-type name="ObjectOnInvisibleNamespace" /> - </namespace-type> - <namespace-type name="SampleNamespace"> <enum-type name="Option"/> <enum-type name="InValue"/> @@ -603,6 +598,7 @@ <namespace-type name="RemovedNamespace1" visible='false'> <enum-type name="RemovedNamespace1_Enum" /> + <value-type name="ObjectOnInvisibleNamespace" /> <namespace-type name="RemovedNamespace2" visible='false'> <enum-type name="RemovedNamespace2_Enum" /> </namespace-type> |