summaryrefslogtreecommitdiff
path: root/test/text-glyph-range.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-09-03 16:38:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-10-31 12:30:11 +0000
commite90073f7ddc6f461a935bc360c409b04f1fe9f74 (patch)
treeefda94d1ecd13143cdad23f14552661165e7601e /test/text-glyph-range.c
parent8457972d40088cda165f31fdd7bd9b4c19c6e095 (diff)
downloadcairo-e90073f7ddc6f461a935bc360c409b04f1fe9f74.tar.gz
[test] Build test suite into single binary.
Avoid calling libtool to link every single test case, by building just one binary from all the sources. This binary is then given the task of choosing tests to run (based on user selection and individual test requirement), forking each test into its own process and accumulating the results.
Diffstat (limited to 'test/text-glyph-range.c')
-rw-r--r--test/text-glyph-range.c62
1 files changed, 27 insertions, 35 deletions
diff --git a/test/text-glyph-range.c b/test/text-glyph-range.c
index 2af48a26d..f6422fee1 100644
--- a/test/text-glyph-range.c
+++ b/test/text-glyph-range.c
@@ -26,14 +26,15 @@
*/
/* Related to bug 9530
- *
+ *
* cairo_glyph_t can contain any unsigned long in its 'index', the intention
* being that it is large enough to hold a pointer. However, this means that
* it can specify many glyph indexes which don't exist in the font, and may
- * exceed the range of legal glyph indexes for the font backend. It may
- * also contain special values that are not usable as indexes - e.g. 0xffff is
+ * exceed the range of legal glyph indexes for the font backend. It may
+ * also contain special values that are not usable as indexes - e.g. 0xffff is
* kATSDeletedGlyphcode in ATSUI, a glyph that should not be drawn.
- * The font backends should handle all legal and out-of-range values consistently.
+ * The font backends should handle all legal and out-of-range values
+ * consistently.
*
* This test expects that operations on out-of-range and missing glyphs should
* act as if they were zero-width.
@@ -46,16 +47,6 @@
#define NUM_TEXT 20
#define TEXT_SIZE 12
-static cairo_test_draw_function_t draw;
-
-cairo_test_t test = {
- "text-glyph-range",
- "Tests show_glyphs, glyph_path, glyph_extents with out of range glyph ids."
- "\nft and atsui font backends fail, misreporting errors from FT_Load_Glyph and ATSUGlyphGetCubicPaths",
- WIDTH, HEIGHT,
- draw
-};
-
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
@@ -71,50 +62,49 @@ draw (cairo_t *cr, int width, int height)
-1L, /* out of range */
70, 68, 76, 85, 82 /* 'cairo' */
};
-
+
/* We draw in the default black, so paint white first. */
cairo_save (cr);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
cairo_paint (cr);
cairo_restore (cr);
-
+
cairo_select_font_face (cr, "Bitstream Vera Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 16);
-
-
+
for (i = 0; i < 9; i++) {
/* since we're just drawing glyphs directly we need to position them. */
cairo_glyph_t glyph = {
index[i], 10 * i, 25
};
-
+
/* test cairo_glyph_extents. Every glyph index should
* have extents, invalid glyphs should be zero-width.
*/
cairo_move_to (cr, glyph.x, glyph.y);
cairo_set_line_width (cr, 1.0);
- cairo_glyph_extents (cr, &glyph, 1, &extents);
- cairo_rectangle (cr,
- glyph.x + extents.x_bearing - 0.5,
- glyph.y + extents.y_bearing - 0.5,
- extents.width + 1,
+ cairo_glyph_extents (cr, &glyph, 1, &extents);
+ cairo_rectangle (cr,
+ glyph.x + extents.x_bearing - 0.5,
+ glyph.y + extents.y_bearing - 0.5,
+ extents.width + 1,
extents.height + 1);
cairo_set_source_rgb (cr, 1, 0, 0); /* red */
cairo_stroke (cr);
-
+
/* test cairo_show_glyphs. Every glyph index should be
* drawable, invalid glyph indexes should draw nothing.
*/
- cairo_set_source_rgb (cr, 0, 0, 0); /* black */
+ cairo_set_source_rgb (cr, 0, 0, 0); /* black */
cairo_show_glyphs (cr, &glyph, 1);
cairo_move_to (cr, glyph.x, glyph.y);
-
- /* test cairo_glyph_path. Every glyph index should produce
+
+ /* test cairo_glyph_path. Every glyph index should produce
* a path, invalid glyph indexes should have empty paths.
*/
- /* Change the glyph position
+ /* Change the glyph position
* so that the paths are visible.
*/
glyph.y = 55;
@@ -122,12 +112,14 @@ draw (cairo_t *cr, int width, int height)
cairo_glyph_path (cr, &glyph, 1);
cairo_fill (cr);
}
-
+
return CAIRO_TEST_SUCCESS;
}
-int
-main (void)
-{
- return cairo_test (&test);
-}
+CAIRO_TEST (text_glyph_range,
+ "Tests show_glyphs, glyph_path, glyph_extents with out of range glyph ids."
+ "\nft and atsui font backends fail, misreporting errors from FT_Load_Glyph and ATSUGlyphGetCubicPaths",
+ "text, stress", /* keywords */
+ NULL, /* requirements */
+ WIDTH, HEIGHT,
+ NULL, draw)