From 0c6f2bbff503c10212589c1540d06b29395587aa Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 27 Jun 2005 18:20:20 +0000 Subject: 2005-06-27 Colin Walters * test/glib/test-dbus-glib.c: * test/glib/test-service-glib.c: * test/glib/test-service-glib.xml: Test hash table signal emitting. * glib/dbus-gobject.c (_dbus_gobject_lookup_marshaller): Convert types to their fundamental basis types, since this is what marshallers operate on. Also add an entry for VOID__BOXED. (dbus_g_object_register_marshaller_array): Convert to fundamental. --- test/glib/test-dbus-glib.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'test/glib/test-dbus-glib.c') diff --git a/test/glib/test-dbus-glib.c b/test/glib/test-dbus-glib.c index 94aeaeb3..59284913 100644 --- a/test/glib/test-dbus-glib.c +++ b/test/glib/test-dbus-glib.c @@ -14,6 +14,7 @@ static int n_times_foo_received = 0; static int n_times_frobnicate_received = 0; static int n_times_sig0_received = 0; static int n_times_sig1_received = 0; +static int n_times_sig2_received = 0; static guint exit_timeout = 0; static gboolean @@ -84,6 +85,24 @@ sig1_signal_handler (DBusGProxy *proxy, g_source_remove (exit_timeout); } +static void +sig2_signal_handler (DBusGProxy *proxy, + GHashTable *table, + void *user_data) +{ + n_times_sig2_received += 1; + + g_assert (g_hash_table_size (table) == 2); + + g_assert (g_hash_table_lookup (table, "baz") != NULL); + g_assert (!strcmp (g_hash_table_lookup (table, "baz"), "cow")); + g_assert (g_hash_table_lookup (table, "bar") != NULL); + g_assert (!strcmp (g_hash_table_lookup (table, "bar"), "foo")); + + g_main_loop_quit (loop); + g_source_remove (exit_timeout); +} + static void lose (const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2); static void lose_gerror (const char *prefix, GError *error) G_GNUC_NORETURN; @@ -721,7 +740,8 @@ main (int argc, char **argv) G_TYPE_NONE, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); dbus_g_proxy_add_signal (proxy, "Sig0", G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_add_signal (proxy, "Sig1", G_TYPE_STRING, G_TYPE_VALUE); + dbus_g_proxy_add_signal (proxy, "Sig1", G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); + dbus_g_proxy_add_signal (proxy, "Sig2", DBUS_TYPE_G_STRING_STRING_HASHTABLE, G_TYPE_INVALID); dbus_g_proxy_connect_signal (proxy, "Sig0", G_CALLBACK (sig0_signal_handler), @@ -729,6 +749,9 @@ main (int argc, char **argv) dbus_g_proxy_connect_signal (proxy, "Sig1", G_CALLBACK (sig1_signal_handler), NULL, NULL); + dbus_g_proxy_connect_signal (proxy, "Sig2", + G_CALLBACK (sig2_signal_handler), + NULL, NULL); dbus_g_proxy_call_no_reply (proxy, "EmitSignals", G_TYPE_INVALID); @@ -743,6 +766,15 @@ main (int argc, char **argv) if (n_times_sig1_received != 1) lose ("Sig1 signal received %d times, should have been 1", n_times_sig1_received); + dbus_g_proxy_call_no_reply (proxy, "EmitSignal2", G_TYPE_INVALID); + dbus_g_connection_flush (connection); + + exit_timeout = g_timeout_add (5000, timed_exit, loop); + g_main_loop_run (loop); + + if (n_times_sig2_received != 1) + lose ("Sig2 signal received %d times, should have been 1", n_times_sig2_received); + dbus_g_proxy_call_no_reply (proxy, "EmitSignals", G_TYPE_INVALID); dbus_g_proxy_call_no_reply (proxy, "EmitSignals", G_TYPE_INVALID); -- cgit