[gtk/matthiasc/for-master: 1/9] node test: Improve --generate




commit f2edf40e480cdd2cf07915f8313d5fcb9aa558d3
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Apr 2 20:35:39 2021 -0400

    node test: Improve --generate
    
    This is a pet peeve of mine: When we call
    g_test_init() before handling --generate,
    the random seed spew pollutes the output.
    Highly annoying. I've fixes many test binaries
    over the years, but more keep popping up.

 testsuite/gsk/node-parser.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/testsuite/gsk/node-parser.c b/testsuite/gsk/node-parser.c
index e7cf97887e..3c4f61b817 100644
--- a/testsuite/gsk/node-parser.c
+++ b/testsuite/gsk/node-parser.c
@@ -315,13 +315,13 @@ main (int argc, char **argv)
 {
   gboolean success;
 
-  gtk_test_init (&argc, &argv);
-
   if (argc < 2)
     {
       const char *basedir;
       GFile *dir;
 
+      gtk_test_init (&argc, &argv);
+
       basedir = g_test_get_dir (G_TEST_DIST);
       dir = g_file_new_for_path (basedir);
       success = test_files_in_directory (dir);
@@ -334,6 +334,8 @@ main (int argc, char **argv)
         {
           GFile *file = g_file_new_for_commandline_arg (argv[2]);
 
+          gtk_init ();
+
           success = parse_node_file (file, TRUE);
 
           g_object_unref (file);
@@ -345,6 +347,8 @@ main (int argc, char **argv)
     {
       guint i;
 
+      gtk_test_init (&argc, &argv);
+
       success = TRUE;
 
       for (i = 1; i < argc; i++)


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