summaryrefslogtreecommitdiffstats
path: root/tests/samplebinding
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-09-16 19:12:33 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2010-09-17 10:29:00 -0300
commit42a3b42f8a00e94dd10e786210739fee7878cf51 (patch)
tree99979228e8fcdb3dfae6b4c70d36d5a35e300650 /tests/samplebinding
parent4914a426267dd6f6cf852445f071650b5c0f7971 (diff)
downloadshiboken-42a3b42f8a00e94dd10e786210739fee7878cf51.tar.gz
shiboken-42a3b42f8a00e94dd10e786210739fee7878cf51.tar.xz
shiboken-42a3b42f8a00e94dd10e786210739fee7878cf51.zip
Fix bug#339 - "RuntimeError when accessing mousepress event object"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Lauro Moura <lauro.filho@openbossa.org>
Diffstat (limited to 'tests/samplebinding')
-rw-r--r--tests/samplebinding/ownership_invalidate_after_use_test.py21
-rw-r--r--tests/samplebinding/typesystem_sample.xml3
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/samplebinding/ownership_invalidate_after_use_test.py b/tests/samplebinding/ownership_invalidate_after_use_test.py
index 80f252d5..5a03fc47 100644
--- a/tests/samplebinding/ownership_invalidate_after_use_test.py
+++ b/tests/samplebinding/ownership_invalidate_after_use_test.py
@@ -42,6 +42,22 @@ class ExtObjectType(ObjectType):
self.type_of_last_event = event.eventType()
return True
+class MyObjectType (ObjectType):
+ def __init__(self):
+ super(MyObjectType, self).__init__()
+ self.fail = False
+
+ def event(self, ev):
+ self.callInvalidateEvent(ev)
+ try:
+ ev.eventType()
+ except:
+ self.fail = True
+ raise
+ return True
+
+ def invalidateEvent(self, ev):
+ pass
class OwnershipInvalidateAfterUseTest(unittest.TestCase):
'''Ownership tests for cases of invalidation of Python wrapper after use.'''
@@ -61,6 +77,11 @@ class OwnershipInvalidateAfterUseTest(unittest.TestCase):
self.assertEqual(eot.type_of_last_event, Event.ANY_EVENT)
self.assertRaises(RuntimeError, ot.event, eot.last_event)
+ def testit(self):
+ obj = MyObjectType()
+ obj.causeEvent(Event.BASIC_EVENT)
+ self.assertFalse(obj.fail)
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index de262c9e..40b70ab4 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -141,6 +141,9 @@
<modify-function signature="event(Event*)">
<modify-argument index="1" invalidate-after-use="yes"/>
</modify-function>
+ <modify-function signature="invalidateEvent(Event*)">
+ <modify-argument index="1" invalidate-after-use="yes"/>
+ </modify-function>
<modify-function signature="create()">
<modify-argument index="return">
<define-ownership owner="target"/>