mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-17 19:21:58 +02:00
Improve GSettings test coverage
This covers some more GSettingsSchemaKey api.
This commit is contained in:
parent
555d40eeed
commit
dbe560ac01
@ -2389,11 +2389,26 @@ static void
|
|||||||
test_default_value (void)
|
test_default_value (void)
|
||||||
{
|
{
|
||||||
GSettings *settings;
|
GSettings *settings;
|
||||||
|
GSettingsSchema *schema;
|
||||||
|
GSettingsSchemaKey *key;
|
||||||
GVariant *v;
|
GVariant *v;
|
||||||
gchar *str;
|
const gchar *str;
|
||||||
gchar *default_value;
|
|
||||||
|
|
||||||
settings = g_settings_new ("org.gtk.test");
|
settings = g_settings_new ("org.gtk.test");
|
||||||
|
g_object_get (settings, "settings-schema", &schema, NULL);
|
||||||
|
key = g_settings_schema_get_key (schema, "greeting");
|
||||||
|
g_settings_schema_unref (schema);
|
||||||
|
g_settings_schema_key_ref (key);
|
||||||
|
|
||||||
|
g_assert_cmpstr (g_settings_schema_key_get_value_type (key), ==, G_VARIANT_TYPE_STRING);
|
||||||
|
|
||||||
|
v = g_settings_schema_key_get_default_value (key);
|
||||||
|
str = g_variant_get_string (v, NULL);
|
||||||
|
g_assert_cmpstr (str, ==, "Hello, earthlings");
|
||||||
|
g_variant_unref (v);
|
||||||
|
|
||||||
|
g_settings_schema_key_unref (key);
|
||||||
|
g_settings_schema_key_unref (key);
|
||||||
|
|
||||||
g_settings_set (settings, "greeting", "s", "goodbye world");
|
g_settings_set (settings, "greeting", "s", "goodbye world");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user