2 * Copyright © 2005 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Keith Packard not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Keith Packard makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
23 #include "cairo-test.h"
27 static cairo_test_draw_function_t draw
;
31 "Tests calls to various relative path functions",
37 invalid_rel_move_to (cairo_surface_t
*target
)
40 cairo_status_t status
;
42 cr
= cairo_create (target
);
43 cairo_rel_move_to (cr
, SIZE
, SIZE
/2);
44 status
= cairo_status (cr
);
51 invalid_rel_line_to (cairo_surface_t
*target
)
54 cairo_status_t status
;
56 cr
= cairo_create (target
);
57 cairo_rel_line_to (cr
, -SIZE
, SIZE
/2);
58 status
= cairo_status (cr
);
65 invalid_rel_curve_to (cairo_surface_t
*target
)
68 cairo_status_t status
;
70 cr
= cairo_create (target
);
71 cairo_rel_curve_to (cr
,
75 status
= cairo_status (cr
);
81 static cairo_test_status_t
82 draw (cairo_t
*cr
, int width
, int height
)
84 cairo_status_t status
;
86 /* first test that a relative move without a current point fails... */
87 status
= invalid_rel_move_to (cairo_get_target (cr
));
88 if (status
!= CAIRO_STATUS_NO_CURRENT_POINT
) {
89 cairo_test_log ("Error: invalid cairo_rel_move_to() did not raise NO_CURRENT_POINT\n");
90 return CAIRO_TEST_FAILURE
;
93 status
= invalid_rel_line_to (cairo_get_target (cr
));
94 if (status
!= CAIRO_STATUS_NO_CURRENT_POINT
) {
95 cairo_test_log ("Error: invalid cairo_rel_line_to() did not raise NO_CURRENT_POINT\n");
96 return CAIRO_TEST_FAILURE
;
99 status
= invalid_rel_curve_to (cairo_get_target (cr
));
100 if (status
!= CAIRO_STATUS_NO_CURRENT_POINT
) {
101 cairo_test_log ("Error: invalid cairo_rel_curve_to() did not raise NO_CURRENT_POINT\n");
102 return CAIRO_TEST_FAILURE
;
105 cairo_set_source_rgb (cr
, 1, 1, 1);
106 cairo_move_to (cr
, 0, 0);
107 cairo_rel_move_to (cr
, SIZE
, SIZE
/2);
108 cairo_rel_line_to (cr
, -SIZE
, SIZE
/2);
109 cairo_rel_curve_to (cr
,
116 return CAIRO_TEST_SUCCESS
;
122 return cairo_test (&test
);