[librsvg/librsvg-2.42] (#259): Make test fonts work for installed tests
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.42] (#259): Make test fonts work for installed tests
- Date: Wed, 20 Jun 2018 22:42:24 +0000 (UTC)
commit 48b261eda6f48cdef47761cbb7ce835574c443fd
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Jun 20 17:31:16 2018 -0500
(#259): Make test fonts work for installed tests
Don't hardcode the font locations based on the SRCDIR; actually
compute their locations with g_test_build_filename().
https://gitlab.gnome.org/GNOME/librsvg/issues/259
librsvg/rsvg-cairo-draw.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/librsvg/rsvg-cairo-draw.c b/librsvg/rsvg-cairo-draw.c
index 62ae6de2..b498f333 100644
--- a/librsvg/rsvg-cairo-draw.c
+++ b/librsvg/rsvg-cairo-draw.c
@@ -96,10 +96,10 @@ static void
create_font_config_for_testing (RsvgCairoRender *render)
{
const char *font_paths[] = {
- SRCDIR "/tests/resources/Roboto-Regular.ttf",
- SRCDIR "/tests/resources/Roboto-Italic.ttf",
- SRCDIR "/tests/resources/Roboto-Bold.ttf",
- SRCDIR "/tests/resources/Roboto-BoldItalic.ttf",
+ "resources/Roboto-Regular.ttf",
+ "resources/Roboto-Italic.ttf",
+ "resources/Roboto-Bold.ttf",
+ "resources/Roboto-BoldItalic.ttf",
};
int i;
@@ -110,9 +110,13 @@ create_font_config_for_testing (RsvgCairoRender *render)
render->font_config_for_testing = FcConfigCreate ();
for (i = 0; i < G_N_ELEMENTS(font_paths); i++) {
- if (!FcConfigAppFontAddFile (render->font_config_for_testing, (const FcChar8 *) font_paths[i])) {
- g_error ("Could not load font file \"%s\" for tests; aborting", font_paths[i]);
+ char *font_path = g_test_build_filename (G_TEST_DIST, font_paths[i], NULL);
+
+ if (!FcConfigAppFontAddFile (render->font_config_for_testing, (const FcChar8 *) font_path)) {
+ g_error ("Could not load font file \"%s\" for tests; aborting", font_path);
}
+
+ g_free (font_path);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]