From ebc1cd91f80ee154c02651b2db034a4335ca021c Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sat, 20 Jan 2007 00:50:38 -0800 Subject: [PATCH] Add rotate-image-surface-paint test case This test exercises a clone_similar extents bug noticed by Benjamin Otte. As expected, the xlib backend fails due to that bug, (and interestingly, the ps backend is showing a failure as well). --- test/.gitignore | 1 + test/Makefile.am | 1 + ...ate-image-surface-paint-pdf-argb32-ref.png | Bin 0 -> 209 bytes test/rotate-image-surface-paint-ref.png | Bin 0 -> 232 bytes test/rotate-image-surface-paint-svg-ref.png | Bin 0 -> 248 bytes test/rotate-image-surface-paint.c | 97 ++++++++++++++++++ 6 files changed, 99 insertions(+) create mode 100644 test/rotate-image-surface-paint-pdf-argb32-ref.png create mode 100644 test/rotate-image-surface-paint-ref.png create mode 100644 test/rotate-image-surface-paint-svg-ref.png create mode 100644 test/rotate-image-surface-paint.c diff --git a/test/.gitignore b/test/.gitignore index 36ea1d0a8..3bac97378 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -107,6 +107,7 @@ pthread-show-text rectangle-rounding-error rectilinear-stroke rel-path +rotate-image-surface-paint scale-down-source-surface-paint scale-source-surface-paint select-font-face diff --git a/test/Makefile.am b/test/Makefile.am index 4f432ada8..8d31419e5 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -72,6 +72,7 @@ pixman-rotate \ random-intersections \ rectangle-rounding-error \ rectilinear-stroke \ +rotate-image-surface-paint \ scale-down-source-surface-paint \ scale-source-surface-paint \ select-font-face \ diff --git a/test/rotate-image-surface-paint-pdf-argb32-ref.png b/test/rotate-image-surface-paint-pdf-argb32-ref.png new file mode 100644 index 0000000000000000000000000000000000000000..c12ae8fd5fe1f2b6194e6df829cb7bf5998cb9bb GIT binary patch literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1SFYWcSQjy=3*z$5DpHG+YkL80J)u>E{-7< zy?4(W@*P$XU^x(Kmt3!un(^IzXYu*@=B>g91Xv41D_tA?cvds(iBD4T_wt;ytaj4n zx~HquVx~{=gtgTe~DWM4f>VsIF literal 0 HcmV?d00001 diff --git a/test/rotate-image-surface-paint-svg-ref.png b/test/rotate-image-surface-paint-svg-ref.png new file mode 100644 index 0000000000000000000000000000000000000000..5a75aef2feced7f0fb65c4c76cc298abb85af581 GIT binary patch literal 248 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VORn6mB{l<<}<`n``ssA<813t9KP8!UL$bmCcOZMY-5rC&6o_3MSA z9J6X3CxO1hb^+J4Q=ddU{rrzd + */ + +#include "cairo-test.h" + +static cairo_test_draw_function_t draw; + +#define SIZE 20 +#define PAD 2 + +cairo_test_t test = { + "rotate-image-surface-paint", + "Test call sequence: image_surface_create; rotate; set_source_surface; paint", + SIZE, SIZE, + draw +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_surface_t *surface; + int surface_size = sqrt ((SIZE - 2*PAD)*(SIZE - 2*PAD)/2); + cairo_t *cr_surface; + + /* 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); + + /* First paint opaque background (black) so we don't need separate + * ARGB32 and RGB24 reference images. */ + cairo_set_source_rgb (cr, 0, 0, 0); /* black */ + 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_set_source_surface (cr, surface, 0, 0); + cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST); + cairo_paint (cr); + + cairo_surface_destroy (surface); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test); +}