aboutsummaryrefslogtreecommitdiffstats
path: root/tests/samplebinding
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-08-13 11:51:52 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:11 -0300
commit91a2dbd2e84e653ba0e0b36f4c46bfc23014e29b (patch)
treeecfc92c90ffe3c92282d06444f9cd4e26cdfc269 /tests/samplebinding
parente5d7ccddfee37eb10e3c594f96bdddb49864c340 (diff)
Added a method modification test dealing with code injection and user's primitive type.
The inject code has a %CONVERTTOPYTHON that receives an user's primitive type.
Diffstat (limited to 'tests/samplebinding')
-rw-r--r--tests/samplebinding/modifications_test.py4
-rw-r--r--tests/samplebinding/typesystem_sample.xml6
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/samplebinding/modifications_test.py b/tests/samplebinding/modifications_test.py
index 3cb502ce6..bc7b38dfa 100644
--- a/tests/samplebinding/modifications_test.py
+++ b/tests/samplebinding/modifications_test.py
@@ -154,5 +154,9 @@ class ModificationsTest(unittest.TestCase):
self.assertEqual(obj, self.mods.getObject())
self.assertEqual(obj.objectName(), 'MyObject')
+ def testInjectCodeWithConversionVariableForUserPrimitive(self):
+ self.assertTrue(Modifications.invertBoolean(False))
+ self.assertFalse(Modifications.invertBoolean(True))
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 0209aedd4..56ef0d6cf 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -742,6 +742,12 @@
%PYARG_0 = Shiboken::makeTuple(%0, tmpObject);
</inject-code>
</modify-function>
+ <modify-function signature="passOddBool(OddBool)" rename="invertBoolean">
+ <inject-code class="target" position="beginning">
+ %RETURN_TYPE %0 = !%CPPSELF.%FUNCTION_NAME(%1);
+ %PYARG_0 = %CONVERTTOPYTHON[OddBool](%0);
+ </inject-code>
+ </modify-function>
</object-type>
<object-type name="AbstractModifications">