[gobject-introspection/wip/gobj-kitchen-sink: 5/5] tests: Add marshalling tests for various kinds of callbacks
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/gobj-kitchen-sink: 5/5] tests: Add marshalling tests for various kinds of callbacks
- Date: Fri, 3 Feb 2012 16:53:20 +0000 (UTC)
commit 3c0cfdc992caa5c19a7e2f0820dc5286a7e14dbb
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Feb 3 10:54:19 2012 -0500
tests: Add marshalling tests for various kinds of callbacks
tests/gimarshallingtests.c | 65 ++++++++++++++++++++++++++++++++++++++++++++
tests/gimarshallingtests.h | 51 +++++++++++++++++++++++++++++++++-
2 files changed, 115 insertions(+), 1 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index b57f36d..196b739 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -3057,6 +3057,71 @@ gi_marshalling_tests_gclosure_return (void)
return closure;
}
+
+/**
+ * gi_marshalling_tests_callback_return_value_only:
+ * @callback: (scope call):
+ */
+glong
+gi_marshalling_tests_callback_return_value_only (GIMarshallingTestsCallbackReturnValueOnly callback)
+{
+ return callback ();
+}
+
+/**
+ * gi_marshalling_tests_callback_one_out_parameter:
+ * @callback: (scope call):
+ * @a: (out):
+ */
+void
+gi_marshalling_tests_callback_one_out_parameter (GIMarshallingTestsCallbackOneOutParameter callback,
+ gfloat *a)
+{
+ callback (a);
+}
+
+/**
+ * gi_marshalling_tests_callback_multiple_out_parameters:
+ * @callback: (scope call):
+ * @a: (out):
+ * @b: (out):
+ */
+void
+gi_marshalling_tests_callback_multiple_out_parameters (GIMarshallingTestsCallbackMultipleOutParameters callback,
+ gfloat *a,
+ gfloat *b)
+{
+ callback (a, b);
+}
+
+/**
+ * gi_marshalling_tests_callback_return_value_and_one_out_parameter:
+ * @callback: (scope call):
+ * @a: (out):
+ */
+glong
+gi_marshalling_tests_callback_return_value_and_one_out_parameter (GIMarshallingTestsCallbackReturnValueAndOneOutParameter callback,
+ glong *a)
+{
+ return callback (a);
+}
+
+/**
+ * gi_marshalling_tests_callback_return_value_and_multiple_out_parameters:
+ * @callback: (scope call):
+ * @a: (out):
+ * @b: (out):
+ */
+glong
+gi_marshalling_tests_callback_return_value_and_multiple_out_parameters (GIMarshallingTestsCallbackReturnValueAndMultipleOutParameters callback,
+ glong *a,
+ glong *b)
+{
+ return callback (a, b);
+}
+
+
+
/**
* gi_marshalling_tests_pointer_in_return:
*
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index d5ddd3f..3a2fd12 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -547,6 +547,55 @@ GValue *gi_marshalling_tests_gvalue_flat_array_round_trip (const GValue one,
void gi_marshalling_tests_gclosure_in (GClosure *closure);
GClosure *gi_marshalling_tests_gclosure_return (void);
+/* Callback return values */
+
+/**
+ * GIMarshallingTestsCallbackReturnValueOnly:
+ */
+typedef glong (* GIMarshallingTestsCallbackReturnValueOnly) ();
+
+glong gi_marshalling_tests_callback_return_value_only (GIMarshallingTestsCallbackReturnValueOnly callback);
+
+/**
+ * GIMarshallingTestsCallbackOneOutParameter:
+ * @a: (out):
+ */
+typedef void (* GIMarshallingTestsCallbackOneOutParameter) (gfloat *a);
+
+void gi_marshalling_tests_callback_one_out_parameter (GIMarshallingTestsCallbackOneOutParameter callback,
+ gfloat *a);
+
+/**
+ * GIMarshallingTestsCallbackMultipleOutParameters:
+ * @a: (out):
+ * @b: (out):
+ */
+typedef void (* GIMarshallingTestsCallbackMultipleOutParameters) (gfloat *a, gfloat *b);
+
+void gi_marshalling_tests_callback_multiple_out_parameters (GIMarshallingTestsCallbackMultipleOutParameters callback,
+ gfloat *a,
+ gfloat *b);
+
+/**
+ * GIMarshallingTestsCallbackReturnValueAndOneOutParameter:
+ * @a: (out):
+ */
+typedef glong (* GIMarshallingTestsCallbackReturnValueAndOneOutParameter) (glong *a);
+
+glong gi_marshalling_tests_callback_return_value_and_one_out_parameter (GIMarshallingTestsCallbackReturnValueAndOneOutParameter callback,
+ glong *a);
+
+/**
+ * GIMarshallingTestsCallbackReturnValueAndMultipleOutParameters:
+ * @a: (out):
+ * @b: (out):
+ */
+typedef glong (* GIMarshallingTestsCallbackReturnValueAndMultipleOutParameters) (glong *a, glong *b);
+
+glong gi_marshalling_tests_callback_return_value_and_multiple_out_parameters (GIMarshallingTestsCallbackReturnValueAndMultipleOutParameters callback,
+ glong *a,
+ glong *b);
+
/* Pointer */
gpointer gi_marshalling_tests_pointer_in_return (gpointer pointer);
@@ -617,7 +666,7 @@ void gi_marshalling_tests_union_inout (GIMarshallingTestsUnion **union_);
void gi_marshalling_tests_union_method (GIMarshallingTestsUnion *union_);
-/* Object */
+ /* Object */
#define GI_MARSHALLING_TESTS_TYPE_OBJECT (gi_marshalling_tests_object_get_type ())
#define GI_MARSHALLING_TESTS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GI_MARSHALLING_TESTS_TYPE_OBJECT, GIMarshallingTestsObject))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]