test: Extend rotate-image-surface-paint

Apply two common clipping methods just to add a little bit of further
complication.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-08-19 12:22:52 +01:00
parent 9f6820210d
commit 2134306eaf
4 changed files with 78 additions and 0 deletions

View file

@ -193,6 +193,7 @@ REFERENCE_IMAGES = \
clip-push-group.ref.png \
clip-push-group.svg.ref.png \
clip-push-group.xlib.ref.png \
clip-rotate-image-surface-paint.ref.png \
clip-shape.image16.ref.png \
clip-shape.ps.ref.png \
clip-shape.quartz.ref.png \
@ -1080,6 +1081,7 @@ REFERENCE_IMAGES = \
rel-path.ref.png \
rel-path.rgb24.ref.png \
rgb24-ignore-alpha.ref.png \
rotate-clip-image-surface-paint.ref.png \
rotate-image-surface-paint.pdf.xfail.png \
rotate-image-surface-paint.ps.ref.png \
rotate-image-surface-paint.quartz.ref.png \
@ -1288,6 +1290,9 @@ REFERENCE_IMAGES = \
svg-surface-source.rgb24.ref.png \
svg-surface-source.svg12.argb32.xfail.png \
svg-surface-source.svg12.rgb24.xfail.png \
test-fallback16-surface-source.ps.ref.png \
test-fallback16-surface-source.svg12.argb32.xfail.png \
test-fallback16-surface-source.svg12.rgb24.xfail.png \
text-antialias-gray.image16.ref.png \
text-antialias-gray.quartz.ref.png \
text-antialias-gray.ref.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

View file

@ -90,6 +90,64 @@ draw (cairo_t *cr, int width, int height)
return CAIRO_TEST_SUCCESS;
}
static cairo_test_status_t
clip_draw (cairo_t *cr, int width, int height)
{
cairo_pattern_t *source;
int surface_size = sqrt ((SIZE - 2*PAD)*(SIZE - 2*PAD)/2);
/* Use a gray (neutral) background, so we can spot if the backend pads
* with any other colour.
*/
cairo_set_source_rgb (cr, .5, .5, .5);
cairo_paint (cr);
cairo_rectangle (cr, 2*PAD, 2*PAD, SIZE-4*PAD, SIZE-4*PAD);
cairo_clip (cr);
cairo_translate(cr, SIZE/2, SIZE/2);
cairo_rotate (cr, M_PI / 4.0);
cairo_translate (cr, -surface_size/2, -surface_size/2);
source = create_image_source (surface_size);
cairo_pattern_set_filter (source, CAIRO_FILTER_NEAREST);
cairo_set_source(cr, source);
cairo_pattern_destroy (source);
cairo_paint (cr);
return CAIRO_TEST_SUCCESS;
}
static cairo_test_status_t
draw_clip (cairo_t *cr, int width, int height)
{
cairo_pattern_t *source;
int surface_size = sqrt ((SIZE - 2*PAD)*(SIZE - 2*PAD)/2);
/* Use a gray (neutral) background, so we can spot if the backend pads
* with any other colour.
*/
cairo_set_source_rgb (cr, .5, .5, .5);
cairo_paint (cr);
cairo_translate(cr, SIZE/2, SIZE/2);
cairo_rotate (cr, M_PI / 4.0);
cairo_translate (cr, -surface_size/2, -surface_size/2);
cairo_rectangle (cr, PAD, PAD, surface_size-2*PAD, surface_size-2*PAD);
cairo_clip (cr);
source = create_image_source (surface_size);
cairo_pattern_set_filter (source, CAIRO_FILTER_NEAREST);
cairo_set_source(cr, source);
cairo_pattern_destroy (source);
cairo_paint (cr);
return CAIRO_TEST_SUCCESS;
}
CAIRO_TEST (rotate_image_surface_paint,
"Test call sequence: image_surface_create; rotate; set_source_surface; paint"
"\nThis test is known to fail on the ps backend currently",
@ -97,3 +155,18 @@ CAIRO_TEST (rotate_image_surface_paint,
NULL, /* requirements */
SIZE, SIZE,
NULL, draw)
CAIRO_TEST (clip_rotate_image_surface_paint,
"Test call sequence: image_surface_create; rotate; set_source_surface; paint"
"\nThis test is known to fail on the ps backend currently",
"image, transform, paint", /* keywords */
NULL, /* requirements */
SIZE, SIZE,
NULL, clip_draw)
CAIRO_TEST (rotate_clip_image_surface_paint,
"Test call sequence: image_surface_create; rotate; set_source_surface; paint"
"\nThis test is known to fail on the ps backend currently",
"image, transform, paint", /* keywords */
NULL, /* requirements */
SIZE, SIZE,
NULL, draw_clip)