aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/samplebinding/namespace_test.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2025-09-10 11:19:45 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2025-09-17 14:07:15 +0200
commitf362b73e78e77c5c67ca7b24e382fbede4d3e259 (patch)
treedc4677dcb51cf36b4e6a6b31f612efde42eb77af /sources/shiboken6/tests/samplebinding/namespace_test.py
parentf0a7b00d63ca8a4f6649fd710c75918dc66faa9b (diff)
shiboken6: Add typedef'ed enumerations
Traverse the typedefs of a scope and check whether they point to some enumeration and whether a type entry for the source exists. Add these like normal enums. In the converter type check, add a clause for the alias source/target type, allowing for using the values interchangeably. [ChangeLog][shiboken6] shiboken6 can now also generate typedef'ed enumerations for purposes of renaming/deprecating enumerations. Pick-to: 6.10 Change-Id: Iec10c53b1167b958647242cedb04f8ff01ad1085 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/tests/samplebinding/namespace_test.py')
-rw-r--r--sources/shiboken6/tests/samplebinding/namespace_test.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/samplebinding/namespace_test.py b/sources/shiboken6/tests/samplebinding/namespace_test.py
index 0d67c7497..0e92d6e27 100644
--- a/sources/shiboken6/tests/samplebinding/namespace_test.py
+++ b/sources/shiboken6/tests/samplebinding/namespace_test.py
@@ -64,6 +64,20 @@ class TestClassesUnderNamespace(unittest.TestCase):
cls.setValue(SampleNamespace.EnumWithinInlineNamespace.EWIN_Value1)
self.assertEqual(cls.value(), SampleNamespace.EnumWithinInlineNamespace.EWIN_Value1)
+ def testEnumAlias(self):
+ """Test whether an enumeration can be aliased to another one and values
+ can be used interchangeably."""
+ expected = SampleNamespace.SomeClass.OptionAlias.None_
+ actual = SampleNamespace.SomeClass.passThroughOptionAlias(expected)
+ self.assertEqual(expected, actual)
+ actual = SampleNamespace.SomeClass.passThroughOption(expected)
+ self.assertEqual(expected, actual)
+ # The alias source values should also work
+ actual = SampleNamespace.SomeClass.passThroughOptionAlias(SampleNamespace.Option.None_)
+ self.assertEqual(expected, actual)
+ actual = SampleNamespace.SomeClass.passThroughOption(SampleNamespace.Option.None_)
+ self.assertEqual(expected, actual)
+
if __name__ == '__main__':
unittest.main()