[gobject-introspection] tests: Add regression test for (transfer full) returning callbacks



commit 09daa28c5b4625b6f274b3b340bc85e33bef80b5
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jun 2 19:24:49 2015 +0200

    tests: Add regression test for (transfer full) returning callbacks
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750286

 tests/scanner/regress.c |   14 ++++++++++++++
 tests/scanner/regress.h |    8 ++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 8a0652f..7669186 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -3438,6 +3438,20 @@ regress_test_callback_user_data (RegressTestCallbackUserData callback,
   return callback(user_data);
 }
 
+/**
+ * regress_test_callback_return_full:
+ * @callback: (scope call):
+ *
+ **/
+void
+regress_test_callback_return_full (RegressTestCallbackReturnFull callback)
+{
+  RegressTestObj *obj;
+
+  obj = callback ();
+  g_object_unref (obj);
+}
+
 static GSList *notified_callbacks = NULL;
 
 /**
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 9bef3c8..5174073 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -1042,6 +1042,11 @@ typedef void (*RegressTestCallbackOwnedGError) (GError *error);
  */
 typedef int (*RegressTestCallbackFull) (int foo, double bar, char *path);
 /**
+ * RegressTestCallbackReturnFull:
+ * Return value: (transfer full):
+ */
+typedef RegressTestObj *(*RegressTestCallbackReturnFull) (void);
+/**
  * RegressTestCallbackArray:
  * @one: (array length=one_length):
  * @one_length:
@@ -1076,6 +1081,9 @@ int regress_test_callback_user_data (RegressTestCallbackUserData callback,
                              gpointer user_data);
 
 _GI_TEST_EXTERN
+void regress_test_callback_return_full (RegressTestCallbackReturnFull callback);
+
+_GI_TEST_EXTERN
 int regress_test_callback_destroy_notify (RegressTestCallbackUserData callback,
                                   gpointer user_data,
                                   GDestroyNotify notify);


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