gio: Add regression test for double array encoding

https://bugzilla.gnome.org/show_bug.cgi?id=732754
This commit is contained in:
Stef Walter 2014-07-22 21:13:50 +02:00
parent d0083f7e2d
commit b6c1d696a9

View File

@ -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 int
main (int argc, main (int argc,
char *argv[]) char *argv[])
@ -1065,6 +1098,8 @@ main (int argc,
g_test_add_func ("/gdbus/message-parse-empty-arrays-of-arrays", g_test_add_func ("/gdbus/message-parse-empty-arrays-of-arrays",
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(); return g_test_run();
} }