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:
Andrea Canciani 2010-06-12 16:20:37 +02:00
parent b1e4df928f
commit 3cb882d01b
35 changed files with 42 additions and 40 deletions

View file

@ -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

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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");

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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");

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);