diff options
author | Jeff Muizelaar <jmuizelaar@mozilla.com> | 2009-02-19 11:45:14 -0500 |
---|---|---|
committer | Jeff Muizelaar <jmuizelaar@mozilla.com> | 2009-02-19 11:45:33 -0500 |
commit | d4227fc9126ffbb3a967aea1bc9795e7e64ee8e1 (patch) | |
tree | 3713def7155c5b88a528bbf31a94fd4d58f1c833 /test/toy-font-face.c | |
parent | 06fa7a8386b267fdbd7635b952adc75a58f62584 (diff) |
[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.
Diffstat (limited to 'test/toy-font-face.c')
-rw-r--r-- | test/toy-font-face.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/test/toy-font-face.c b/test/toy-font-face.c index e26a19ca..147c43b7 100644 --- a/test/toy-font-face.c +++ b/test/toy-font-face.c @@ -34,6 +34,17 @@ #include <assert.h> #include <string.h> +#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); |