aboutsummaryrefslogtreecommitdiffstats
path: root/tests/samplebinding/ownership_invalidate_after_use_test.py
diff options
context:
space:
mode:
authorJohn Ehresman <jpe@wingware.com>2012-06-07 20:44:19 -0400
committerMarcelo Lira <marcelo.lira@openbossa.org>2012-06-14 20:20:21 +0200
commite40e993cecd1663636e2f0d33b3e2a6204d64984 (patch)
tree172ed7dbfc535fd6113c8707a82e02647aaec7dc /tests/samplebinding/ownership_invalidate_after_use_test.py
parent54cce10fa8a9942450c9e1a9d9a9d2a1b688f243 (diff)
Find function modifications defined in the 2nd+ base class.
Fixes bug PYSIDE-54 Change-Id: Ic5c341741170cc77e8ebb59c46c746211582ddeb Reviewed-by: Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'tests/samplebinding/ownership_invalidate_after_use_test.py')
-rw-r--r--tests/samplebinding/ownership_invalidate_after_use_test.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/samplebinding/ownership_invalidate_after_use_test.py b/tests/samplebinding/ownership_invalidate_after_use_test.py
index 5a03fc470..194c7e77e 100644
--- a/tests/samplebinding/ownership_invalidate_after_use_test.py
+++ b/tests/samplebinding/ownership_invalidate_after_use_test.py
@@ -29,7 +29,7 @@
import sys
import unittest
-from sample import ObjectType, Event
+from sample import ObjectType, ObjectTypeDerived, Event
class ExtObjectType(ObjectType):
@@ -59,6 +59,16 @@ class MyObjectType (ObjectType):
def invalidateEvent(self, ev):
pass
+class ExtObjectTypeDerived(ObjectTypeDerived):
+ def __init__(self):
+ ObjectTypeDerived.__init__(self)
+ self.type_of_last_event = None
+ self.last_event = None
+ def event(self, event):
+ self.last_event = event
+ self.type_of_last_event = event.eventType()
+ return True
+
class OwnershipInvalidateAfterUseTest(unittest.TestCase):
'''Ownership tests for cases of invalidation of Python wrapper after use.'''
@@ -82,6 +92,14 @@ class OwnershipInvalidateAfterUseTest(unittest.TestCase):
obj.causeEvent(Event.BASIC_EVENT)
self.assertFalse(obj.fail)
+ def testInvalidateAfterUseInDerived(self):
+ '''Invalidate was failing in a derived C++ class that also inherited
+ other base classes'''
+ eot = ExtObjectTypeDerived()
+ eot.causeEvent(Event.SOME_EVENT)
+ self.assertEqual(eot.type_of_last_event, Event.SOME_EVENT)
+ self.assertRaises(RuntimeError, eot.last_event.eventType)
+
if __name__ == '__main__':
unittest.main()