mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-04 18:00:21 +01:00
test: make test font family a define
In order to make it easier to change the test font family, add it as a define in the global header and always reference the macro in the tests.
This commit is contained in:
parent
b1e4df928f
commit
3cb882d01b
35 changed files with 42 additions and 40 deletions
|
|
@ -83,6 +83,8 @@ cairo_test_NaN (void)
|
|||
|
||||
#define CAIRO_TEST_LOG_SUFFIX ".log"
|
||||
|
||||
#define CAIRO_TEST_FONT_FAMILY "Bitstream Vera"
|
||||
|
||||
/* What is a fail and what isn't?
|
||||
* When running the test suite we want to detect unexpected output. This
|
||||
* can be caused by a change we have made to cairo itself, or a change
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
|
||||
/* https://bugs.freedesktop.org/show_bug.cgi?id=13084 */
|
||||
cairo_select_font_face (cr,
|
||||
"Bitstream Vera Sans",
|
||||
CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
|
||||
/* https://bugs.freedesktop.org/show_bug.cgi?id=13084 */
|
||||
cairo_select_font_face (cr,
|
||||
"Bitstream Vera Sans",
|
||||
CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
|
||||
/* https://bugs.freedesktop.org/show_bug.cgi?id=13084 */
|
||||
cairo_select_font_face (cr,
|
||||
"Bitstream Vera Sans",
|
||||
CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_operator_t op;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, 0.9 * HEIGHT);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ preamble (cairo_test_context_t *ctx)
|
|||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
|
||||
cr = cairo_create (surface);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ create_scaled_font (cairo_t * cr,
|
|||
if (pattern == NULL)
|
||||
return CAIRO_STATUS_NO_MEMORY;
|
||||
|
||||
FcPatternAddString (pattern, FC_FAMILY, (FcChar8 *)"Bitstream vera sans");
|
||||
FcPatternAddString (pattern, FC_FAMILY, (FcChar8 *) CAIRO_TEST_FONT_FAMILY " Sans");
|
||||
FcPatternAddDouble (pattern, FC_SIZE, TEXT_SIZE);
|
||||
FcConfigSubstitute (NULL, pattern, FcMatchPattern);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ create_scaled_font (cairo_t * cr,
|
|||
if (pattern == NULL)
|
||||
return CAIRO_STATUS_NO_MEMORY;
|
||||
|
||||
FcPatternAddString (pattern, FC_FAMILY, (FcChar8 *)"Bitstream Vera Sans");
|
||||
FcPatternAddString (pattern, FC_FAMILY, (FcChar8 *)CAIRO_TEST_FONT_FAMILY " Sans");
|
||||
FcPatternAddDouble (pattern, FC_PIXEL_SIZE, TEXT_SIZE);
|
||||
FcConfigSubstitute (NULL, pattern, FcMatchPattern);
|
||||
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
|
||||
phase = "Text";
|
||||
cairo_save (cr2);
|
||||
cairo_select_font_face (cr2, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr2, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr2, 12);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -41,17 +41,17 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
cairo_move_to (cr, 0, TEXT_SIZE);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Serif",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Serif",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_show_text (cr, "i-am-serif");
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_show_text (cr, " i-am-sans");
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans Mono",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans Mono",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_show_text (cr, " i-am-mono");
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_set_source_rgb (cr, 1., 1., 1.);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
size_t i, j, x, y;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
size_t i, j, x, y;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ preamble (cairo_test_context_t *ctx)
|
|||
|
||||
cr = cairo_create (surface);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ preamble (cairo_test_context_t *ctx)
|
|||
|
||||
cr = cairo_create (surface);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -39,17 +39,17 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
cairo_move_to (cr, 0, TEXT_SIZE);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Serif",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Serif",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_show_text (cr, "i-am-serif");
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_show_text (cr, " i-am-sans");
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans Mono",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans Mono",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_show_text (cr, " i-am-mono");
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_BOLD);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_select_font_face (cr2,
|
||||
"Bitstream Vera Sans",
|
||||
CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr2, 0.5 * height);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_stroke (cr2);
|
||||
|
||||
cairo_select_font_face (cr2,
|
||||
"Bitstream Vera Sans",
|
||||
CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr2, 0.3 * height);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, 16);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
{
|
||||
cairo_pattern_t *pat;
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_set_source_rgb (cr, 1., 1., 1.);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
|
||||
cairo_set_source_rgb (cr, 0., 0., 0.);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_font_extents_t font_extents, nil_font_extents;
|
||||
cairo_scaled_font_t *scaled_font;
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, 16);
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
size_t i, j, x, y;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_paint (cr);
|
||||
|
||||
cairo_select_font_face (cr,
|
||||
"Bitstream Vera Sans",
|
||||
CAIRO_TEST_FONT_FAMILY " Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
|
|
@ -328,7 +328,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
/* same text in 'mono' with widths that match the 'sans' version */
|
||||
old = cairo_font_face_reference (cairo_get_font_face (cr));
|
||||
cairo_select_font_face (cr,
|
||||
"Bitstream Vera Sans Mono",
|
||||
CAIRO_TEST_FONT_FAMILY " Sans Mono",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
substitute = cairo_get_font_face (cr);
|
||||
|
|
@ -349,7 +349,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
|
||||
/* mono text */
|
||||
cairo_select_font_face (cr,
|
||||
"Bitstream Vera Sans Mono",
|
||||
CAIRO_TEST_FONT_FAMILY " Sans Mono",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue