diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-07-19 13:10:31 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-07-19 13:10:31 -0400 |
commit | b541ad48d1c7060e2d38205d4874675e27578b9b (patch) | |
tree | 14b5d0236cccbc68e234755ce5ff515a070ef9fd | |
parent | 557c3d1d6282383e1bc962b62d9aa04c7a3b99bd (diff) | |
download | gtk+-b541ad48d1c7060e2d38205d4874675e27578b9b.tar.gz |
reftests: Enforce default settings
Set all settings to their default values, so we
are less dependent on the environment to be set
up just right. In particular, this fixes animations
being disabled when we happen to run in a vm.
-rw-r--r-- | testsuite/reftests/gtk-reftest.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c index 585e1c393d..1a51a9756b 100644 --- a/testsuite/reftests/gtk-reftest.c +++ b/testsuite/reftests/gtk-reftest.c @@ -368,6 +368,40 @@ add_test_for_file (GFile *file) g_list_free_full (files, g_object_unref); } +static void +enforce_default_settings (void) +{ + GtkSettings *settings; + GTypeClass *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; + + if (pspec->value_type == G_TYPE_HASH_TABLE) + continue; + + value = g_param_spec_get_default_value (pspec); + g_object_set_property (settings, pspec->name, value); + } + + g_free (pspecs); + + g_type_class_unref (klass); +} + int main (int argc, char **argv) { @@ -382,6 +416,8 @@ main (int argc, char **argv) if (!parse_command_line (&argc, &argv)) return 1; + enforce_default_settings (); + if (arg_base_dir) basedir = arg_base_dir; else |