From e22c02dbaeda6941083fc89b517508dc0c4386a0 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 15 Jan 2010 12:02:58 +0000 Subject: [PATCH] test: Add degenerate-arcs A simple test to ensure that using degenerate-arcs such as when drawing a rounded rectangle with radii=0 construct a proper path. --- test/Makefile.am | 1 + test/Makefile.sources | 1 + test/degenerate-arcs.c | 57 +++++++++++++++++++++++++++++++++++ test/degenerate-arcs.ref.png | Bin 0 -> 120 bytes 4 files changed, 59 insertions(+) create mode 100644 test/degenerate-arcs.c create mode 100644 test/degenerate-arcs.ref.png diff --git a/test/Makefile.am b/test/Makefile.am index 4e5b2737c..ff81eeee6 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -336,6 +336,7 @@ REFERENCE_IMAGES = \ degenerate-arc.ps3.ref.png \ degenerate-arc.ref.png \ degenerate-arc.xlib.ref.png \ + degenerate-arcs.ref.png \ degenerate-curve-to.ref.png \ degenerate-curve-to.ps.xfail.png \ degenerate-dash.ps.xfail.png \ diff --git a/test/Makefile.sources b/test/Makefile.sources index 0b4ba42ba..d123d3a17 100644 --- a/test/Makefile.sources +++ b/test/Makefile.sources @@ -56,6 +56,7 @@ test_sources = \ dash-state.c \ dash-zero-length.c \ degenerate-arc.c \ + degenerate-arcs.c \ degenerate-curve-to.c \ degenerate-dash.c \ degenerate-path.c \ diff --git a/test/degenerate-arcs.c b/test/degenerate-arcs.c new file mode 100644 index 000000000..2470828bb --- /dev/null +++ b/test/degenerate-arcs.c @@ -0,0 +1,57 @@ +/* + * Copyright 2010 Intel 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 + * 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 + */ + +#include "cairo-test.h" + +#define WIDTH 20 +#define HEIGHT 20 + +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.3, 0.4, 0.5); + + /* This should be equivalent to a simple rectangle, such as may be + * constructed for a rounded-rectangle with corner radii of 0... + */ + cairo_arc (cr, 5, 5, 0, M_PI, 3*M_PI/2); + cairo_arc (cr, 15, 5, 0, 3*M_PI/2, 2*M_PI); + cairo_arc (cr, 15, 15, 0, 0, M_PI/2); + cairo_arc (cr, 5, 15, 0, M_PI/2, M_PI); + + cairo_fill (cr); + + return CAIRO_TEST_SUCCESS; +} + +CAIRO_TEST (degenerate_arcs, + "Tests path construction using a series of degenerate (radius=0) arcs", + "arc, fill", /* keywords */ + NULL, /* requirements */ + WIDTH, HEIGHT, + NULL, draw) diff --git a/test/degenerate-arcs.ref.png b/test/degenerate-arcs.ref.png new file mode 100644 index 0000000000000000000000000000000000000000..fc1869dc1594a5b4a4420c254536e821ecb9b67e GIT binary patch literal 120 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1SFYWcSQjywj^(N7l!{JxM1({$v_cZPZ!4! zi{9iv|Nq-F?`-JInd=;G%q?}_e6L{ttFy+hSEhYl@oeJ4nT00alh_z)1vr&otNwon P)X3oJ>gTe~DWM4f;#Vj3 literal 0 HcmV?d00001