2 * Copyright © 2007 Keith Packard
4 * This library is free software; you can redistribute it and/or
5 * modify it either under the terms of the GNU Lesser General Public
6 * License version 2.1 as published by the Free Software Foundation
7 * (the "LGPL") or, at your option, under the terms of the Mozilla
8 * Public License Version 1.1 (the "MPL"). If you do not alter this
9 * notice, a recipient may use your version of this file under either
10 * the MPL or the LGPL.
12 * You should have received a copy of the LGPL along with this library
13 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 * You should have received a copy of the MPL along with this library
16 * in the file COPYING-MPL-1.1
18 * The contents of this file are subject to the Mozilla Public License
19 * Version 1.1 (the "License"); you may not use this file except in
20 * compliance with the License. You may obtain a copy of the License at
21 * http://www.mozilla.org/MPL/
23 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
24 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
25 * the specific language governing rights and limitations.
27 * The Original Code is the cairo graphics library.
29 * The Initial Developer of the Original Code is Keith Packard
32 * Keith Packard <keithp@keithp.com>
34 #include "cairo-test.h"
36 static cairo_test_status_t
37 draw (cairo_t
*cr
, int width
, int height
)
39 double xscale
, yscale
;
40 cairo_set_source_rgb (cr
, 1, 1, 1);
43 cairo_set_source_rgb (cr
, 0, 0, 0);
44 cairo_set_miter_limit (cr
, 100000);
45 for (xscale
= 1; xscale
<= 1000; xscale
+= 999)
46 for (yscale
= 1; yscale
<= 1000; yscale
+= 999)
48 double max_scale
= xscale
> yscale
? xscale
: yscale
;
51 cairo_translate (cr
, 50, 0);
53 cairo_translate (cr
, 0, 50);
54 cairo_scale (cr
, xscale
, yscale
);
55 cairo_set_line_width (cr
, 10.0 / max_scale
);
56 cairo_move_to (cr
, 10.0 / xscale
, 10.0 / yscale
);
57 cairo_line_to (cr
, 40.0 / xscale
, 10.0 / yscale
);
58 cairo_line_to (cr
, 10.0 / xscale
, 30.0 / yscale
);
63 return CAIRO_TEST_SUCCESS
;
66 CAIRO_TEST (miter_precision
,
67 "test how cairo deals with small miters"
68 "\ncurrent code draws inappropriate bevels at times",
69 "stoke, stress", /* keywords */
70 NULL
, /* requirements */