test: Expand partial-clip-text
Test partial clipping along each edge. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
@ -869,10 +869,13 @@ REFERENCE_IMAGES = \
|
||||||
paint-with-alpha.ref.png \
|
paint-with-alpha.ref.png \
|
||||||
paint-with-alpha.svg.ref.png \
|
paint-with-alpha.svg.ref.png \
|
||||||
paint.ref.png \
|
paint.ref.png \
|
||||||
partial-clip-text.ps.ref.png \
|
partial-clip-text-bottom.ref.png \
|
||||||
partial-clip-text.quartz.ref.png \
|
partial-clip-text-left.ref.png \
|
||||||
partial-clip-text.ref.png \
|
partial-clip-text-right.ref.png \
|
||||||
partial-clip-text.svg.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-reference.ref.png \
|
||||||
partial-coverage-half-triangles.ref.png \
|
partial-coverage-half-triangles.ref.png \
|
||||||
partial-coverage-intersecting-quads.ref.png \
|
partial-coverage-intersecting-quads.ref.png \
|
||||||
|
|
|
||||||
BIN
test/partial-clip-text-bottom.ref.png
Normal file
|
After Width: | Height: | Size: 263 B |
BIN
test/partial-clip-text-left.ref.png
Normal file
|
After Width: | Height: | Size: 303 B |
BIN
test/partial-clip-text-right.ref.png
Normal file
|
After Width: | Height: | Size: 156 B |
|
Before Width: | Height: | Size: 107 B After Width: | Height: | Size: 107 B |
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 174 B |
BIN
test/partial-clip-text-top.ref.png
Normal file
|
After Width: | Height: | Size: 173 B |
|
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 173 B |
|
|
@ -26,25 +26,95 @@
|
||||||
|
|
||||||
#include "cairo-test.h"
|
#include "cairo-test.h"
|
||||||
|
|
||||||
static cairo_test_status_t
|
#define HEIGHT 15
|
||||||
draw (cairo_t *cr, int width, int height)
|
#define WIDTH 40
|
||||||
|
|
||||||
|
static void background (cairo_t *cr)
|
||||||
{
|
{
|
||||||
cairo_set_source_rgb( cr, 0, 0, 0 );
|
cairo_set_source_rgb( cr, 0, 0, 0 );
|
||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
|
}
|
||||||
|
|
||||||
cairo_rectangle (cr, 0, 0, 40, 5);
|
static void text (cairo_t *cr)
|
||||||
cairo_clip (cr);
|
{
|
||||||
|
|
||||||
cairo_move_to (cr, 0, 12);
|
cairo_move_to (cr, 0, 12);
|
||||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||||
cairo_show_text (cr, "CAIRO");
|
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;
|
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.",
|
"Tests drawing text through a single, partial clip.",
|
||||||
"clip, text", /* keywords */
|
"clip, text", /* keywords */
|
||||||
NULL, /* requirements */
|
NULL, /* requirements */
|
||||||
40, 15,
|
WIDTH, HEIGHT,
|
||||||
NULL, draw)
|
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)
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 175 B |