Blame SOURCES/0001-reftests-Enforce-default-settings.patch

82ffd2
From b541ad48d1c7060e2d38205d4874675e27578b9b Mon Sep 17 00:00:00 2001
82ffd2
From: Matthias Clasen <mclasen@redhat.com>
82ffd2
Date: Mon, 19 Jul 2021 13:10:31 -0400
82ffd2
Subject: [PATCH] reftests: Enforce default settings
82ffd2
82ffd2
Set all settings to their default values, so we
82ffd2
are less dependent on the environment to be set
82ffd2
up just right. In particular, this fixes animations
82ffd2
being disabled when we happen to run in a vm.
82ffd2
---
82ffd2
 testsuite/reftests/gtk-reftest.c | 36 ++++++++++++++++++++++++++++++++
82ffd2
 1 file changed, 36 insertions(+)
82ffd2
82ffd2
diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c
82ffd2
index 585e1c393d..1a51a9756b 100644
82ffd2
--- a/testsuite/reftests/gtk-reftest.c
82ffd2
+++ b/testsuite/reftests/gtk-reftest.c
82ffd2
@@ -368,6 +368,40 @@ add_test_for_file (GFile *file)
82ffd2
   g_list_free_full (files, g_object_unref);
82ffd2
 }
82ffd2
 
82ffd2
+static void
82ffd2
+enforce_default_settings (void)
82ffd2
+{
82ffd2
+  GtkSettings *settings;
82ffd2
+  GTypeClass *klass;
82ffd2
+  GParamSpec **pspecs;
82ffd2
+  guint n_pspecs;
82ffd2
+  int i;
82ffd2
+
82ffd2
+  settings = gtk_settings_get_default ();
82ffd2
+
82ffd2
+  klass = g_type_class_ref (G_OBJECT_TYPE (settings));
82ffd2
+
82ffd2
+  pspecs = g_object_class_list_properties (klass, &n_pspecs);
82ffd2
+  for (i = 0; i < n_pspecs; i++)
82ffd2
+    {
82ffd2
+      GParamSpec *pspec = pspecs[i];
82ffd2
+      const GValue *value;
82ffd2
+
82ffd2
+      if ((pspec->flags & G_PARAM_WRITABLE) == 0)
82ffd2
+        continue;
82ffd2
+
82ffd2
+      if (pspec->value_type == G_TYPE_HASH_TABLE)
82ffd2
+        continue;
82ffd2
+
82ffd2
+      value = g_param_spec_get_default_value (pspec);
82ffd2
+      g_object_set_property (settings, pspec->name, value);
82ffd2
+    }
82ffd2
+
82ffd2
+  g_free (pspecs);
82ffd2
+
82ffd2
+  g_type_class_unref (klass);
82ffd2
+}
82ffd2
+
82ffd2
 int
82ffd2
 main (int argc, char **argv)
82ffd2
 {
82ffd2
@@ -382,6 +416,8 @@ main (int argc, char **argv)
82ffd2
   if (!parse_command_line (&argc, &argv))
82ffd2
     return 1;
82ffd2
 
82ffd2
+  enforce_default_settings ();
82ffd2
+
82ffd2
   if (arg_base_dir)
82ffd2
     basedir = arg_base_dir;
82ffd2
   else
82ffd2
-- 
82ffd2
2.31.1
82ffd2