glib/gio/tests/gsettings.c

37 lines
837 B
C
Raw Normal View History

2010-04-13 16:46:40 -04:00
#include <gio.h>
static void
test_basic (void)
2010-04-13 16:46:40 -04:00
{
gchar *str = NULL;
GSettings *settings;
2010-04-13 16:46:40 -04:00
settings = g_settings_new ("org.gtk.test");
g_settings_get (settings, "greeting", "s", &str);
g_assert_cmpstr (str, ==, "Hello, earthlings");
2010-04-13 16:46:40 -04:00
g_settings_set (settings, "greeting", "s", "goodbye world");
g_settings_get (settings, "greeting", "s", &str);
g_assert_cmpstr (str, ==, "goodbye world");
2010-04-13 16:46:40 -04:00
g_settings_set (settings, "greeting", "i", 555);
g_settings_get (settings, "greeting", "s", &str);
#if 0
/* FIXME: currently, the integer write is not failing, so we get hte schema default here */
g_assert_cmpstr (str, ==, "goodbye world");
#endif
}
int
main (int argc, char *argv[])
{
g_type_init ();
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/gsettings/basic", test_basic);
return g_test_run ();
2010-04-13 16:46:40 -04:00
}