diff options
author | Colin Walters <walters@verbum.org> | 2005-07-10 22:54:19 +0000 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2005-07-10 22:54:19 +0000 |
commit | 8c095eea8fbe2f8c219bdb2aebcf61e4e3993f53 (patch) | |
tree | af9030f8b45381f290c89b793e067a588c6d6353 /test/glib/test-dbus-glib.c | |
parent | 745b19d640e657118b298c6b7cc37798af878a5a (diff) |
2005-07-10 Colin Walters <walters@verbum.org>
* doc/TODO: Knock off some GLib items with this patch.
* glib/dbus-gvalue-utils.c (_dbus_gtype_can_signal_error)
(_dbus_gvalue_signals_error): New functions.
* glib/dbus-gvalue-utils.h: Prototype them.
* glib/dbus-gobject.c (arg_iterate): Update to handle return vals
and change to not output const/retval flags for input args. All
callers updated.
(invoke_object_method): Refactor to handle return values. Add
some more comments in various places. Remove debug g_print.
* glib/dbus-binding-tool-glib.h (DBUS_GLIB_ANNOTATION_RETURNVAL): New.
* glib/dbus-binding-tool-glib.c (dbus_g_type_get_marshal_name):
Handle G_TYPE_NONE.
(compute_gsignature): New function; refactored from code from
compute_marshaller and compute_marshaller_name. Enhance to
handle return values and async ops more cleanly. Update for
async ops returning NONE instead of BOOLEAN.
(compute_marshaller, compute_marshaller_name): Call compute_gsignature
and output appropriate string.
(generate_glue): Handle return value annotation. Also don't dump
constness flag for input arguments.
* glib/Makefile.am (DBUS_GLIB_INTERNALS): New variable; contains
files shared between installed library and utilities.
(libdbus_glib_1_la_SOURCES): Move some stuf into DBUS_GLIB_INTERNALS.
(libdbus_gtool_la_SOURCES): Suck in DBUS_GLIB_INTERNALS so the
binding tool can access gtype utility functions.
* test/glib/test-service-glib.c:
* test/glib/test-service-glib.xml:
* test/glib/test-dbus-glib.c: Add some tests for return values.
Diffstat (limited to 'test/glib/test-dbus-glib.c')
-rw-r--r-- | test/glib/test-dbus-glib.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/test/glib/test-dbus-glib.c b/test/glib/test-dbus-glib.c index 4fbe797e..786235de 100644 --- a/test/glib/test-dbus-glib.c +++ b/test/glib/test-dbus-glib.c @@ -504,11 +504,11 @@ main (int argc, char **argv) G_TYPE_UINT, &v_UINT32_2, G_TYPE_INVALID)) lose_gerror ("Failed to complete Increment call", error); - g_assert (n_times_echo_cb_entered == 1); - if (v_UINT32_2 != 43) lose ("Increment call returned %d, should be 43", v_UINT32_2); + v_UINT32_2 = 0; + g_print ("Calling Increment (async)\n"); call = dbus_g_proxy_begin_call (proxy, "Increment", increment_received_cb, g_strdup ("moo"), g_free, G_TYPE_UINT, 42, @@ -517,6 +517,30 @@ main (int argc, char **argv) exit_timeout = g_timeout_add (5000, timed_exit, loop); g_main_loop_run (loop); + g_print ("Calling IncrementRetval\n"); + error = NULL; + v_UINT32_2 = 0; + if (!dbus_g_proxy_call (proxy, "IncrementRetval", &error, + G_TYPE_UINT, 42, + G_TYPE_INVALID, + G_TYPE_UINT, &v_UINT32_2, + G_TYPE_INVALID)) + lose_gerror ("Failed to complete Increment call", error); + if (v_UINT32_2 != 43) + lose ("IncrementRetval call returned %d, should be 43", v_UINT32_2); + + g_print ("Calling IncrementRetvalError\n"); + error = NULL; + v_UINT32_2 = 0; + if (!dbus_g_proxy_call (proxy, "IncrementRetvalError", &error, + G_TYPE_UINT, 5, + G_TYPE_INVALID, + G_TYPE_UINT, &v_UINT32_2, + G_TYPE_INVALID)) + lose_gerror ("Failed to complete Increment call", error); + if (v_UINT32_2 != 6) + lose ("IncrementRetval call returned %d, should be 6", v_UINT32_2); + g_print ("Calling ThrowError\n"); if (dbus_g_proxy_call (proxy, "ThrowError", &error, G_TYPE_INVALID, G_TYPE_INVALID) != FALSE) @@ -529,6 +553,19 @@ main (int argc, char **argv) g_print ("ThrowError failed (as expected) returned error: %s\n", error->message); g_clear_error (&error); + g_print ("Calling IncrementRetvalError (for error)\n"); + error = NULL; + v_UINT32_2 = 0; + if (dbus_g_proxy_call (proxy, "IncrementRetvalError", &error, + G_TYPE_UINT, 20, + G_TYPE_INVALID, + G_TYPE_UINT, &v_UINT32_2, + G_TYPE_INVALID) != FALSE) + lose ("IncrementRetvalError call unexpectedly succeeded!"); + if (!dbus_g_error_has_name (error, "org.freedesktop.DBus.Tests.MyObject.Foo")) + lose ("IncrementRetvalError call returned unexpected error \"%s\": %s", dbus_g_error_get_name (error), error->message); + g_clear_error (&error); + error = NULL; g_print ("Calling Uppercase\n"); if (!dbus_g_proxy_call (proxy, "Uppercase", &error, |