From d4227fc9126ffbb3a967aea1bc9795e7e64ee8e1 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 19 Feb 2009 11:45:14 -0500 Subject: [PATCH] [test] Fix assert on default font family in toy-font-face toy-font-face was checking that cairo_toy_font_face_get_family returned "" which is CAIRO_FONT_FAMILY_DEFAULT when the freetype font backend is the default. However, when other font backends are the default the returned family is different. Therefore, instead of checking for "", we check for the appropriate string depending on the backend. --- test/toy-font-face.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/test/toy-font-face.c b/test/toy-font-face.c index e26a19ca5..147c43b73 100644 --- a/test/toy-font-face.c +++ b/test/toy-font-face.c @@ -34,6 +34,17 @@ #include #include +#if CAIRO_HAS_WIN32_FONT +#define CAIRO_FONT_FAMILY_DEFAULT "Arial" +#elif CAIRO_HAS_QUARTZ_FONT +#define CAIRO_FONT_FAMILY_DEFAULT "Helvetica" +#elif CAIRO_HAS_FT_FONT +#define CAIRO_FONT_FAMILY_DEFAULT "" +#else +#define CAIRO_FONT_FAMILY_DEFAULT "@cairo:" +#endif + + static cairo_test_status_t preamble (cairo_test_context_t *ctx) { @@ -79,7 +90,7 @@ preamble (cairo_test_context_t *ctx) CAIRO_FONT_SLANT_OBLIQUE, CAIRO_FONT_WEIGHT_BOLD); assert (cairo_font_face_get_type (font_face) == CAIRO_FONT_TYPE_TOY); - assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), "")); + assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), CAIRO_FONT_FAMILY_DEFAULT)); assert (cairo_toy_font_face_get_slant (font_face) == CAIRO_FONT_SLANT_NORMAL); assert (cairo_toy_font_face_get_weight (font_face) == CAIRO_FONT_WEIGHT_NORMAL); assert (cairo_font_face_status(font_face) == CAIRO_STATUS_NULL_POINTER); @@ -89,7 +100,7 @@ preamble (cairo_test_context_t *ctx) CAIRO_FONT_SLANT_OBLIQUE, CAIRO_FONT_WEIGHT_BOLD); assert (cairo_font_face_get_type (font_face) == CAIRO_FONT_TYPE_TOY); - assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), "")); + assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), CAIRO_FONT_FAMILY_DEFAULT)); assert (cairo_toy_font_face_get_slant (font_face) == CAIRO_FONT_SLANT_NORMAL); assert (cairo_toy_font_face_get_weight (font_face) == CAIRO_FONT_WEIGHT_NORMAL); assert (cairo_font_face_status(font_face) == CAIRO_STATUS_INVALID_STRING); @@ -99,7 +110,7 @@ preamble (cairo_test_context_t *ctx) -1, CAIRO_FONT_WEIGHT_BOLD); assert (cairo_font_face_get_type (font_face) == CAIRO_FONT_TYPE_TOY); - assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), "")); + assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), CAIRO_FONT_FAMILY_DEFAULT)); assert (cairo_toy_font_face_get_slant (font_face) == CAIRO_FONT_SLANT_NORMAL); assert (cairo_toy_font_face_get_weight (font_face) == CAIRO_FONT_WEIGHT_NORMAL); assert (cairo_font_face_status(font_face) == CAIRO_STATUS_INVALID_SLANT); @@ -109,7 +120,7 @@ preamble (cairo_test_context_t *ctx) CAIRO_FONT_SLANT_OBLIQUE, -1); assert (cairo_font_face_get_type (font_face) == CAIRO_FONT_TYPE_TOY); - assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), "")); + assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), CAIRO_FONT_FAMILY_DEFAULT)); assert (cairo_toy_font_face_get_slant (font_face) == CAIRO_FONT_SLANT_NORMAL); assert (cairo_toy_font_face_get_weight (font_face) == CAIRO_FONT_WEIGHT_NORMAL); assert (cairo_font_face_status(font_face) == CAIRO_STATUS_INVALID_WEIGHT);