[pango/baseline-shift] test-layout: Add a --show-fonts option



commit 14af3e600028cd0829521c8d1c9dd07c9db41bb3
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Aug 30 12:44:00 2021 -0400

    test-layout: Add a --show-fonts option
    
    A bit more natural than the environment variable.

 tests/test-layout.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/tests/test-layout.c b/tests/test-layout.c
index 3320920b..cd60450e 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -617,9 +617,24 @@ main (int argc, char *argv[])
   GError *error = NULL;
   const gchar *name;
   gchar *path;
+  GOptionContext *option_context;
+  GOptionEntry entries[] = {
+    { "show-fonts", '0', 0, G_OPTION_ARG_NONE, &opt_show_font, "Print font names in dumps", NULL },
+    { NULL, 0 },
+  };
 
   setlocale (LC_ALL, "");
 
+  option_context = g_option_context_new ("");
+  g_option_context_add_main_entries (option_context, entries, NULL);
+  g_option_context_set_ignore_unknown_options (option_context, TRUE);
+  if (!g_option_context_parse (option_context, &argc, &argv, &error))
+    {
+      g_error ("failed to parse options: %s", error->message);
+      return 1;
+    }
+  g_option_context_free (option_context);
+
   if (g_getenv ("PANGO_TEST_SHOW_FONT"))
     opt_show_font = TRUE;
 


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