[test] Add a new, XFAIL, extend-pad test

This commit is contained in:
Behdad Esfahbod 2007-02-22 18:24:19 -05:00
parent 289ac33fa2
commit 2d908e6a95
4 changed files with 78 additions and 0 deletions

1
test/.gitignore vendored
View file

@ -37,6 +37,7 @@ dash-zero-length
degenerate-path
device-offset
device-offset-positive
extend-pad
extend-reflect
fallback-resolution
fallback-resolution.pdf

View file

@ -31,6 +31,7 @@ dash-state \
degenerate-path \
device-offset \
device-offset-positive \
extend-pad \
extend-reflect \
fill-and-stroke \
fill-and-stroke-alpha \
@ -220,6 +221,7 @@ device-offset-ref.png \
device-offset-rgb24-ref.png \
device-offset-positive-ref.png \
device-offset-positive-rgb24-ref.png \
extend-pad-ref.png \
extend-reflect-ref.png \
fill-and-stroke-ref.png \
fill-and-stroke-rgb24-ref.png \
@ -362,6 +364,7 @@ zero-alpha-ref.png
XFAIL_TESTS = \
a8-mask \
big-trap \
extend-pad \
filter-nearest-offset \
long-lines \
self-intersecting \

BIN
test/extend-pad-ref.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

74
test/extend-pad.c Normal file
View file

@ -0,0 +1,74 @@
#include <math.h>
#include "cairo-test.h"
#include <stdio.h>
#define SIZE 90
static cairo_test_draw_function_t draw;
cairo_test_t test = {
"extend-pad",
"Test CAIRO_EXTEND_PAD for surface patterns",
SIZE, SIZE,
draw
};
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *surface;
cairo_t * cr_surface;
int surface_size = (SIZE - 30) / 10;
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_rectangle (cr, 0, 0, SIZE, SIZE);
cairo_fill (cr);
/* Create an image surface with my favorite four colors in each
* quadrant. */
surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
surface_size, surface_size);
cr_surface = cairo_create (surface);
cairo_set_source_rgb (cr_surface, 1, 1, 1);
cairo_rectangle (cr_surface,
0, 0,
surface_size / 2, surface_size / 2);
cairo_fill (cr_surface);
cairo_set_source_rgb (cr_surface, 1, 0, 0);
cairo_rectangle (cr_surface,
surface_size / 2, 0,
surface_size / 2, surface_size / 2);
cairo_fill (cr_surface);
cairo_set_source_rgb (cr_surface, 0, 1, 0);
cairo_rectangle (cr_surface,
0, surface_size / 2,
surface_size / 2, surface_size / 2);
cairo_fill (cr_surface);
cairo_set_source_rgb (cr_surface, 0, 0, 1);
cairo_rectangle (cr_surface,
surface_size / 2, surface_size / 2,
surface_size / 2, surface_size / 2);
cairo_fill (cr_surface);
cairo_destroy (cr_surface);
cairo_scale (cr, 10, 10);
cairo_set_source_surface (cr, surface, 1.5, 1.5);
cairo_surface_destroy (surface);
/* Using EXTEND_REFLECT makes this test pass for image and xlib backends */
/*cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REFLECT);*/
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_PAD);
cairo_rectangle (cr, 1.5, 1.5, 6, 6);
cairo_clip (cr);
cairo_paint (cr);
return CAIRO_TEST_SUCCESS;
}
int
main (void)
{
return cairo_test (&test);
}