diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-12-29 18:26:44 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-12-29 19:13:39 -0200 |
commit | a24e6bcd2251b6cbd78ec4e69a2b6b591738e697 (patch) | |
tree | 54776f0352b3e84d4208bdecbaa5c36a1a2b90f0 /tests | |
parent | 304a8d46c162a3289da16ebcef839ff5c1b8697c (diff) | |
download | shiboken-a24e6bcd2251b6cbd78ec4e69a2b6b591738e697.tar.gz shiboken-a24e6bcd2251b6cbd78ec4e69a2b6b591738e697.tar.xz shiboken-a24e6bcd2251b6cbd78ec4e69a2b6b591738e697.zip |
Add support for operator overload injection.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/samplebinding/objecttypeoperators_test.py | 3 | ||||
-rw-r--r-- | tests/samplebinding/typesystem_sample.xml | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/tests/samplebinding/objecttypeoperators_test.py b/tests/samplebinding/objecttypeoperators_test.py index 148bc359..71e5a5d4 100644 --- a/tests/samplebinding/objecttypeoperators_test.py +++ b/tests/samplebinding/objecttypeoperators_test.py @@ -47,6 +47,9 @@ class ObjectTypeOperatorsTest(unittest.TestCase): self.assertEqual("a", a) self.assertEqual(a, "a") + def testOperatorInjection(self): + a = ObjectTypeOperators("a") + self.assertNotEqual(a, "b") if __name__ == '__main__': unittest.main() diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml index 576c5465..5a518c34 100644 --- a/tests/samplebinding/typesystem_sample.xml +++ b/tests/samplebinding/typesystem_sample.xml @@ -1274,7 +1274,13 @@ <object-type name="HandleHolder" /> - <object-type name="ObjectTypeOperators" /> + <object-type name="ObjectTypeOperators"> + <add-function signature="operator!=(std::string)" return-type="bool"> + <inject-code class="target"> + %PYARG_0 = %CONVERTTOPYTHON[bool](%CPPSELF.key() != %1); + </inject-code> + </add-function> + </object-type> <!-- type used in abstract method --> <object-type name="HideType" generate="no" /> |