Merge branch 'test-font-tweaks' into 'main'

tests: Change the way custom fonts are handled

See merge request GNOME/gtk!6734
This commit is contained in:
Matthias Clasen
2024-01-11 03:33:15 +00:00
3 changed files with 25 additions and 8 deletions

View File

@@ -1,9 +1,15 @@
#include "config.h"
#include <string.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include "../reftests/reftest-compare.h"
#ifdef HAVE_PANGOFT
#include <pango/pangofc-fontmap.h>
#endif
static char *arg_output_dir = NULL;
static gboolean flip = FALSE;
static gboolean rotate = FALSE;
@@ -232,6 +238,22 @@ apply_mask_to_pixbuf (GdkPixbuf *pixbuf)
return copy;
}
static void
maybe_add_test_fonts (void)
{
#ifdef HAVE_PANGOFT
const char *dir;
dir = g_getenv ("TEST_FONT_DIR");
if (dir && g_file_test (dir, G_FILE_TEST_EXISTS))
{
FcConfig *config = FcConfigGetCurrent ();
FcConfigAppFontAddDir (config, (const FcChar8 *) dir);
}
#endif
}
/*
* Non-option arguments:
* 1) .node file to compare
@@ -252,6 +274,8 @@ main (int argc, char **argv)
GOptionContext *context;
GdkTexture *diff_texture;
maybe_add_test_fonts ();
(g_test_init) (&argc, &argv, NULL);
context = g_option_context_new ("NODE REF - run GSK node tests");

View File

@@ -1,7 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<cachedir>/tmp/cache</cachedir>
<dir prefix="relative">.</dir>
<include>/etc/fonts/fonts.conf</include>
</fontconfig>

View File

@@ -204,7 +204,7 @@ foreach renderer : renderers
'GTK_A11Y=test',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'FONTCONFIG_FILE=@0@/fonts/fonts.conf'.format(meson.current_source_dir())
'TEST_FONT_DIR=@0@/fonts'.format(meson.current_source_dir())
]
if ((not testname.contains(exclude_term)) and