[cairo-commit] test/toy-font-face.c

Jeff Muizelaar jrmuizel at kemper.freedesktop.org
Thu Feb 19 09:05:17 PST 2009


 test/toy-font-face.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

New commits:
commit d4227fc9126ffbb3a967aea1bc9795e7e64ee8e1
Author: Jeff Muizelaar <jmuizelaar at mozilla.com>
Date:   Thu Feb 19 11:45:14 2009 -0500

    [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.

diff --git a/test/toy-font-face.c b/test/toy-font-face.c
index e26a19c..147c43b 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);


More information about the cairo-commit mailing list