test: Always use DejaVu Sans as default font

This makes the results of the test suite more stable across different
environments, because it does not rely anymore on
CAIRO_FONT_FAMILY_DEFAULT (which on Windows is "Arial", on Mac
"Helvetica").

This change should not affect Linux environments, assuming that the
default font is already set to "DejaVu Sans".
This commit is contained in:
Andrea Canciani 2015-04-16 11:59:02 +02:00
parent 6951fb4238
commit e1353f3b85
6 changed files with 11 additions and 7 deletions

View file

@ -915,6 +915,10 @@ REPEAT:
cairo_paint (cr); cairo_paint (cr);
cairo_restore (cr); cairo_restore (cr);
cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
/* Set all components of font_options to avoid backend differences /* Set all components of font_options to avoid backend differences
* and reduce number of needed reference images. */ * and reduce number of needed reference images. */
font_options = cairo_font_options_create (); font_options = cairo_font_options_create ();

View file

@ -46,7 +46,7 @@ draw (cairo_t *cr, int width, int height)
cairo_stroke_preserve (cr); cairo_stroke_preserve (cr);
cairo_paint (cr); cairo_paint (cr);
cairo_select_font_face (cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_show_text (cr, "ABC"); cairo_show_text (cr, "ABC");
cairo_mask (cr, cairo_get_source (cr)); cairo_mask (cr, cairo_get_source (cr));

View file

@ -63,7 +63,7 @@ draw_thread (void *arg)
cairo_paint (cr); cairo_paint (cr);
cairo_set_source_rgb (cr, 0, 0, 0); cairo_set_source_rgb (cr, 0, 0, 0);
cairo_select_font_face (cr, "serif", cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Serif",
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL); CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, NUM_ITERATIONS); cairo_set_font_size (cr, NUM_ITERATIONS);
@ -74,7 +74,7 @@ draw_thread (void *arg)
for (i = 0; i < NUM_ITERATIONS; i++) { for (i = 0; i < NUM_ITERATIONS; i++) {
char buf[2]; char buf[2];
cairo_select_font_face (cr, "serif", cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Serif",
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL); CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, i); cairo_set_font_size (cr, i);

View file

@ -126,7 +126,7 @@ draw (cairo_t *cr, int width, int height)
cairo_set_source_rgb (cr, 1, 1, 1); cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr); cairo_paint (cr);
cairo_select_font_face (cr, "Sans", cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL); CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, TEXT_SIZE); cairo_set_font_size (cr, TEXT_SIZE);

View file

@ -66,11 +66,11 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height) draw (cairo_t *cr, int width, int height)
{ {
/* Once there was a bug that choked when selecting the same font twice. */ /* Once there was a bug that choked when selecting the same font twice. */
cairo_select_font_face (cr, "sans", cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 40.0); cairo_set_font_size (cr, 40.0);
cairo_select_font_face (cr, "sans", cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 40.0); cairo_set_font_size (cr, 40.0);
cairo_move_to (cr, 10, 50); cairo_move_to (cr, 10, 50);

View file

@ -127,7 +127,7 @@ _user_font_face_create (cairo_font_face_t **out)
/* This also happens to be default font face on cairo_t, so does /* This also happens to be default font face on cairo_t, so does
* not make much sense here. For demonstration only. * not make much sense here. For demonstration only.
*/ */
fallback_font_face = cairo_toy_font_face_create ("", fallback_font_face = cairo_toy_font_face_create (CAIRO_TEST_FONT_FAMILY " Sans",
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL); CAIRO_FONT_WEIGHT_NORMAL);