1 /* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
3 * Copyright 2010 Andrea Canciani
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without
8 * restriction, including without limitation the rights to use, copy,
9 * modify, merge, publish, distribute, sublicense, and/or sell copies
10 * of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * Author: Andrea Canciani <ranma42@gmail.com>
28 #include "cairo-test.h"
33 When cairo_arc is used to draw an arc of more than 2pi radians
34 (i.e. a circle "looping over itself"), various different behaviors
37 - draw exactly a circle (an arc of 2pi radians)
39 - draw an arc such that the current point is the expected one and
40 that does at least a complete circle (an arc of [2pi, 4pi)
43 - draw an arc with the original number of loops
45 This test produces different results for each of these three cases.
48 static cairo_test_status_t
49 draw (cairo_t *cr, int width, int height)
51 double dashes[] = { 0.3, 7 };
53 cairo_set_source_rgb (cr, 1, 1, 1);
58 cairo_translate (cr, SIZE * .5, SIZE * .5);
59 cairo_scale (cr, SIZE * 3 / 8., SIZE * 3 / 8.);
61 cairo_arc (cr, 0, 0, 1, 0, 11 * M_PI);
63 cairo_set_line_width (cr, 8. / SIZE);
65 cairo_set_source_rgb (cr, 0, 0, 0);
66 cairo_set_dash (cr, dashes, 2, 0);
71 return CAIRO_TEST_SUCCESS;
74 CAIRO_TEST (arc_looping_dash,
75 "Test cairo_arc for angles describing more than a complete circle",
77 NULL, /* requirements */