[glib] gio: Add regression test for double array encoding
- From: Stefan Walter <stefw src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [glib] gio: Add regression test for double array encoding
 
- Date: Wed, 23 Jul 2014 13:46:25 +0000 (UTC)
 
commit b6c1d696a98b7fc4e691e8acc9f88b7bc8d57e9d
Author: Stef Walter <stefw gnome org>
Date:   Tue Jul 22 21:13:50 2014 +0200
    gio: Add regression test for double array encoding
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732754
 gio/tests/gdbus-serialization.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/gdbus-serialization.c b/gio/tests/gdbus-serialization.c
index f1b0214..e31dbe4 100644
--- a/gio/tests/gdbus-serialization.c
+++ b/gio/tests/gdbus-serialization.c
@@ -1048,6 +1048,39 @@ message_parse_empty_arrays_of_arrays (void)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
+static void
+test_double_array (void)
+{
+  GDBusConnection *conn;
+  GError *error = NULL;
+  GVariantBuilder builder;
+
+  g_test_bug ("732754");
+
+  conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+  g_assert_no_error (error);
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("ad"));
+  g_variant_builder_add (&builder, "d", (gdouble)0.0);
+  g_variant_builder_add (&builder, "d", (gdouble)8.0);
+  g_variant_builder_add (&builder, "d", (gdouble)22.0);
+  g_variant_builder_add (&builder, "d", (gdouble)0.0);
+
+  /*
+   * Some versions of glib encoded arrays of doubles wrong. Here we send such
+   * a message and check that we didn't get bumped from the connection.
+   */
+  g_dbus_connection_call_sync (conn, "org.freedesktop.DBus", "/path",
+                               "org.freedesktop.DBus", "InvalidNonExistantMethod",
+                               g_variant_new ("(@ad)", g_variant_builder_end (&builder)),
+                               NULL, G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, &error);
+  g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
+
+  g_object_unref (conn);
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
 int
 main (int   argc,
       char *argv[])
@@ -1065,6 +1098,8 @@ main (int   argc,
   g_test_add_func ("/gdbus/message-parse-empty-arrays-of-arrays",
       message_parse_empty_arrays_of_arrays);
 
+  g_test_add_func ("/gdbus/message-serialize/double-array", test_double_array);
+
   return g_test_run();
 }
 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]