Merge branch 'ci-default-settings-4' into 'master'

reftests: Enforce default settings

See merge request GNOME/gtk!3769
This commit is contained in:
Matthias Clasen 2021-07-19 18:36:11 +00:00
commit 67c9e7a4a8

View File

@ -453,6 +453,37 @@ log_writer (GLogLevelFlags log_level,
return g_log_writer_standard_streams (log_level, fields, n_fields, user_data);
}
static void
enforce_default_settings (void)
{
GtkSettings *settings;
GObjectClass *klass;
GParamSpec **pspecs;
guint n_pspecs;
int i;
settings = gtk_settings_get_default ();
klass = g_type_class_ref (G_OBJECT_TYPE (settings));
pspecs = g_object_class_list_properties (klass, &n_pspecs);
for (i = 0; i < n_pspecs; i++)
{
GParamSpec *pspec = pspecs[i];
const GValue *value;
if ((pspec->flags & G_PARAM_WRITABLE) == 0)
continue;
value = g_param_spec_get_default_value (pspec);
g_object_set_property (G_OBJECT (settings), pspec->name, value);
}
g_free (pspecs);
g_type_class_unref (klass);
}
int
main (int argc, char **argv)
{
@ -503,6 +534,8 @@ main (int argc, char **argv)
*/
chdir (basedir);
enforce_default_settings ();
g_log_set_writer_func (log_writer, NULL, NULL);
result = g_test_run ();