Skip to content
Browse files

tests: Add marshalling tests for various kinds of callbacks

  • Loading branch information...
1 parent e089f74 commit 3c0cfdc992caa5c19a7e2f0820dc5286a7e14dbb @magcius magcius committed Feb 3, 2012
Showing with 115 additions and 1 deletion.
  1. +65 −0 tests/gimarshallingtests.c
  2. +50 −1 tests/gimarshallingtests.h
View
65 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:
*
View
51 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))

0 comments on commit 3c0cfdc

Please sign in to comment.
Something went wrong with that request. Please try again.