summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2014-07-22 21:13:50 +0200
committerStef Walter <stefw@gnome.org>2014-07-23 15:44:40 +0200
commitb6c1d696a98b7fc4e691e8acc9f88b7bc8d57e9d (patch)
treed5ce2161635682bb81545f53333bd414d0799109
parentd0083f7e2dd621c6b78496bdb6ecf5d580c5e110 (diff)
gio: Add regression test for double array encoding
https://bugzilla.gnome.org/show_bug.cgi?id=732754
-rw-r--r--gio/tests/gdbus-serialization.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gio/tests/gdbus-serialization.c b/gio/tests/gdbus-serialization.c
index f1b02144e..e31dbe41c 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();
}