[pango/pango2: 109/178] Rename a test




commit d874610f60e24cef9959e380ee174cf1ef999362
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jun 14 21:08:40 2022 -0400

    Rename a test
    
    It tests fontsets, so call it that.

 tests/meson.build                       | 26 ++++--------------------
 tests/{test-fonts.c => test-fontsets.c} | 36 ++-------------------------------
 2 files changed, 6 insertions(+), 56 deletions(-)
---
diff --git a/tests/meson.build b/tests/meson.build
index c63113b7e..b016a7ffb 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -38,31 +38,13 @@ if cairo_dep.found()
     [ 'test-harfbuzz', [ 'test-harfbuzz.c' ] ],
     [ 'test-break', [ 'test-break.c', 'test-common.c', 'validate-log-attrs.c' ] ],
     [ 'testmisc', [ 'testmisc.c' ] ],
-  ]
-
-  tests += [
     [ 'testserialize', [ 'testserialize.c' ] ],
     [ 'testhbfont', [ 'testhbfont.c' ] ],
+    [ 'test-layout', [ 'test-layout.c', 'test-common.c' ] ],
+    [ 'test-fontsets', [ 'test-fontsets.c', 'test-common.c' ] ],
+    [ 'testrandom', [ 'testrandom.c' ] ],
+    [ 'test-pangocairo-threads', [ 'test-pangocairo-threads.c' ] ],
   ]
-
-    if host_system != 'darwin'
-      tests += [
-        [ 'test-layout', [ 'test-layout.c', 'test-common.c' ] ],
-        [ 'test-fonts', [ 'test-fonts.c', 'test-common.c' ] ],
-      ]
-    endif
-
-  if host_system != 'darwin'
-    tests += [
-      [ 'testrandom', [ 'testrandom.c' ] ],
-    ]
-  endif
-
-  if cairo_dep.found()
-    tests += [
-      [ 'test-pangocairo-threads', [ 'test-pangocairo-threads.c' ] ],
-    ]
-  endif
 endif
 
 installed_test_data = [
diff --git a/tests/test-fonts.c b/tests/test-fontsets.c
similarity index 83%
rename from tests/test-fonts.c
rename to tests/test-fontsets.c
index 3f576e564..814c3708a 100644
--- a/tests/test-fonts.c
+++ b/tests/test-fontsets.c
@@ -2,36 +2,8 @@
 #include <locale.h>
 
 #include <pango/pango.h>
-#include <pango/pangofc-fontmap.h>
 #include "test-common.h"
 
-static PangoFontMap *map = NULL;
-
-static void
-install_fonts (const char *dir)
-{
-  FcConfig *config;
-  char *path;
-  gsize len;
-  char *conf;
-
-  config = FcConfigCreate ();
-
-  path = g_build_filename (dir, "fonts.conf", NULL);
-  g_file_get_contents (path, &conf, &len, NULL);
-
-  if (!FcConfigParseAndLoadFromMemory (config, (const FcChar8 *) conf, TRUE))
-    g_error ("Failed to parse fontconfig configuration");
-
-  g_free (conf);
-  g_free (path);
-
-  FcConfigAppFontAddDir (config, (const FcChar8 *) dir);
-  map = PANGO_FONT_MAP (pango_fc_font_map_new ());
-  pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (map), config);
-  FcConfigDestroy (config);
-}
-
 static gboolean
 append_one (PangoFontset *fonts,
             PangoFont    *font,
@@ -69,7 +41,7 @@ list_fonts (const char *contents)
 
   desc = pango_font_description_from_string (s);
 
-  context = pango_font_map_create_context (map);
+  context = pango_font_map_create_context (pango_font_map_get_default ());
   fonts = pango_context_load_fontset (context, desc, pango_language_get_default ());
 
   str = g_string_new (s);
@@ -199,11 +171,7 @@ main (int argc, char *argv[])
   g_test_init (&argc, &argv, NULL);
 
   if (!opt_fonts)
-    {
-      path = g_test_build_filename (G_TEST_DIST, "fonts", NULL);
-      install_fonts (path);
-      g_free (path);
-    }
+    install_fonts (NULL);
 
   path = g_test_build_filename (G_TEST_DIST, "fontsets", NULL);
   dir = g_dir_open (path, 0, &error);


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