[gtk/matthiasc/css-change-tracking-4: 9/20] style tests: Clean up --generate support



commit 51abbabd325f55c2abb5cefbfdf85033b65f0643
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 17 20:57:51 2020 -0500

    style tests: Clean up --generate support
    
    Reshuffle things so we don't call gtk_test_init() when --generate
    is passed, to avoid polluting the output with test spew.

 testsuite/css/style/test-css-style.c | 37 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 19 deletions(-)
---
diff --git a/testsuite/css/style/test-css-style.c b/testsuite/css/style/test-css-style.c
index 9c9cbb18e5..c7c0bca3aa 100644
--- a/testsuite/css/style/test-css-style.c
+++ b/testsuite/css/style/test-css-style.c
@@ -243,16 +243,26 @@ int
 main (int argc, char **argv)
 {
   g_setenv ("GTK_CSS_DEBUG", "1", TRUE);
+  g_setenv ("GTK_THEME", "Empty", TRUE);
 
-  if (argc >= 2 && strcmp (argv[1], "--generate") == 0)
-    gtk_init ();
-  else
-    gtk_test_init (&argc, &argv);
+  if (argc >= 3 && strcmp (argv[1], "--generate") == 0)
+    {
+      GFile *file = g_file_new_for_commandline_arg (argv[2]);
+
+      gtk_init ();
+
+      g_object_set (gtk_settings_get_default (), "gtk-font-name", "Sans", NULL);
+
+      load_ui_file (file, TRUE);
+
+      g_object_unref (file);
+
+      return 0;
+    }
+
+  gtk_test_init (&argc, &argv);
+  g_object_set (gtk_settings_get_default (), "gtk-font-name", "Sans", NULL);
 
-  g_object_set (gtk_settings_get_default (),
-                "gtk-font-name", "Sans",
-                "gtk-theme-name", "Empty",
-                NULL);
   if (argc < 2)
     {
       const char *basedir;
@@ -264,17 +274,6 @@ main (int argc, char **argv)
 
       g_object_unref (dir);
     }
-  else if (strcmp (argv[1], "--generate") == 0)
-    {
-      if (argc >= 3)
-        {
-          GFile *file = g_file_new_for_commandline_arg (argv[2]);
-
-          load_ui_file (file, TRUE);
-
-          g_object_unref (file);
-        }
-    }
   else
     {
       guint i;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]