gobject-introspection r954 - in trunk: . tests/everything
- From: jobi svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r954 - in trunk: . tests/everything
- Date: Thu, 20 Nov 2008 11:54:05 +0000 (UTC)
Author: jobi
Date: Thu Nov 20 11:54:05 2008
New Revision: 954
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=954&view=rev
Log:
2008-11-20 Johan Bilien <jobi via ecp fr>
* tests/everything/everything.[ch]: add a test function which calls a
closure.
Modified:
trunk/ChangeLog
trunk/tests/everything/everything.c
trunk/tests/everything/everything.h
Modified: trunk/tests/everything/everything.c
==============================================================================
--- trunk/tests/everything/everything.c (original)
+++ trunk/tests/everything/everything.c Thu Nov 20 11:54:05 2008
@@ -94,6 +94,49 @@
return in;
}
+int test_closure (GClosure *closure)
+{
+ GValue return_value = {0, };
+ int ret;
+
+ g_value_init (&return_value, G_TYPE_INT);
+
+ g_closure_invoke (closure,
+ &return_value,
+ 0, NULL,
+ NULL);
+
+ ret = g_value_get_int (&return_value);
+
+ g_value_unset(&return_value);
+
+ return ret;
+}
+
+int test_closure_one_arg (GClosure *closure, int arg)
+{
+ GValue return_value = {0, };
+ GValue arguments[1];
+ int ret;
+
+ g_value_init (&return_value, G_TYPE_INT);
+
+ g_value_init (&arguments[0], G_TYPE_INT);
+ g_value_set_int (&arguments[0], arg);
+
+ g_closure_invoke (closure,
+ &return_value,
+ 1, arguments,
+ NULL);
+
+ ret = g_value_get_int (&return_value);
+
+ g_value_unset(&return_value);
+ g_value_unset(&arguments[0]);
+
+ return ret;
+}
+
#if 0
/************************************************************************/
/* utf8 */
Modified: trunk/tests/everything/everything.h
==============================================================================
--- trunk/tests/everything/everything.h (original)
+++ trunk/tests/everything/everything.h Thu Nov 20 11:54:05 2008
@@ -65,6 +65,10 @@
/* ghash? */
/* error? */
+/* closure */
+int test_closure (GClosure *closure);
+int test_closure_one_arg (GClosure *closure, int arg);
+
/* enums / flags */
typedef enum
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]