diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-08-10 00:59:19 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:17:10 -0300 |
commit | 9c6b541ceef3039e9e19a1d9a12223851a849cf6 (patch) | |
tree | f3bf84cc9b86205fa2f7d7d5951b1e2dff29fcdd /tests/samplebinding | |
parent | 711ee3d4169acca59b87df61b9ccb26d74a329b4 (diff) |
Improved the generation of argument conversion in modified functions.
Added the SBK_UNUSED macro to libshiboken to prevent compilation warnings.
An unit test was added.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/samplebinding')
-rw-r--r-- | tests/samplebinding/modifications_test.py | 6 | ||||
-rw-r--r-- | tests/samplebinding/typesystem_sample.xml | 15 |
2 files changed, 20 insertions, 1 deletions
diff --git a/tests/samplebinding/modifications_test.py b/tests/samplebinding/modifications_test.py index 344801015..3cb502ce6 100644 --- a/tests/samplebinding/modifications_test.py +++ b/tests/samplebinding/modifications_test.py @@ -148,5 +148,11 @@ class ModificationsTest(unittest.TestCase): self.assertEqual(self.mods.sumPointCoordinates(point), 12 + 34) self.assertRaises(TypeError, self.mods.sumPointCoordinates, None) + def testNonConversionRuleForArgumentWithDefaultValue(self): + status, obj = self.mods.nonConversionRuleForArgumentWithDefaultValue() + self.assert_(status) + self.assertEqual(obj, self.mods.getObject()) + self.assertEqual(obj.objectName(), 'MyObject') + if __name__ == '__main__': unittest.main() diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml index dc4faf352..4f1d5481b 100644 --- a/tests/samplebinding/typesystem_sample.xml +++ b/tests/samplebinding/typesystem_sample.xml @@ -728,6 +728,19 @@ <no-null-pointer/> </modify-argument> </modify-function> + <modify-function signature="nonConversionRuleForArgumentWithDefaultValue(ObjectType**)"> + <modify-argument index="1"> + <remove-argument/> + </modify-argument> + <modify-argument index="return"> + <replace-type modified-type="(status, object)"/> + </modify-argument> + <inject-code class="target" position="beginning"> + ObjectType* tmpObject = 0; + %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(&tmpObject); + %PYARG_0 = Shiboken::makeTuple(%0, tmpObject); + </inject-code> + </modify-function> </object-type> <object-type name="AbstractModifications"> @@ -1761,4 +1774,4 @@ <!-- Do not fix this warning, the generator should be able to handle this situation for Object Types. --> <suppress-warning text="Argument in position 1 of added function 'SampleNamespace::passReferenceToObjectType(ObjectType * arg__1)', has a type that is not a reference, while the argument in the corresponding position in C++ function 'SampleNamespace::passReferenceToObjectType(const ObjectType & obj, int multiplier)' is a reference." /> -</typesystem>
\ No newline at end of file +</typesystem> |