summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-06-19 19:00:39 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-06-19 19:08:29 +0100
commit851c8839622619779c9169299e3efccd108d0395 (patch)
tree99d544cf1b8761f5560382078105a8b3945b06e6
parent0a34abace781976b92287dd07daa2b41e168c4f6 (diff)
downloadcairo-851c8839622619779c9169299e3efccd108d0395.tar.gz
[test] Add group-clip
Larry Ewing found an ancient and nasty bug whereby a path was not corrected whilst pushing and popping groups.
-rw-r--r--AUTHORS1
-rw-r--r--test/Makefile.am1
-rw-r--r--test/Makefile.sources1
-rw-r--r--test/group-clip.c57
-rw-r--r--test/group-clip.ref.pngbin0 -> 191 bytes
5 files changed, 60 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index 7f7b0d188..39a31795c 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -23,6 +23,7 @@ John Ellson <ellson@research.att.com> First font/glyph extents functions
Michael Emmel <mike.emmel@gmail.com> DirectFB backend
Miklós Erdélyi <erdelyim@gmail.com> Fix typo leading to a crash
Behdad Esfahbod <behdad@behdad.org> Huge piles of bug fixes, improvements, and general maintenance
+Larry Ewing <lewing@novell.com> Test case for group-clip
Brian Ewins <Brian.Ewins@gmail.com> ATSUI maintenance (first success at making it really work)
Bertram Felgenhauer <int-e@gmx.de> Fixes for subtle arithmetic errors
Damian Frank <damian.frank@gmail.com> Build system improvements for win32
diff --git a/test/Makefile.am b/test/Makefile.am
index ff4d58888..a2275a4c7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -500,6 +500,7 @@ REFERENCE_IMAGES = \
gradient-constant-alpha.rgb24.ref.png \
gradient-zero-stops.ref.png \
gradient-zero-stops.rgb24.ref.png \
+ group-clip.ref.png \
group-paint.ref.png \
huge-linear.ps3.ref.png \
huge-linear.ref.png \
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 4604b1fff..64c6d043d 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -79,6 +79,7 @@ test_sources = \
gradient-alpha.c \
gradient-constant-alpha.c \
gradient-zero-stops.c \
+ group-clip.c \
group-paint.c \
huge-linear.c \
huge-radial.c \
diff --git a/test/group-clip.c b/test/group-clip.c
new file mode 100644
index 000000000..b99d8617e
--- /dev/null
+++ b/test/group-clip.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright © Chris Wilson, 2008
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Chris Wilson not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL CHRIS WILSON BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Chris Wilson <chris@chris-wilson.co.uk>
+ * Larry Ewing <lewing@novell.com>
+ */
+
+#include "cairo-test.h"
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_paint (cr);
+
+ cairo_rectangle (cr, 25, 25, width, height);
+ cairo_clip_preserve (cr);
+ cairo_push_group (cr);
+ cairo_set_source_rgb (cr, 0, 0, 1);
+ cairo_fill (cr);
+ cairo_rectangle (cr, 0, 0, width, height);
+ cairo_pop_group_to_source (cr);
+ cairo_paint (cr);
+
+ cairo_reset_clip (cr);
+ cairo_clip_preserve (cr);
+ cairo_set_source_rgba (cr, 1, 0, 0, .5);
+ cairo_paint (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (group_clip,
+ "test preserving paths across groups",
+ "group", /* keywords */
+ NULL, /* requirements */
+ 40 + 25, 40 + 25,
+ NULL, draw)
diff --git a/test/group-clip.ref.png b/test/group-clip.ref.png
new file mode 100644
index 000000000..7b8a7532f
--- /dev/null
+++ b/test/group-clip.ref.png
Binary files differ