summaryrefslogtreecommitdiffstats
path: root/test/glib/test-dbus-glib.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2005-07-24 18:04:23 +0000
committerColin Walters <walters@verbum.org>2005-07-24 18:04:23 +0000
commit9ca6f45e86f1e1839967821261c55083becfa40a (patch)
tree1da04ba7b87261169dd2b84d453c6c56fce48bb6 /test/glib/test-dbus-glib.c
parentde689235e938f0060ecad6fa0ce1933b700f6e71 (diff)
2005-07-24 Colin Walters <walters@verbum.org>
* glib/dbus-gvalue.c (signature_iter_to_g_type_array): Don't require typedata; recursive arrays won't have it. * test/glib/test-dbus-glib.c: * test/glib/test-service-glib.c: * test/glib/test-service-glib.xml: Add recursive arrays tests.
Diffstat (limited to 'test/glib/test-dbus-glib.c')
-rw-r--r--test/glib/test-dbus-glib.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/glib/test-dbus-glib.c b/test/glib/test-dbus-glib.c
index 962db15e..368a5762 100644
--- a/test/glib/test-dbus-glib.c
+++ b/test/glib/test-dbus-glib.c
@@ -974,6 +974,57 @@ main (int argc, char **argv)
}
{
+ GPtrArray *in_array;
+ GPtrArray *out_array;
+ char **strs;
+ GArray *uints;
+
+ in_array = g_ptr_array_new ();
+
+ strs = g_new0 (char *, 3);
+ strs[0] = "foo";
+ strs[1] = "bar";
+ strs[2] = NULL;
+ g_ptr_array_add (in_array, strs);
+
+ strs = g_new0 (char *, 4);
+ strs[0] = "baz";
+ strs[1] = "whee";
+ strs[2] = "moo";
+ strs[3] = NULL;
+ g_ptr_array_add (in_array, strs);
+
+ out_array = NULL;
+ g_print ("Calling RecArrays\n");
+ if (!dbus_g_proxy_call (proxy, "RecArrays", &error,
+ dbus_g_type_get_collection ("GPtrArray", G_TYPE_STRV), in_array,
+ G_TYPE_INVALID,
+ dbus_g_type_get_collection ("GPtrArray",
+ dbus_g_type_get_collection ("GPtrArray",
+ G_TYPE_UINT)), &out_array,
+ G_TYPE_INVALID))
+ lose_gerror ("Failed to complete RecArrays call", error);
+ g_free (g_ptr_array_index (in_array, 0));
+ g_free (g_ptr_array_index (in_array, 1));
+
+ g_assert (out_array);
+ g_assert (out_array->len == 2);
+ uints = g_ptr_array_index (out_array, 0);
+ g_assert (uints);
+ g_assert (uints->len == 3);
+ g_assert (g_array_index (uints, guint, 0) == 10);
+ g_assert (g_array_index (uints, guint, 1) == 42);
+ g_assert (g_array_index (uints, guint, 2) == 27);
+ g_array_free (uints, TRUE);
+ uints = g_ptr_array_index (out_array, 1);
+ g_assert (uints);
+ g_assert (uints->len == 1);
+ g_assert (g_array_index (uints, guint, 0) == 30);
+ g_array_free (uints, TRUE);
+ g_ptr_array_free (out_array, TRUE);
+ }
+
+ {
guint val;
char *ret_path;
DBusGProxy *ret_proxy;