2 * Copyright © 2009 Nis Martensen
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without fee,
6 * provided that the above copyright notice appear in all copies and
7 * that both that copyright notice and this permission notice appear in
8 * supporting documentation, and that the name of the copyright holder
9 * not be used in advertising or publicity pertaining to distribution of
10 * the software without specific, written prior permission. The
11 * copyright holder makes no representations about the suitability of
12 * this software for any purpose. It is provided "as is" without
13 * express or implied warranty.
15 * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
16 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
18 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
19 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
20 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Author: Nis Martensen <nis.martensen@web.de>
26 #include "cairo-test.h"
30 static cairo_test_status_t
31 draw (cairo_t *cr, int width, int height)
33 /* We draw in the default black, so paint white first. */
35 cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
39 /* subpath starts with cairo_move_to */
40 cairo_new_sub_path (cr);
41 cairo_move_to (cr, SIZE, SIZE);
42 cairo_rel_line_to (cr, SIZE, 0);
43 cairo_rel_line_to (cr, 0, SIZE);
44 cairo_close_path (cr);
45 cairo_rel_line_to (cr, 0.5 * SIZE, SIZE);
47 /* subpath starts with cairo_line_to */
48 cairo_new_sub_path (cr);
49 cairo_line_to (cr, SIZE, 3 * SIZE);
50 cairo_rel_line_to (cr, SIZE, 0);
51 cairo_rel_line_to (cr, 0, SIZE);
52 cairo_close_path (cr);
53 cairo_rel_line_to (cr, 0, SIZE);
55 /* subpath starts with cairo_curve_to */
56 cairo_new_sub_path (cr);
61 cairo_rel_line_to (cr, 0, SIZE);
62 cairo_close_path (cr);
63 cairo_rel_line_to (cr, -0.5 * SIZE, SIZE);
65 /* subpath starts with cairo_arc */
66 cairo_new_sub_path (cr);
71 cairo_rel_line_to (cr, 0, SIZE);
72 cairo_close_path (cr);
73 cairo_rel_line_to (cr, -0.7 * SIZE, 0.7 * SIZE);
75 /* subpath starts with cairo_arc_negative */
76 cairo_new_sub_path (cr);
77 cairo_arc_negative (cr,
81 cairo_rel_line_to (cr, 0, SIZE);
82 cairo_close_path (cr);
83 cairo_rel_line_to (cr, -0.8 * SIZE, 0.3 * SIZE);
87 return CAIRO_TEST_SUCCESS;
90 CAIRO_TEST (close_path_current_point,
91 "Test some corner cases related to cairo path operations and the current point",
92 "path", /* keywords */
93 NULL, /* requirements */