diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libother/otherderived.cpp | 6 | ||||
-rw-r--r-- | tests/libother/otherderived.h | 1 | ||||
-rw-r--r-- | tests/libsample/abstract.h | 1 | ||||
-rw-r--r-- | tests/libsample/derived.cpp | 7 | ||||
-rw-r--r-- | tests/libsample/derived.h | 1 | ||||
-rwxr-xr-x | tests/samplebinding/abstract_test.py | 11 |
6 files changed, 27 insertions, 0 deletions
diff --git a/tests/libother/otherderived.cpp b/tests/libother/otherderived.cpp index 10529ee2d..5659fe0cf 100644 --- a/tests/libother/otherderived.cpp +++ b/tests/libother/otherderived.cpp @@ -54,6 +54,12 @@ OtherDerived::pureVirtual() { } +void* +OtherDerived::pureVirtualReturningVoidPtr() +{ + return 0; +} + void OtherDerived::unpureVirtual() { diff --git a/tests/libother/otherderived.h b/tests/libother/otherderived.h index ff425da53..4aae12aa9 100644 --- a/tests/libother/otherderived.h +++ b/tests/libother/otherderived.h @@ -49,6 +49,7 @@ public: OtherDerived(int id = -1); virtual ~OtherDerived(); virtual void pureVirtual(); + virtual void* pureVirtualReturningVoidPtr(); virtual void unpureVirtual(); virtual PrintFormat returnAnEnum() { return Short; } diff --git a/tests/libsample/abstract.h b/tests/libsample/abstract.h index 008570560..cdfbb30fb 100644 --- a/tests/libsample/abstract.h +++ b/tests/libsample/abstract.h @@ -70,6 +70,7 @@ public: static int getObjectId(Abstract* obj) { return obj->id(); } virtual void pureVirtual() = 0; + virtual void* pureVirtualReturningVoidPtr() = 0; virtual void unpureVirtual(); virtual PrintFormat returnAnEnum() = 0; diff --git a/tests/libsample/derived.cpp b/tests/libsample/derived.cpp index 1a19fe137..1e8303692 100644 --- a/tests/libsample/derived.cpp +++ b/tests/libsample/derived.cpp @@ -57,6 +57,12 @@ Derived::pureVirtual() { } +void* +Derived::pureVirtualReturningVoidPtr() +{ + return 0; +} + void Derived::unpureVirtual() { @@ -100,6 +106,7 @@ Derived::otherOverloaded(int a, double b) struct SecretClass : public Abstract { virtual void pureVirtual() {} + virtual void* pureVirtualReturningVoidPtr() { return 0; } virtual PrintFormat returnAnEnum() { return Short; } }; diff --git a/tests/libsample/derived.h b/tests/libsample/derived.h index c5acb9488..e6d3f0fb3 100644 --- a/tests/libsample/derived.h +++ b/tests/libsample/derived.h @@ -61,6 +61,7 @@ public: Derived(int id = -1); virtual ~Derived(); virtual void pureVirtual(); + virtual void* pureVirtualReturningVoidPtr(); virtual void unpureVirtual(); virtual PrintFormat returnAnEnum() { return Short; } 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() |