diff options
author | Benjamin Otte <otte@redhat.com> | 2011-02-17 18:17:08 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2011-02-17 18:17:08 +0100 |
commit | 303f56a2d34a23d933a02fa625873211fb51eb3b (patch) | |
tree | 8f4fc5e3cbdec0576daa4e605edbb40007a40959 | |
parent | 937465b15e25cbc37c09861bc33a572440df0cbe (diff) |
test: Add line-width-overlap
Test case taken from the WebKit test suite, failure originally reported
by Zan Dobersek <zandobersek@gmail.com>. WebKit test is
LayoutTests/canvas/philip/tests/2d.path.rect.selfintersect.html
-rw-r--r-- | test/Makefile.sources | 1 | ||||
-rw-r--r-- | test/line-width-overlap.c | 72 | ||||
-rw-r--r-- | test/line-width-overlap.ref.png | bin | 0 -> 296 bytes |
3 files changed, 73 insertions, 0 deletions
diff --git a/test/Makefile.sources b/test/Makefile.sources index 75d2fc531..e88c85cc5 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 000000000..cd23d32db --- /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@redhat.com> + */ + +/* + * Test case taken from the WebKit test suite, failure originally reported + * by Zan Dobersek <zandobersek@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 Binary files differnew file mode 100644 index 000000000..09911bc51 --- /dev/null +++ b/test/line-width-overlap.ref.png |