gtk3/0001-reftests-Enforce-default-settings.patch

71 lines
1.8 KiB
Diff

From b541ad48d1c7060e2d38205d4874675e27578b9b Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Mon, 19 Jul 2021 13:10:31 -0400
Subject: [PATCH] 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.
---
testsuite/reftests/gtk-reftest.c | 36 ++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
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
--
2.31.1