From 21bcdc289ba9ece35780369a5e86a68498a6ddae Mon Sep 17 00:00:00 2001 From: Matti Airas Date: Wed, 17 Mar 2010 17:09:15 -0300 Subject: added support for pure virtual methods returning void ptrs the return statements now have correct values for pure virtual methods returning void pointers. also added a dummy test for this (can't really test it properly until the semantics of casting the python return value into a void pointer is properly defined -- if ever). --- tests/samplebinding/abstract_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/samplebinding') diff --git a/tests/samplebinding/abstract_test.py b/tests/samplebinding/abstract_test.py index 2488c6542..6c2f43f41 100755 --- a/tests/samplebinding/abstract_test.py +++ b/tests/samplebinding/abstract_test.py @@ -44,6 +44,9 @@ class Concrete(Abstract): def pureVirtual(self): self.pure_virtual_called = True + def pureVirtualReturningVoidPtr(self): + return 42 + def unpureVirtual(self): self.unpure_virtual_called = True @@ -67,6 +70,14 @@ class AbstractTest(unittest.TestCase): i = Incomplete() self.assertRaises(NotImplementedError, i.pureVirtual) + def testPureVirtualReturningVoidPtrReturnValue(self): + '''Test if a pure virtual method returning void ptr can be properly reimplemented''' + # Note that the semantics of reimplementing the pure virtual method in + # Python and calling it from C++ is undefined until it's decided how to + # cast the Python data types to void pointers + c = Concrete() + self.assertEqual(c.pureVirtualReturningVoidPtr(),42) + def testReimplementedVirtualMethodCall(self): '''Test if instanciation of an abstract class raises the correct exception.''' i = Concrete() -- cgit v1.2.3