aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/tests/samplebinding
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/tests/samplebinding')
-rw-r--r--sources/shiboken2/tests/samplebinding/modifications_test.py10
-rw-r--r--sources/shiboken2/tests/samplebinding/typesystem_sample.xml6
2 files changed, 16 insertions, 0 deletions
diff --git a/sources/shiboken2/tests/samplebinding/modifications_test.py b/sources/shiboken2/tests/samplebinding/modifications_test.py
index 1dcd50359..e9a1eaf7f 100644
--- a/sources/shiboken2/tests/samplebinding/modifications_test.py
+++ b/sources/shiboken2/tests/samplebinding/modifications_test.py
@@ -220,5 +220,15 @@ class ModificationsTest(unittest.TestCase):
self.assertTrue(isinstance(res, float))
self.assertEqual(res, em.increment)
+ def testDefaultValueModifications(self):
+ # PSYIDE-1095: setEnumValue() has the default value modified to
+ # calling defaultEnumValue() which returns Modifications.TestEnumValue2.
+ # This used to generated broken code since defaultEnumValue() was
+ # qualified by the enum scope.
+ modifications = Modifications()
+ modifications.setEnumValue()
+ self.assertEqual(modifications.enumValue(), Modifications.TestEnumValue2)
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
index 2cf2ecab3..30ad5def7 100644
--- a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
+++ b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
@@ -955,6 +955,7 @@
<object-type name="Modifications">
<enum-type name="OverloadedModFunc"/>
+ <enum-type name="TestEnum"/>
<modify-function signature="overloaded(int, bool, int, double)">
<modify-argument index="2">
@@ -1286,6 +1287,11 @@
%PYARG_0 = %CONVERTTOPYTHON[OddBool](%0);
</inject-code>
</modify-function>
+ <modify-function signature="setEnumValue(Modifications::TestEnum)">
+ <modify-argument index="1">
+ <replace-default-expression with="cppSelf->defaultEnumValue()"/>
+ </modify-argument>
+ </modify-function>
</object-type>
<object-type name="AbstractModifications">