summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-26 23:27:46 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-08-29 17:07:38 +0100
commit92f6f275fcb5407baf908485ffd08b6787b2caf9 (patch)
tree9c2d42f425015360ff3431f29ab2cc2d26a2bc84 /test
parent8078cd194e95a10cf653c970d1ddd39049a511f2 (diff)
[test] Implicit close
This is a simple test that broke with the determination of rectilinearity during path construction. I forgot the implicit close on fill and so the ignored the final diagonal edge and failed to draw the triangle.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am1
-rw-r--r--test/Makefile.sources1
-rw-r--r--test/implicit-close.c54
-rw-r--r--test/implicit-close.ref.pngbin0 -> 251 bytes
4 files changed, 56 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 779f95a4..eab26f0c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -527,6 +527,7 @@ REFERENCE_IMAGES = \
image-surface-source.ref.png \
image-surface-source.svg12.argb32.xfail.png \
image-surface-source.svg12.rgb24.xfail.png \
+ implicit-close.ref.png \
infinite-join.ps2.ref.png \
infinite-join.ps3.ref.png \
infinite-join.ref.png \
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 5494fe90..e99ab0e9 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -96,6 +96,7 @@ test_sources = \
huge-linear.c \
huge-radial.c \
image-surface-source.c \
+ implicit-close.c \
infinite-join.c \
in-fill-empty-trapezoid.c \
in-fill-trapezoid.c \
diff --git a/test/implicit-close.c b/test/implicit-close.c
new file mode 100644
index 00000000..2529bb00
--- /dev/null
+++ b/test/implicit-close.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright © 2009 Chris Wilson
+ *
+ * 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. Chris Wilson 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.
+ *
+ * Author: Chris Wilson <chris@chris-wilson.co.uk>
+ */
+
+#include "cairo-test.h"
+
+#define SIZE 40
+
+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_move_to (cr, SIZE, 0);
+ cairo_rel_line_to (cr, 0, SIZE);
+ cairo_rel_line_to (cr, -SIZE, 0);
+
+ cairo_set_source_rgb (cr, 0, 0, 0);
+ cairo_fill_preserve (cr);
+
+ cairo_set_source_rgb (cr, 1, 0, 0);
+ cairo_stroke (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (implicit_close,
+ "Test implicitly closing paths",
+ "fill", /* keywords */
+ NULL, /* requirements */
+ SIZE, SIZE,
+ NULL, draw)
diff --git a/test/implicit-close.ref.png b/test/implicit-close.ref.png
new file mode 100644
index 00000000..f15f8a3a
--- /dev/null
+++ b/test/implicit-close.ref.png
Binary files differ