[cairo-commit] 2 commits - test/line-width-overlap.c test/line-width-overlap.ref.png test/Makefile.sources test/radial-gradient.c

Benjamin Otte company at kemper.freedesktop.org
Thu Feb 17 09:18:25 PST 2011


 test/Makefile.sources           |    1 
 test/line-width-overlap.c       |   72 ++++++++++++++++++++++++++++++++++++++++
 test/line-width-overlap.ref.png |binary
 test/radial-gradient.c          |    2 -
 4 files changed, 74 insertions(+), 1 deletion(-)

New commits:
commit 303f56a2d34a23d933a02fa625873211fb51eb3b
Author: Benjamin Otte <otte at redhat.com>
Date:   Thu Feb 17 18:17:08 2011 +0100

    test: Add line-width-overlap
    
    Test case taken from the WebKit test suite, failure originally reported
    by Zan Dobersek <zandobersek at gmail.com>. WebKit test is
    LayoutTests/canvas/philip/tests/2d.path.rect.selfintersect.html

diff --git a/test/Makefile.sources b/test/Makefile.sources
index 75d2fc5..e88c85c 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -149,6 +149,7 @@ test_sources = \
 	leaky-dashed-stroke.c				\
 	leaky-polygon.c					\
 	line-width.c					\
+	line-width-overlap.c				\
 	line-width-scale.c				\
 	line-width-tolerance.c				\
 	line-width-zero.c				\
diff --git a/test/line-width-overlap.c b/test/line-width-overlap.c
new file mode 100644
index 0000000..cd23d32
--- /dev/null
+++ b/test/line-width-overlap.c
@@ -0,0 +1,72 @@
+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
+/*
+ * Copyright 2011 Red Hat Inc.
+ *
+ * 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: Benjamin Otte <otte at redhat.com>
+ */
+
+/*
+ * Test case taken from the WebKit test suite, failure originally reported
+ * by Zan Dobersek <zandobersek at gmail.com>. WebKit test is
+ * LayoutTests/canvas/philip/tests/2d.path.rect.selfintersect.html
+ */
+
+#include "cairo-test.h"
+
+#include <math.h>
+
+#define LINE_WIDTH 60
+#define SIZE 100
+#define RECT_SIZE 10
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+    /* fill with green so RGB and RGBA tests can share the ref image */
+    cairo_set_source_rgb (cr, 0, 1, 0);
+    cairo_paint (cr);
+
+    /* red to see eventual bugs immediately */
+    cairo_set_source_rgb (cr, 1, 0, 0);
+
+    /* big line width */
+    cairo_set_line_width (cr, LINE_WIDTH);
+
+    /* rectangle that is smaller than the line width in center of image */
+    cairo_rectangle (cr,
+                     (SIZE - RECT_SIZE) / 2, 
+                     (SIZE - RECT_SIZE) / 2,
+                     RECT_SIZE, 
+                     RECT_SIZE);
+
+    cairo_stroke (cr);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (line_width_overlap,
+	    "Test overlapping lines due to large line width",
+	    "stroke", /* keywords */
+	    NULL, /* requirements */
+	    SIZE, SIZE,
+	    NULL, draw)
diff --git a/test/line-width-overlap.ref.png b/test/line-width-overlap.ref.png
new file mode 100644
index 0000000..09911bc
Binary files /dev/null and b/test/line-width-overlap.ref.png differ
commit 937465b15e25cbc37c09861bc33a572440df0cbe
Author: Benjamin Otte <otte at redhat.com>
Date:   Thu Feb 17 18:09:22 2011 +0100

    tests: Fix gcc complaint
    
    warning: ‘static’ is not at beginning of declaration

diff --git a/test/radial-gradient.c b/test/radial-gradient.c
index 3ad4bb9..25ced70 100644
--- a/test/radial-gradient.c
+++ b/test/radial-gradient.c
@@ -78,7 +78,7 @@ typedef void (*add_stops_t)(cairo_pattern_t *pattern);
  *
  */
 
-const static double radiuses[NUM_GRADIENTS] = {
+static const double radiuses[NUM_GRADIENTS] = {
     0.25,
     0.50,
     0.50,


More information about the cairo-commit mailing list