diff options
author | Renato Filho <renato.filho@openbossa.org> | 2010-07-27 10:07:18 -0300 |
---|---|---|
committer | Renato Filho <renato.filho@openbossa.org> | 2010-07-27 10:08:29 -0300 |
commit | 1b4094837f983d6273a81daffc5bbffedc82cf2c (patch) | |
tree | b780d13e3aa566df6e9287584f96023fb4f71bac /tests/samplebinding | |
parent | 8a16ff951633c3755cf370228709afaf416b0407 (diff) |
Fix char* converter
Fix tests.
Created warnning about return last ref of python object.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/samplebinding')
-rw-r--r-- | tests/samplebinding/protected_test.py | 10 | ||||
-rw-r--r-- | tests/samplebinding/typesystem_sample.xml | 6 |
2 files changed, 10 insertions, 6 deletions
diff --git a/tests/samplebinding/protected_test.py b/tests/samplebinding/protected_test.py index 356df1f7c..88ac5b59f 100644 --- a/tests/samplebinding/protected_test.py +++ b/tests/samplebinding/protected_test.py @@ -40,7 +40,8 @@ class ExtendedProtectedPolymorphic(ProtectedPolymorphic): self.protectedName_called = False def protectedName(self): self.protectedName_called = True - return 'Extended' + ProtectedPolymorphic.protectedName(self) + self._name = 'Extended' + ProtectedPolymorphic.protectedName(self) + return self._name class ExtendedProtectedPolymorphicDaughter(ProtectedPolymorphicDaughter): def __init__(self, name): @@ -48,7 +49,8 @@ class ExtendedProtectedPolymorphicDaughter(ProtectedPolymorphicDaughter): ProtectedPolymorphicDaughter.__init__(self, name) def protectedName(self): self.protectedName_called = True - return 'ExtendedDaughter' + ProtectedPolymorphicDaughter.protectedName(self) + self._name = 'ExtendedDaughter' + ProtectedPolymorphicDaughter.protectedName(self) + return self._name class ExtendedProtectedPolymorphicGrandDaughter(ProtectedPolymorphicGrandDaughter): def __init__(self, name): @@ -56,7 +58,8 @@ class ExtendedProtectedPolymorphicGrandDaughter(ProtectedPolymorphicGrandDaughte ProtectedPolymorphicGrandDaughter.__init__(self, name) def protectedName(self): self.protectedName_called = True - return 'ExtendedGrandDaughter' + ProtectedPolymorphicGrandDaughter.protectedName(self) + self._name = 'ExtendedGrandDaughter' + ProtectedPolymorphicGrandDaughter.protectedName(self) + return self._name class ExtendedProtectedVirtualDestructor(ProtectedVirtualDestructor): def __init__(self): @@ -125,6 +128,7 @@ class ProtectedPolymorphicDaugherTest(unittest.TestCase): original_name = 'Poly' p = ExtendedProtectedPolymorphicDaughter(original_name) name = p.callProtectedName() + print "MyName:", name self.assert_(p.protectedName_called) self.assertEqual(p.protectedName(), name) self.assertEqual(ProtectedPolymorphicDaughter.protectedName(p), original_name) diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml index 29e9e601d..77e5052e2 100644 --- a/tests/samplebinding/typesystem_sample.xml +++ b/tests/samplebinding/typesystem_sample.xml @@ -10,6 +10,7 @@ <primitive-type name="unsigned char"/> <primitive-type name="long"/> <primitive-type name="unsigned long"/> + <primitive-type name="std::string"/> <primitive-type name="Complex" target-lang-api-name="PyComplex"> <conversion-rule file="complex_conversions.h"/> @@ -754,11 +755,10 @@ </conversion-rule> <conversion-rule class="target"> - Shiboken::AutoDecRef __object__(PyList_New(count)); + PyObject *%out = PyList_New(count); for (int i=0; i < count; i++) { - PyList_SET_ITEM(__object__.object(), i, %CONVERTTOPYTHON[int](%in[i])); + PyList_SET_ITEM(%out, i, %CONVERTTOPYTHON[int](%in[i])); } - PyObject *%out = __object__.object(); </conversion-rule> </modify-argument> |