diff --git a/test/Makefile.refs b/test/Makefile.refs index 1c0945b3e..4de638271 100644 --- a/test/Makefile.refs +++ b/test/Makefile.refs @@ -869,10 +869,13 @@ REFERENCE_IMAGES = \ paint-with-alpha.ref.png \ paint-with-alpha.svg.ref.png \ paint.ref.png \ - partial-clip-text.ps.ref.png \ - partial-clip-text.quartz.ref.png \ - partial-clip-text.ref.png \ - partial-clip-text.svg.ref.png \ + partial-clip-text-bottom.ref.png \ + partial-clip-text-left.ref.png \ + partial-clip-text-right.ref.png \ + partial-clip-text-top.ps.ref.png \ + partial-clip-text-top.quartz.ref.png \ + partial-clip-text-top.ref.png \ + partial-clip-text-top.svg.ref.png \ partial-coverage-half-reference.ref.png \ partial-coverage-half-triangles.ref.png \ partial-coverage-intersecting-quads.ref.png \ diff --git a/test/partial-clip-text-bottom.ref.png b/test/partial-clip-text-bottom.ref.png new file mode 100644 index 000000000..bb31331cd Binary files /dev/null and b/test/partial-clip-text-bottom.ref.png differ diff --git a/test/partial-clip-text-left.ref.png b/test/partial-clip-text-left.ref.png new file mode 100644 index 000000000..ee1358fdd Binary files /dev/null and b/test/partial-clip-text-left.ref.png differ diff --git a/test/partial-clip-text-right.ref.png b/test/partial-clip-text-right.ref.png new file mode 100644 index 000000000..5853a7275 Binary files /dev/null and b/test/partial-clip-text-right.ref.png differ diff --git a/test/partial-clip-text.ps.ref.png b/test/partial-clip-text-top.ps.ref.png similarity index 100% rename from test/partial-clip-text.ps.ref.png rename to test/partial-clip-text-top.ps.ref.png diff --git a/test/partial-clip-text.quartz.ref.png b/test/partial-clip-text-top.quartz.ref.png similarity index 100% rename from test/partial-clip-text.quartz.ref.png rename to test/partial-clip-text-top.quartz.ref.png diff --git a/test/partial-clip-text-top.ref.png b/test/partial-clip-text-top.ref.png new file mode 100644 index 000000000..afe2d3efe Binary files /dev/null and b/test/partial-clip-text-top.ref.png differ diff --git a/test/partial-clip-text.svg.ref.png b/test/partial-clip-text-top.svg.ref.png similarity index 100% rename from test/partial-clip-text.svg.ref.png rename to test/partial-clip-text-top.svg.ref.png diff --git a/test/partial-clip-text.c b/test/partial-clip-text.c index f467a5f8f..4d8bae077 100644 --- a/test/partial-clip-text.c +++ b/test/partial-clip-text.c @@ -26,25 +26,95 @@ #include "cairo-test.h" -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) +#define HEIGHT 15 +#define WIDTH 40 + +static void background (cairo_t *cr) { cairo_set_source_rgb( cr, 0, 0, 0 ); cairo_paint (cr); +} - cairo_rectangle (cr, 0, 0, 40, 5); - cairo_clip (cr); - +static void text (cairo_t *cr) +{ cairo_move_to (cr, 0, 12); cairo_set_source_rgb (cr, 1, 1, 1); cairo_show_text (cr, "CAIRO"); +} + +static cairo_test_status_t +top (cairo_t *cr, int width, int height) +{ + background (cr); + + cairo_rectangle (cr, 0, 0, WIDTH, 5); + cairo_clip (cr); + + text (cr); return CAIRO_TEST_SUCCESS; } -CAIRO_TEST (partial_clip_text, +static cairo_test_status_t +bottom (cairo_t *cr, int width, int height) +{ + background (cr); + + cairo_rectangle (cr, 0, HEIGHT-5, WIDTH, 5); + cairo_clip (cr); + + text (cr); + + return CAIRO_TEST_SUCCESS; +} + +static cairo_test_status_t +left (cairo_t *cr, int width, int height) +{ + background (cr); + + cairo_rectangle (cr, 0, 0, 10, HEIGHT); + cairo_clip (cr); + + text (cr); + + return CAIRO_TEST_SUCCESS; +} + +static cairo_test_status_t +right (cairo_t *cr, int width, int height) +{ + background (cr); + + cairo_rectangle (cr, WIDTH-10, 0, 10, HEIGHT); + cairo_clip (cr); + + text (cr); + + return CAIRO_TEST_SUCCESS; +} + +CAIRO_TEST (partial_clip_text_top, "Tests drawing text through a single, partial clip.", "clip, text", /* keywords */ NULL, /* requirements */ - 40, 15, - NULL, draw) + WIDTH, HEIGHT, + NULL, top) +CAIRO_TEST (partial_clip_text_bottom, + "Tests drawing text through a single, partial clip.", + "clip, text", /* keywords */ + NULL, /* requirements */ + WIDTH, HEIGHT, + NULL, bottom) +CAIRO_TEST (partial_clip_text_left, + "Tests drawing text through a single, partial clip.", + "clip, text", /* keywords */ + NULL, /* requirements */ + WIDTH, HEIGHT, + NULL, left) +CAIRO_TEST (partial_clip_text_right, + "Tests drawing text through a single, partial clip.", + "clip, text", /* keywords */ + NULL, /* requirements */ + WIDTH, HEIGHT, + NULL, right) diff --git a/test/partial-clip-text.ref.png b/test/partial-clip-text.ref.png deleted file mode 100644 index 6deaf752b..000000000 Binary files a/test/partial-clip-text.ref.png and /dev/null differ