[gobject-introspection] Add new tests for multiple callback calls during function invokation for scope call



commit 77e818f218b91310cfc5a092755594bd839ea24d
Author: Zach Goldberg <zach zachgoldberg com>
Date:   Tue Apr 20 22:34:15 2010 -0400

    Add new tests for multiple callback calls during function invokation for scope call
    
    https://bugzilla.gnome.org/show_bug.cgi?id=616354

 gir/Everything-1.0-expected.gir |   13 +++++++++++++
 gir/everything.c                |   19 +++++++++++++++++++
 gir/everything.h                |    1 +
 3 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index 9f4a49d..150505e 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -1538,6 +1538,19 @@ call and can be released on return.">
         </parameter>
       </parameters>
     </function>
+    <function name="test_multi_callback" c:identifier="test_multi_callback">
+      <return-value transfer-ownership="none">
+        <type name="int" c:type="int"/>
+      </return-value>
+      <parameters>
+        <parameter name="callback"
+                   transfer-ownership="none"
+                   allow-none="1"
+                   scope="call">
+          <type name="TestCallback" c:type="TestCallback"/>
+        </parameter>
+      </parameters>
+    </function>
     <function name="test_multi_double_args"
               c:identifier="test_multi_double_args">
       <return-value transfer-ownership="none">
diff --git a/gir/everything.c b/gir/everything.c
index 5e4aaaa..8ebac9e 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -1833,6 +1833,25 @@ test_callback (TestCallback callback)
 }
 
 /**
+ * test_multi_callback:
+ * @callback: (scope call) (allow-none):
+ *
+ **/
+int
+test_multi_callback (TestCallback callback)
+{
+    int sum = 0;
+    if (callback != NULL) {
+        sum += callback();
+        sum += callback();
+    }
+
+    return sum;
+}
+
+
+
+/**
  * test_simple_callback:
  * @callback: (scope call) (allow-none):
  *
diff --git a/gir/everything.h b/gir/everything.h
index c20d88e..75cee29 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -335,6 +335,7 @@ typedef int (*TestCallbackUserData) (gpointer user_data);
 
 void test_simple_callback (TestSimpleCallback callback);
 int test_callback (TestCallback callback);
+int test_multi_callback (TestCallback callback);
 int test_callback_user_data (TestCallbackUserData callback,
                              gpointer user_data);
 int test_callback_destroy_notify (TestCallbackUserData callback,



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