From f9747d07c89e94f920051db0a7ade37ce236a1d2 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 21 Dec 2013 01:00:10 -0500 Subject: [PATCH] Test some gsettings corner case Setting a strv to NULL was not tested before. --- gio/tests/gsettings.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c index d94d7d7..e2c19de 100644 --- a/gio/tests/gsettings.c +++ b/gio/tests/gsettings.c @@ -1214,6 +1214,11 @@ test_simple_binding (void) g_assert_cmpstr (s, ==, "decaffeinate,unleaded,keep all surfaces clean"); g_strfreev (strv); g_free (s); + g_settings_set_strv (settings, "strv", NULL); + g_object_get (obj, "strv", &strv, NULL); + g_assert (strv != NULL); + g_assert_cmpint (g_strv_length (strv), ==, 0); + g_strfreev (strv); g_settings_bind (settings, "enum", obj, "enum", G_SETTINGS_BIND_DEFAULT); g_object_set (obj, "enum", TEST_ENUM_BAZ, NULL); @@ -2387,6 +2392,7 @@ test_default_value (void) GSettingsSchemaKey *key; GVariant *v; const gchar *str; + gchar *s; settings = g_settings_new ("org.gtk.test"); g_object_get (settings, "settings-schema", &schema, NULL); @@ -2421,9 +2427,9 @@ test_default_value (void) v = g_settings_get_user_value (settings, "greeting"); g_assert_null (v); - str = g_settings_get_string (settings, "greeting"); - g_assert_cmpstr (str, ==, "Hello, earthlings"); - g_free (str); + s = g_settings_get_string (settings, "greeting"); + g_assert_cmpstr (s, ==, "Hello, earthlings"); + g_free (s); g_object_unref (settings); } -- 2.7.4