[test] Add test case for a leaky dashed rectangle.
[cairo/haiku.git] / test / infinite-join.c
blob74d4206fae3e631fe72877c7a49281c19ce4aa2d
1 /*
2 * Copyright © 2006 Red Hat, Inc.
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of the
9 * copyright holders not be used in advertising or publicity
10 * pertaining to distribution of the software without specific,
11 * written prior permission. The copyright holders make no
12 * representations about the suitability of this software for any
13 * purpose. It is provided "as is" without express or implied
14 * warranty.
16 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
21 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
22 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
23 * SOFTWARE.
25 * Author: Carl D. Worth <cworth@cworth.org>
28 /* Test case for bug #8379:
30 * infinite loop when stroking
31 * https://bugs.freedesktop.org/show_bug.cgi?id=8379
34 #include "cairo-test.h"
36 static cairo_test_draw_function_t draw;
38 cairo_test_t test = {
39 "infinite-join",
40 "Test case for infinite loop when stroking with round joins",
41 8, 8,
42 draw
45 static cairo_test_status_t
46 draw (cairo_t *cr, int width, int height)
48 /* Paint white, then draw in black. */
49 cairo_set_source_rgb (cr, 1, 1, 1); /* white */
50 cairo_paint (cr);
51 cairo_set_source_rgb (cr, 0, 0, 0); /* black */
53 cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
55 /* scaling 2 times causes a slight rounding error in the ctm.
56 * Without that, the bug doesn't happen. */
57 cairo_scale (cr, 20 / 100., 20 / 100.);
58 cairo_scale (cr, 1. / 20, 1. / 20);
60 cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
61 cairo_set_line_width (cr, 20);
63 cairo_translate (cr, -18300, -13200);
65 cairo_new_path (cr);
66 cairo_move_to (cr, 18928, 13843);
67 cairo_line_to (cr, 18500, 13843);
68 cairo_line_to (cr, 18500, 13400);
69 cairo_line_to (cr, 18928, 13400);
70 cairo_line_to (cr, 18928, 13843);
71 cairo_stroke (cr);
73 return 0;
76 int
77 main (void)
79 return cairo_test (&test);