summaryrefslogtreecommitdiff
path: root/test/extend-pad.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2007-02-22 18:24:19 -0500
committerBehdad Esfahbod <behdad@behdad.org>2007-02-23 17:26:43 -0500
commit2d908e6a957c8b1e7f369621aaace2fc7277a941 (patch)
tree63524a909e2543de290b3e678af355198172c3a1 /test/extend-pad.c
parent289ac33fa28216cc6cc3e3d415cc4ff96cb17e12 (diff)
[test] Add a new, XFAIL, extend-pad test
Diffstat (limited to 'test/extend-pad.c')
-rw-r--r--test/extend-pad.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/test/extend-pad.c b/test/extend-pad.c
new file mode 100644
index 00000000..a59138e6
--- /dev/null
+++ b/test/extend-pad.c
@@ -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);
+}