[pygobject] Test virtual methods with in and out arguments



commit 93e9e309d8ba54884881cfca203e8bc355c2727e
Author: Martin Pitt <martinpitt gnome org>
Date:   Wed Nov 21 12:58:07 2012 +0100

    Test virtual methods with in and out arguments
    
    ... and both caller and callee out argument allocation.
    
    This came up in https://bugzilla.gnome.org/show_bug.cgi?id=688783

 tests/test_gi.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 4837204..dc636c3 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -1916,6 +1916,15 @@ class TestPythonGObject(unittest.TestCase):
         def do_method_int8_out(self):
             return 42
 
+        def do_method_int8_arg_and_out_caller(self, arg):
+            return arg + 1
+
+        def do_method_int8_arg_and_out_callee(self, arg):
+            return arg + 1
+
+        def do_method_str_arg_out_ret(self, arg):
+            return (arg.upper(), len(arg))
+
         def do_method_with_default_implementation(self, int8):
             GIMarshallingTests.Object.do_method_with_default_implementation(self, int8)
             self.props.int += int8
@@ -1971,6 +1980,10 @@ class TestPythonGObject(unittest.TestCase):
         self.assertEqual(object_.val, 84)
         self.assertEqual(object_.method_int8_out(), 42)
 
+        self.assertEqual(object_.method_int8_arg_and_out_caller(42), 43)
+        self.assertEqual(object_.method_int8_arg_and_out_callee(42), 43)
+        self.assertEqual(object_.method_str_arg_out_ret('hello'), ('HELLO', 5))
+
         object_.method_with_default_implementation(42)
         self.assertEqual(object_.props.int, 84)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]