1
/*
2
 * Copyright © 2008 Chris Wilson
3
 *
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
9
 * Chris Wilson not be used in advertising or publicity pertaining to
10
 * distribution of the software without specific, written prior
11
 * permission. Chris Wilson makes no representations about the
12
 * suitability of this software for any purpose.  It is provided "as
13
 * is" without express or implied warranty.
14
 *
15
 * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
16
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17
 * FITNESS, IN NO EVENT SHALL CHRIS WILSON BE LIABLE FOR ANY SPECIAL,
18
 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
19
 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
21
 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22
 *
23
 * Author: Chris Wilson <chris@chris-wilson.co.uk>
24
 */
25

            
26
/* Extracted from a test case reported by Jeff Muizelaar found whilst running
27
 * firefox http://people.mozilla.com/~jmuizelaar/BerlinDistricts-check.svg
28
 */
29

            
30
#include "cairo-test.h"
31

            
32
#define WIDTH 205
33
#define HEIGHT 260
34

            
35
static cairo_test_status_t
36
3
draw (cairo_t *cr, int width, int height)
37
{
38
3
    const double dash[2] = {.5, .5};
39

            
40
3
    cairo_set_source_rgb (cr, 1, 1, 1);
41
3
    cairo_paint (cr);
42

            
43
3
    cairo_set_source_rgb (cr, 1., 0., 0);
44

            
45
    /* By adjusting the miter limit, we can see variations on the artifact.
46
     * cairo_set_miter_limit (cr, 4.);
47
     */
48

            
49
3
    cairo_translate (cr, -720, -484);
50
3
    cairo_scale (cr, 2.5, 2.5);
51

            
52
3
    cairo_set_dash (cr, dash, 2, 0);
53

            
54
3
    cairo_move_to (cr, 293.622, 330);
55
3
    cairo_line_to (cr, 293.703, 337.028);
56
3
    cairo_line_to (cr, 297.45, 336.851);
57
3
    cairo_line_to (cr, 308.88, 342.609);
58
3
    cairo_line_to (cr, 309.736, 346.107);
59
3
    cairo_line_to (cr, 312.972, 348.128);
60
3
    cairo_line_to (cr, 312.977, 353.478);
61
3
    cairo_line_to (cr, 322.486, 359.355);
62
3
    cairo_line_to (cr, 320.831, 363.642);
63
3
    cairo_line_to (cr, 315.175, 367.171);
64
3
    cairo_line_to (cr, 308.987, 365.715);
65
3
    cairo_line_to (cr, 301.3, 365.964);
66
3
    cairo_line_to (cr, 304.712, 368.852);
67
3
    cairo_line_to (cr, 305.349, 373.022);
68
3
    cairo_line_to (cr, 303.211, 376.551);
69
3
    cairo_line_to (cr, 304.915, 382.855);
70
3
    cairo_line_to (cr, 323.715, 400.475);
71
3
    cairo_line_to (cr, 355.323, 424.072);
72
3
    cairo_line_to (cr, 443.078, 426.534);
73
3
    cairo_line_to (cr, 455.26, 400.603);
74
3
    cairo_line_to (cr, 471.924, 392.604);
75
3
    cairo_line_to (cr, 478.556, 390.797);
76
3
    cairo_line_to (cr, 477.715, 386);
77
3
    cairo_line_to (cr, 456.807, 376.507);
78
3
    cairo_line_to (cr, 449.134, 368.722);
79
3
    cairo_line_to (cr, 449.147, 365.847);
80
3
    cairo_line_to (cr, 439.981, 361.692);
81
3
    cairo_line_to (cr, 439.994, 358.603);
82
3
    cairo_line_to (cr, 454.645, 336.128);
83
3
    cairo_line_to (cr, 434.995, 324.005);
84
3
    cairo_line_to (cr, 423.884, 319.354);
85
3
    cairo_line_to (cr, 421.098, 312.569);
86
3
    cairo_line_to (cr, 424.291, 305.997);
87
3
    cairo_line_to (cr, 431.308, 305.069);
88
3
    cairo_line_to (cr, 437.257, 296.882);
89
3
    cairo_line_to (cr, 448.544, 296.808);
90
3
    cairo_line_to (cr, 452.113, 290.651);
91
3
    cairo_line_to (cr, 448.469, 285.483);
92
3
    cairo_line_to (cr, 442.903, 282.877);
93
3
    cairo_line_to (cr, 447.798, 281.124);
94
3
    cairo_line_to (cr, 454.622, 274.911);
95
3
    cairo_line_to (cr, 449.491, 269.978);
96
3
    cairo_line_to (cr, 443.666, 253.148);
97
3
    cairo_line_to (cr, 445.741, 250.834);
98
3
    cairo_line_to (cr, 441.87, 247.131);
99
3
    cairo_line_to (cr, 436.932, 246.203);
100
3
    cairo_line_to (cr, 430.5, 251.252);
101
3
    cairo_line_to (cr, 427.483, 250.751);
102
3
    cairo_line_to (cr, 427.26, 253.572);
103
3
    cairo_line_to (cr, 423.621, 255.539);
104
3
    cairo_line_to (cr, 423.824, 257.933);
105
3
    cairo_line_to (cr, 425.239, 259.582);
106
3
    cairo_line_to (cr, 422.385, 261.443);
107
3
    cairo_line_to (cr, 421.665, 260.53);
108
3
    cairo_line_to (cr, 419.238, 262.819);
109
3
    cairo_line_to (cr, 418.731, 257.849);
110
3
    cairo_line_to (cr, 419.72, 255.227);
111
3
    cairo_line_to (cr, 418.786, 250.258);
112
3
    cairo_line_to (cr, 405.685, 235.254);
113
3
    cairo_line_to (cr, 427.167, 215.127);
114
3
    cairo_line_to (cr, 413.852, 196.281);
115
3
    cairo_line_to (cr, 420.177, 192.379);
116
3
    cairo_line_to (cr, 419.885, 185.701);
117
3
    cairo_line_to (cr, 413.401, 185.428);
118
3
    cairo_line_to (cr, 407.985, 186.863);
119
3
    cairo_line_to (cr, 397.11, 189.112);
120
3
    cairo_line_to (cr, 390.505, 186.664);
121
3
    cairo_line_to (cr, 388.527, 183.694);
122
3
    cairo_line_to (cr, 336.503, 221.048);
123
3
    cairo_line_to (cr, 367.028, 241.656);
124
3
    cairo_line_to (cr, 365.103, 244.117);
125
3
    cairo_line_to (cr, 364.886, 246.792);
126
3
    cairo_line_to (cr, 361.467, 247.119);
127
3
    cairo_line_to (cr, 360.396, 245.525);
128
3
    cairo_line_to (cr, 356.336, 245.638);
129
3
    cairo_line_to (cr, 353.344, 242.122);
130
3
    cairo_line_to (cr, 347.149, 242.876);
131
3
    cairo_line_to (cr, 341.809, 256.652);
132
3
    cairo_line_to (cr, 342.232, 268.72);
133
3
    cairo_line_to (cr, 329.579, 269.095);
134
3
    cairo_line_to (cr, 327.001, 271.009);
135
3
    cairo_line_to (cr, 325.579, 275.598);
136
3
    cairo_line_to (cr, 318.941, 277.313);
137
3
    cairo_line_to (cr, 306.048, 277.231);
138
3
    cairo_line_to (cr, 304.071, 276.27);
139
3
    cairo_line_to (cr, 301.153, 277.175);
140
3
    cairo_line_to (cr, 293.52, 277.529);
141
3
    cairo_line_to (cr, 290.682, 281.947);
142
3
    cairo_line_to (cr, 293.911, 286.63);
143
3
    cairo_line_to (cr, 302.417, 290.547);
144
3
    cairo_line_to (cr, 303.521, 294.73);
145
3
    cairo_line_to (cr, 307.787, 298.088);
146
3
    cairo_line_to (cr, 311.718, 299.126);
147
3
    cairo_line_to (cr, 313.255, 302.146);
148
3
    cairo_line_to (cr, 314.6, 306.206);
149
3
    cairo_line_to (cr, 322.603, 308.96);
150
3
    cairo_line_to (cr, 321.718, 314.477);
151
3
    cairo_line_to (cr, 319.596, 320.341);
152
3
    cairo_line_to (cr, 300.689, 323.69);
153
3
    cairo_line_to (cr, 301.232, 326.789);
154
3
    cairo_line_to (cr, 293.622, 330);
155
3
    cairo_close_path (cr);
156

            
157
3
    cairo_stroke (cr);
158
3
    return CAIRO_TEST_SUCCESS;
159
}
160

            
161
1
CAIRO_TEST (leaky_dashed_stroke,
162
	    "Exercises bug in which a dashed stroke leaks in from outside the surface",
163
	    "dash, stroke", /* keywords */
164
	    NULL, /* requirements */
165
	    WIDTH, HEIGHT,
166
	    NULL, draw)