summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2013-09-29 13:12:55 +0200
committerUli Schlachter <psychon@znc.in>2013-10-03 16:58:52 +0200
commitbc89be2fff92968a1b585e75371ae2a8a26592e9 (patch)
tree0737ac4f2df184959d6cd802013e849a2c94a5fd
parent5e6e4536716197ea0605732d32959c57ea8bb140 (diff)
Remove XFAIL_TESTS from Makefile.am
The variable XFAIL_TESTS is not used anymore since commit e90073f7ddc. The description for the known failures are moved into the respective tests as comments. The following descriptions were dropped: - surface-pattern-big: Didn't really explain the failure - big-line: Test isn't failing any more - self-intersecting: Only XFAIL on quartz, but description doesn't match this The following tests don't have a xfail reference image and seem to fail just because of not having a reference image at all (I kept their description for now): big-trap, long-lines, self-copy-overlap Signed-off-by: Uli Schlachter <psychon@znc.in>
-rw-r--r--test/Makefile.am73
-rw-r--r--test/alpha-similar.c74
-rw-r--r--test/big-trap.c92
-rw-r--r--test/degenerate-dash.c90
-rw-r--r--test/degenerate-path.c120
-rw-r--r--test/device-offset-scale.c77
-rw-r--r--test/in-fill-empty-trapezoid.c109
-rw-r--r--test/long-lines.c85
-rw-r--r--test/scale-offset-image.c1
-rw-r--r--test/self-copy-overlap.c54
10 files changed, 702 insertions, 73 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index a9495dc..547e5d2 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -142,79 +142,6 @@ surface-source.c \
testtable.js \
reference
-# Any test for which the code committed to CVS is expected to fail
-# should be listed here.
-#
-# This way, we can avoid being bothered by reports of bugs we are
-# aware of, but users can still report when tests start behaving in
-# unexpected ways on their system.
-#
-# Of course, before any "release" of cairo we should eliminate
-# everything from this list by fixing the bugs. (We don't necessarily
-# have to be that strict for "snapshots" though.)
-#
-# Analysis of XFAIL errors:
-# alpha-similar - discrepancy between backends in applying color
-# components of a pure alpha surface
-# big-line - range overflow of fixed-point
-# big-trap - range overflow of fixed-point
-# degenerate-dash - needs path editing in PS to convert degenerate
-# end-caps into the shapes as expected by cairo
-# (Or maybe PS is the correct behaviour?)
-# degenerate-path - undefined behaviour in PS, needs path editing to
-# convert degenerate segments into circles/rectangles
-# as expected by cairo
-# device-offset-scale - complication of pre-multiplying device_offset
-# into the pattern_matrix and then requiring further
-# manipulation for SVG
-# extend-pad - lacks implementation in pixman and consequently used
-# as an excuse for lack of support in other backends
-# fallback-resolution - The essential problem here is that the recording-surface
-# has recorded a sequence of operations with one device
-# transformation, and we attempt to replay it with
-# another (basically a scale-factor for the falback
-# resolution). Carl begun to look at this with his
-# chain-of-bugs, but the can of worms is much bigger.
-# It appears to be a design flaw in the recording-surface
-# that may spread further...
-# My solution would be to lock Behad and Adrian in a
-# room, with Carl as a moderator and not let them out
-# until they have come up with an interface and
-# semantics that actually work. :-)
-# in-fill-empty-trapezoid The cairo_in_fill () function can sometimes
-# produce false positives when the tessellator
-# produces empty trapezoids and the query
-# point lands exactly on a trapezoid edge.
-# long-lines - range overflow of fixed-point
-# scale-offset-image - loss of precision converting a cairo matrix to
-# scale-offset-similar pixman's fixed point format.
-# self-copy-overlap - vector surfaces take snapshot of patterns in contrast
-# to the raster backends which don't. One solution
-# would be to clone overlapping areas of dst/source, so
-# patterns were effectively snapshotted across all
-# backends.
-# self-intersecting - incremental trapezoidation of strokes can generate
-# overlapping traps. Needs self-intersection analysis
-# on cairo_traps_t after strokes.
-# Test case should also be expanded to hit special-case
-# tessellators as well.
-# surface-pattern-big...- Strange, unexplained results for SVG/PS.
-XFAIL_TESTS = \
-alpha-similar$(EXEEXT) \
-big-line$(EXEEXT) \
-big-trap$(EXEEXT) \
-degenerate-dash$(EXEEXT) \
-degenerate-path$(EXEEXT) \
-device-offset-scale$(EXEEXT) \
-extend-pad$(EXEEXT) \
-fallback-resolution$(EXEEXT) \
-in-fill-empty-trapezoid$(EXEEXT) \
-long-lines$(EXEEXT) \
-self-copy-overlap$(EXEEXT) \
-self-intersecting$(EXEEXT) \
-surface-pattern-big-scale-down$(EXEEXT) \
-$(NULL)
-
# Any test that doesn't generate a log file goes here
NOLOG_TESTS = \
fallback-resolution \
diff --git a/test/alpha-similar.c b/test/alpha-similar.c
index a9411d1..86c6ae3 100644
--- a/test/alpha-similar.c
+++ b/test/alpha-similar.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2008 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"
+
+static cairo_surface_t *
+create_source (cairo_surface_t *target, int width, int height)
+{
+ cairo_surface_t *similar;
+ cairo_t *cr;
+
+ similar = cairo_surface_create_similar (target,
+ CAIRO_CONTENT_ALPHA,
+ width, height);
+ cr = cairo_create (similar);
+ cairo_surface_destroy (similar);
+
+ cairo_set_source_rgba (cr, 1, 0, 0, .5);
+ cairo_paint (cr);
+
+ similar = cairo_surface_reference (cairo_get_target (cr));
+ cairo_destroy (cr);
+
+ return similar;
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *source;
+
+ source = create_source (cairo_get_target (cr), width, height);
+ cairo_set_source_surface (cr, source, 0, 0);
+ cairo_surface_destroy (source);
+
+ cairo_paint (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+/*
+ * XFAIL: discrepancy between backends in applying color components of a pure
+ * alpha surface
+ */
+CAIRO_TEST (alpha_similar,
+ "Tests creation of similar alpha surfaces"
+ "\nApplication of a pure-alpha similar source is inconsistent across backends.",
+ "alpha, similar", /* keywords */
+ NULL, /* requirements */
+ 10, 10,
+ NULL, draw)
+
diff --git a/test/big-trap.c b/test/big-trap.c
index 507e0e5..5e11237 100644
--- a/test/big-trap.c
+++ b/test/big-trap.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright © 2006 Mozilla Corporation
+ *
+ * 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
+ * Mozilla Corporation not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Mozilla Corporation makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * MOZILLA CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL MOZILLA CORPORATION 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: Vladimir Vukicevic <vladimir@pobox.com>
+ */
+
+#include "cairo-test.h"
+
+/* This test was originally written to exercise a bug in pixman in
+ * which it would scribble all over memory when given a particular
+ * (and bogus) trapezoid. However, a recent change to
+ * _cairo_fixed_from_double changed the details of the bogus trapezoid
+ * (it overflows in a different way now), so the bug is being masked.
+ *
+ * According to Vladimir, (http://lists.freedesktop.org/archives/cairo/2006-November/008482.html):
+ *
+ * Before the change, the two trapezoids that were generated were:
+ *
+ * Trap[0]: T: 0x80000000 B: 0x80000003
+ * L: [(0x000a0000, 0x80000000) (0x00080000, 0x00080000)]
+ * R: [(0x01360000, 0x80000000) (0x01380000, 0x00080000)]
+ * Trap[1]: T: 0x80000003 B: 0x00080000
+ * L: [(0x000a0000, 0x80000000) (0x00080000, 0x00080000)]
+ * R: [(0x01360000, 0x80000000) (0x01380000, 0x00080000)]
+ *
+ * After the change, the L/R coordinates are identical for both traps, but
+ * the top and bottom change:
+ *
+ * Trap[0]: t: 0x80000000 b: 0xfda80003
+ * l: [(0x000a0000, 0x80000000) (0x00080000, 0x00080000)]
+ * r: [(0x01360000, 0x80000000) (0x01380000, 0x00080000)]
+ * Trap[1]: t: 0xfda80003 b: 0x00080000
+ * l: [(0x000a0000, 0x80000000) (0x00080000, 0x00080000)]
+ * r: [(0x01360000, 0x80000000) (0x01380000, 0x00080000)]
+ *
+ * I think the fix we want here is to rewrite this test to call
+ * directly into pixman with the trapezoid of interest, (which will
+ * require adding a new way to configure cairo for "testing" which
+ * will prevent the hiding of internal library symbols.
+ */
+
+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_set_source_rgb (cr, 0,0,0);
+
+ /* Note that without the clip, this doesn't crash... */
+ cairo_new_path (cr);
+ cairo_rectangle (cr, 0, 0, width, height);
+ cairo_clip (cr);
+
+ cairo_new_path (cr);
+ cairo_line_to (cr, 8.0, 8.0);
+ cairo_line_to (cr, 312.0, 8.0);
+ cairo_line_to (cr, 310.0, 31378756.2666666666);
+ cairo_line_to (cr, 10.0, 31378756.2666666666);
+ cairo_line_to (cr, 8.0, 8.0);
+ cairo_fill (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+/* XFAIL: range overflow of fixed-point */
+CAIRO_TEST (big_trap,
+ "Test oversize trapezoid with a clip region"
+ "\nTest needs to be adjusted to trigger the original bug",
+ "trap", /* keywords */
+ NULL, /* requirements */
+ 100, 100,
+ NULL, draw)
diff --git a/test/degenerate-dash.c b/test/degenerate-dash.c
index c13792f..12cd0c7 100644
--- a/test/degenerate-dash.c
+++ b/test/degenerate-dash.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright © 2008 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>
+ *
+ * Based on an original test case by M Joonas Pihlaja.
+ */
+
+#include "cairo-test.h"
+
+#define PAD 5
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ const double dashes[] = { 25, 25 };
+ cairo_line_join_t joins[] = {
+ CAIRO_LINE_JOIN_ROUND,
+ CAIRO_LINE_JOIN_MITER,
+ CAIRO_LINE_JOIN_BEVEL
+ };
+ cairo_line_cap_t caps[] = {
+ CAIRO_LINE_CAP_ROUND,
+ CAIRO_LINE_CAP_SQUARE,
+ CAIRO_LINE_CAP_BUTT,
+ };
+ int i, j;
+
+ cairo_set_source_rgb (cr, 1,1,1);
+ cairo_paint (cr);
+
+ cairo_set_source_rgb (cr, 1, 0, 0);
+
+ cairo_set_dash (cr, dashes, 2, 0.);
+ cairo_set_line_width (cr, 10);
+
+ cairo_translate (cr, 5 + PAD, 5 + PAD);
+
+ for (i = 0; i < ARRAY_LENGTH (joins); i++) {
+ cairo_set_line_join (cr, joins[i]);
+ cairo_save (cr);
+
+ for (j = 0; j < ARRAY_LENGTH (caps); j++) {
+ cairo_set_line_cap (cr, caps[j]);
+
+ cairo_move_to (cr, 0, 0);
+ cairo_line_to (cr, 50, 0);
+ cairo_line_to (cr, 50,50);
+ cairo_stroke (cr);
+
+ cairo_translate (cr, 75, 0);
+ }
+ cairo_restore (cr);
+
+ cairo_translate (cr, 0, 75);
+ }
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+/*
+ * XFAIL: needs path editing in PS to convert degenerate
+ * end-caps into the shapes as expected by cairo (Or maybe PS is the correct
+ * behaviour?)
+ */
+CAIRO_TEST (degenerate_dash,
+ "Tests the behaviour of dashed segments that end on a off-on transition",
+ "dash, degenerate", /* keywords */
+ NULL, /* requirementts */
+ 210 + 2*PAD, 210 + 2*PAD,
+ NULL, draw)
diff --git a/test/degenerate-path.c b/test/degenerate-path.c
index c690730..db53cbb 100644
--- a/test/degenerate-path.c
+++ b/test/degenerate-path.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright © 2006 Jeff Muizelaar
+ *
+ * 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
+ * Jeff Muizelaar not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Jeff Muizelaar makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * JEFF MUIZELAAR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL JEFF MUIZELAAR 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: Jeff Muizelaar <jeff@infidigm.net>
+ */
+
+#include "cairo-test.h"
+
+#define PAD 3.0
+#define LINE_WIDTH 6.0
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ const cairo_line_cap_t cap[] = { CAIRO_LINE_CAP_ROUND, CAIRO_LINE_CAP_SQUARE, CAIRO_LINE_CAP_BUTT };
+ size_t i;
+ double dash[] = {2, 2};
+ double dash_long[] = {6, 6};
+
+ cairo_set_source_rgb (cr, 1, 0, 0);
+
+ for (i = 0; i < ARRAY_LENGTH (cap); i++) {
+ cairo_save (cr);
+
+ cairo_set_line_cap (cr, cap[i]);
+
+ /* simple degenerate paths */
+ cairo_set_line_width (cr, LINE_WIDTH);
+ cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_stroke (cr);
+
+ cairo_translate (cr, 0, 3*PAD);
+ cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_close_path (cr);
+ cairo_stroke (cr);
+
+ /* degenerate paths starting with dash on */
+ cairo_set_dash (cr, dash, 2, 0.);
+
+ cairo_translate (cr, 0, 3*PAD);
+ cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_stroke (cr);
+
+ cairo_translate (cr, 0, 3*PAD);
+ cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_close_path (cr);
+ cairo_stroke (cr);
+
+ /* degenerate paths starting with dash off */
+ /* these should not draw anything */
+ cairo_set_dash (cr, dash, 2, 2.);
+
+ cairo_translate (cr, 0, 3*PAD);
+ cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_stroke (cr);
+
+ cairo_translate (cr, 0, 3*PAD);
+ cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_close_path (cr);
+ cairo_stroke (cr);
+
+ /* this should draw a single degenerate sub-path
+ * at the end of the path */
+ cairo_set_dash (cr, dash_long, 2, 6.);
+
+ cairo_translate (cr, 0, 3*PAD);
+ cairo_move_to (cr, LINE_WIDTH + 6.0, LINE_WIDTH);
+ cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_stroke (cr);
+
+ /* this should draw a single degenerate sub-path
+ * at the end of the path. The difference between this
+ * and the above is that this ends with a degenerate sub-path*/
+ cairo_set_dash (cr, dash_long, 2, 6.);
+
+ cairo_translate (cr, 0, 3*PAD);
+ cairo_move_to (cr, LINE_WIDTH + 6.0, LINE_WIDTH);
+ cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
+ cairo_stroke (cr);
+
+ cairo_restore (cr);
+
+ cairo_translate (cr, PAD+LINE_WIDTH+PAD, 0);
+ }
+ return CAIRO_TEST_SUCCESS;
+}
+
+/*
+ * XFAIL: undefined behaviour in PS, needs path editing to convert degenerate
+ * segments into circles/rectangles as expected by cairo
+ */
+CAIRO_TEST (degenerate_path,
+ "Tests the behaviour of degenerate paths with different cap types",
+ "degenerate", /* keywords */
+ NULL, /* requirements */
+ 3*(PAD+LINE_WIDTH+PAD), 8*(LINE_WIDTH+PAD) + PAD,
+ NULL, draw)
diff --git a/test/device-offset-scale.c b/test/device-offset-scale.c
index 3df3d38..33784fa 100644
--- a/test/device-offset-scale.c
+++ b/test/device-offset-scale.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright © 2008 Mozilla Corporation
+ *
+ * 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
+ * Mozilla Corporation not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Mozilla Corporation makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * MOZILLA CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL MOZILLA CORPORATION 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: Michael Ventnor, Jeff Muizelaar
+ */
+
+#include "cairo-test.h"
+
+#define WIDTH 20
+#define HEIGHT 20
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *second;
+ cairo_t *second_cr;
+
+ /* fill with black so we don't need an rgb test case */
+ cairo_set_source_rgb (cr, 0, 0, 0);
+ cairo_paint (cr);
+
+ cairo_scale (cr, 0.5, 0.5);
+
+ /* draw the first rectangle */
+ cairo_set_source_rgb (cr, 0, 0, 0.4);
+ cairo_rectangle (cr, 6, 6, 10, 10);
+ cairo_fill (cr);
+
+ /* adjust the offset so that the second rectangle will fit on the surface */
+ second = cairo_image_surface_create (CAIRO_FORMAT_A8, 10, 10);
+ cairo_surface_set_device_offset (second, -6, -6);
+
+ /* draw the second rectangle:
+ * this rectangle should end up in the same place as the rectangle above
+ * independent of the device offset of the surface it is painted on*/
+ second_cr = cairo_create (second);
+ cairo_surface_destroy (second);
+ cairo_rectangle (second_cr, 6, 6, 10, 10);
+ cairo_fill (second_cr);
+
+ /* paint the second rectangle on top of the first rectangle */
+ cairo_set_source_rgb (cr, 0.5, 0.5, 0);
+ cairo_mask_surface (cr, cairo_get_target (second_cr), 0, 0);
+ cairo_destroy (second_cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+/*
+ * XFAIL: complication of pre-multiplying device_offset into the pattern_matrix
+ * and then requiring further manipulation for SVG
+ */
+CAIRO_TEST (device_offset_scale,
+ "Test that the device-offset transform is transformed by the ctm.",
+ "device-offset", /* keywords */
+ NULL, /* requirements */
+ WIDTH, HEIGHT,
+ NULL, draw)
diff --git a/test/in-fill-empty-trapezoid.c b/test/in-fill-empty-trapezoid.c
index 2b345cb..0797399 100644
--- a/test/in-fill-empty-trapezoid.c
+++ b/test/in-fill-empty-trapezoid.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright © 2006 M Joonas Pihlaja
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
+ */
+
+/* Bug history
+ *
+ * 2006-12-05 M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
+ *
+ * The cairo_in_fill () function can sometimes produce false
+ * positives when the tessellator produces empty trapezoids
+ * and the query point lands exactly on a trapezoid edge.
+ */
+
+#include "cairo-test.h"
+
+static cairo_test_status_t
+preamble (cairo_test_context_t *ctx)
+{
+ int x,y;
+ int width = 10;
+ int height = 10;
+ cairo_surface_t *surf;
+ cairo_t *cr;
+ int false_positive_count = 0;
+ cairo_status_t status;
+ cairo_test_status_t ret;
+
+ surf = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
+ cr = cairo_create (surf);
+ cairo_surface_destroy (surf);
+
+ /* Empty horizontal trapezoid. */
+ cairo_move_to (cr, 0, height/3);
+ cairo_line_to (cr, width, height/3);
+ cairo_close_path (cr);
+
+ /* Empty non-horizontal trapezoid #1. */
+ cairo_move_to (cr, 0, 0);
+ cairo_line_to (cr, width, height/2);
+ cairo_close_path (cr);
+
+ /* Empty non-horizontal trapezoid #2 intersecting #1. */
+ cairo_move_to (cr, 0, height/2);
+ cairo_line_to (cr, width, 0);
+ cairo_close_path (cr);
+
+ status = cairo_status (cr);
+
+ /* Point sample the tessellated path. */
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ if (cairo_in_fill (cr, x, y)) {
+ false_positive_count++;
+ }
+ }
+ }
+ cairo_destroy (cr);
+
+ /* Check that everything went well. */
+ ret = CAIRO_TEST_SUCCESS;
+ if (CAIRO_STATUS_SUCCESS != status) {
+ cairo_test_log (ctx, "Failed to create a test surface and path: %s\n",
+ cairo_status_to_string (status));
+ ret = CAIRO_TEST_XFAILURE;
+ }
+
+ if (0 != false_positive_count) {
+ cairo_test_log (ctx, "Point sampling found %d false positives "
+ "from cairo_in_fill()\n",
+ false_positive_count);
+ ret = CAIRO_TEST_XFAILURE;
+ }
+
+ return ret;
+}
+
+/*
+ * XFAIL: The cairo_in_fill () function can sometimes produce false positives
+ * when the tessellator produces empty trapezoids and the query point lands
+ * exactly on a trapezoid edge.
+ */
+CAIRO_TEST (in_fill_empty_trapezoid,
+ "Test that the tessellator isn't producing obviously empty trapezoids",
+ "in, trap", /* keywords */
+ NULL, /* requirements */
+ 0, 0,
+ preamble, NULL)
diff --git a/test/long-lines.c b/test/long-lines.c
index 79fc98f..69b64e9 100644
--- a/test/long-lines.c
+++ b/test/long-lines.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * 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
+ * Red Hat, Inc. 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.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org>
+ * Emmanuel Pacaud <emmanuel.pacaud@lapp.in2p3.fr>
+ */
+
+#include "cairo-test.h"
+
+#define LINE_WIDTH 1.
+#define SIZE 10
+#define LINE_NBR 6
+
+struct {
+ double length;
+ double red, green, blue;
+} lines[LINE_NBR] = {
+ { 100.0, 1.0, 0.0, 0.0 },
+ { 10000.0, 0.0, 1.0, 0.0 },
+ { 100000.0, 0.0, 0.0, 1.0 },
+ { 1000000.0, 1.0, 1.0, 0.0 },
+ { 10000000.0, 0.0, 1.0, 1.0 },
+ { 100000000.0, 1.0, 0.0, 1.0 }
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ double pos;
+ int i;
+
+ /* We draw in the default black, so paint white first. */
+ cairo_save (cr);
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
+ cairo_paint (cr);
+ cairo_restore (cr);
+
+ cairo_set_line_width (cr, LINE_WIDTH);
+
+ pos = SIZE + .5;
+ for (i = 0; i < LINE_NBR; i++) {
+ cairo_move_to (cr, pos, -lines[i].length);
+ cairo_line_to (cr, pos, +lines[i].length);
+ cairo_set_source_rgb (cr, lines[i].red, lines[i].green, lines[i].blue);
+ cairo_stroke (cr);
+ pos += SIZE;
+ }
+
+ /* This should display a perfect vertically centered black line */
+ cairo_move_to (cr, 0.5, -1e100);
+ cairo_line_to (cr, pos, 1e100);
+ cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+ cairo_stroke (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+/* XFAIL: range overflow of fixed-point */
+CAIRO_TEST (long_lines,
+ "Test long lines"
+ "\nLong lines are not drawn due to the limitations of the internal 16.16 fixed-point coordinates",
+ "stroke, stress", /* keywords */
+ NULL, /* requirements */
+ SIZE * (LINE_NBR + 1), SIZE * (LINE_NBR + 1),
+ NULL, draw)
+
diff --git a/test/scale-offset-image.c b/test/scale-offset-image.c
index a6e575a..7243a06 100644
--- a/test/scale-offset-image.c
+++ b/test/scale-offset-image.c
@@ -133,6 +133,7 @@ draw (cairo_t *cr, int width, int height)
return CAIRO_TEST_SUCCESS;
}
+/* XFAIL: loss of precision converting a cairo matrix to */
CAIRO_TEST (scale_offset_image,
"Tests drawing surfaces under various scales and transforms",
"surface, scale-offset", /* keywords */
diff --git a/test/self-copy-overlap.c b/test/self-copy-overlap.c
index 2f49ab0..6e3b39c 100644
--- a/test/self-copy-overlap.c
+++ b/test/self-copy-overlap.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 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>
+ */
+
+/* Question: are patterns mutable? The answer depends on who you ask... */
+
+#include "cairo-test.h"
+
+/* This test is only interesting if the target has alpha */
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_set_source_rgba (cr, 0, 0, 0, .01);
+ cairo_paint (cr);
+
+ cairo_set_source_surface (cr, cairo_get_target (cr), 1, 1);
+ cairo_paint (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+/*
+ * XFAIL: vector surfaces take snapshot of patterns in contrast to the raster
+ * backends which don't. One solution would be to clone overlapping areas of
+ * dst/source, so patterns were effectively snapshotted across all backends.
+ */
+CAIRO_TEST (self_copy_overlap,
+ "Tests painting to itself using itself as the source"
+ "\nBackends treat this case inconsistently---vector backends are creating snapshots.",
+ "self-copy", /* keywords */
+ NULL, /* requirements */
+ 200, 200,
+ NULL, draw)