[pango/item-offset: 4/6] test-itemize: Improve generation




commit a19dad7b1d34925ee31137b4b58ed989e63fdfbf
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 28 11:21:49 2021 -0400

    test-itemize: Improve generation
    
    It is very annoying that gtest will dump its
    random seed into the output as soon as one calls
    g_test_init(). This pollutes our generated output.
    Work around that by deferring the g_test_init()
    call until after we've dealt with generating
    output.

 tests/test-itemize.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tests/test-itemize.c b/tests/test-itemize.c
index 105b453d..921a1fdc 100644
--- a/tests/test-itemize.c
+++ b/tests/test-itemize.c
@@ -313,13 +313,11 @@ main (int argc, char *argv[])
   const gchar *name;
   gchar *path;
 
-  g_test_init (&argc, &argv, NULL);
-
   context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
   pango_context_set_language (context, pango_language_from_string ("en-us"));
 
   /* allow to easily generate expected output for new test cases */
-  if (argc > 1)
+  if (argc > 1 && argv[1][0] != '-')
     {
       GString *string;
 
@@ -330,6 +328,8 @@ main (int argc, char *argv[])
       return 0;
     }
 
+  g_test_init (&argc, &argv, NULL);
+
   path = g_test_build_filename (G_TEST_DIST, "itemize", NULL);
   dir = g_dir_open (path, 0, &error);
   g_free (path);


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