[pygobject] tests: Add more vfunc checks for GIMarshallingTestsObject



commit bac9d526f6a9774821d1c9c0e7b35cc6db942975
Author: Martin Pitt <martinpitt gnome org>
Date:   Fri Jun 1 12:28:53 2012 +0200

    tests: Add more vfunc checks for GIMarshallingTestsObject

 tests/test_gi.py |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_gi.py b/tests/test_gi.py
index eac5e49..b718815 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -1614,6 +1614,21 @@ class TestPythonGObject(unittest.TestCase):
             GIMarshallingTests.Object.do_method_with_default_implementation(self, int8)
             self.props.int += int8
 
+        def do_vfunc_return_value_only(self):
+            return 4242
+
+        def do_vfunc_one_out_parameter(self):
+            return 42.42
+
+        def do_vfunc_multiple_out_parameters(self):
+            return (42.42, 3.14)
+
+        def do_vfunc_return_value_and_one_out_parameter(self):
+            return (5, 42)
+
+        def do_vfunc_return_value_and_multiple_out_parameters(self):
+            return (5, 42, 99)
+
     class SubObject(GIMarshallingTests.SubObject):
         def __init__(self, int):
             GIMarshallingTests.SubObject.__init__(self)
@@ -1640,6 +1655,16 @@ class TestPythonGObject(unittest.TestCase):
         object_.method_with_default_implementation(42)
         self.assertEqual(object_.props.int, 84)
 
+        self.assertEqual(object_.vfunc_return_value_only(), 4242)
+        self.assertAlmostEqual(object_.vfunc_one_out_parameter(), 42.42, places=5)
+
+        (a, b) = object_.vfunc_multiple_out_parameters()
+        self.assertAlmostEqual(a, 42.42, places=5)
+        self.assertAlmostEqual(b, 3.14, places=5)
+
+        self.assertEqual(object_.vfunc_return_value_and_one_out_parameter(), (5, 42))
+        self.assertEqual(object_.vfunc_return_value_and_multiple_out_parameters(), (5, 42, 99))
+
         class ObjectWithoutVFunc(GIMarshallingTests.Object):
             def __init__(self, int):
                 GIMarshallingTests.Object.__init__(self)



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