3 * The purpose of this test is to exercise as much codepaths as possible
4 * without checking for result corectness.
6 * Copyright (C) 2009-2014 Cyril Hrubis <metan@ucw.cz>
11 #include <core/GP_Pixmap.h>
12 #include <gfx/GP_Gfx.h>
17 @ ['fill', 'gp_pixmap:in', 'int:pixel'],
19 @ ['hline', 'gp_pixmap:in', 'int:x0', 'int:x1', 'int:y', 'int:pixel'],
20 @ ['vline', 'gp_pixmap:in', 'int:x', 'int:y0', 'int:y1', 'int:pixel'],
22 @ ['line', 'gp_pixmap:in', 'int:x0', 'int:y0',
23 @ 'int:x1', 'int:y1', 'int:pixel'],
25 @ ['circle', 'gp_pixmap:in', 'int:xcenter', 'int:ycenter',
26 @ 'int:r', 'int:pixel'],
27 @ ['fill_circle', 'gp_pixmap:in', 'int:xcenter', 'int:ycenter',
28 @ 'int:r', 'int:pixel'],
30 @ ['ellipse', 'gp_pixmap:in', 'int:xcenter', 'int:ycenter',
31 @ 'int:a', 'int:b', 'int:pixel'],
32 @ ['fill_ellipse', 'gp_pixmap:in', 'int:xcenter', 'int:ycenter',
33 @ 'int:a', 'int:b', 'int:pixel'],
35 @ ['ring', 'gp_pixmap:in', 'int:xc', 'int:yc',
36 @ 'int:r1', 'int:r2', 'int:pixel'],
37 @ ['fill_ring', 'gp_pixmap:in', 'int:xc', 'int:yc',
38 @ 'int:r1', 'int:r2', 'int:pixel'],
40 @ ['rect', 'gp_pixmap:in', 'int:x0', 'int:y0',
41 @ 'int:x1', 'int:y1', 'int:pixel'],
42 @ ['fill_rect', 'gp_pixmap:in', 'int:x0', 'int:y0',
43 @ 'int:x1', 'int:y1', 'int:pixel'],
45 @ ['triangle', 'gp_pixmap:in', 'int:x0', 'int:y0',
46 @ 'int:x1', 'int:y1', 'int:x2', 'int:y2', 'int:pixel'],
47 @ ['fill_triangle', 'gp_pixmap:in', 'int:x0', 'int:y0',
48 @ 'int:x1', 'int:y1', 'int:x2', 'int:y2', 'int:pixel'],
50 @ ['tetragon', 'gp_pixmap:in', 'int:x0', 'int:y0', 'int:x1', 'int:y1',
51 @ 'int:x2', 'int:y2', 'int:x3', 'int:y3', 'int:pixel'],
52 @ ['fill_tetragon', 'gp_pixmap:in', 'int:x0', 'int:y0', 'int:x1', 'int:y1',
53 @ 'int:x2', 'int:y2', 'int:x3', 'int:y3', 'int:pixel'],
56 @ def prep_pixmap(id, pt):
57 gp_pixmap *{{ id }} = gp_pixmap_alloc(331, 331, GP_PIXEL_{{ pt.name }});
64 @ def prep_param(param, pt):
65 @ if (param.split(':', 1)[0] == 'gp_pixmap'):
66 {@ prep_pixmap(param.split(':', 1)[1], pt) @}
67 @ if (param.split(':', 1)[0] == 'float'):
68 {@ prep_float(param.split(':', 1)[1]) @}
69 @ if (param.split(':', 1)[0] == 'int'):
70 {@ prep_int(param.split(':', 1)[1]) @}
73 @ def get_param(param):
74 @ if len(param.split(':', 1)) == 1:
77 @ return param.split(':', 1)[1]
81 @ for pt in pixeltypes:
82 @ if not pt.is_unknown():
83 static int Gfx_{{ fn[0]}}_{{ pt.name }}(void)
85 @ for param in fn[1:]:
86 {@ prep_param(param, pt) @}
89 gp_{{ fn[0] }}({{ ', '.join(map(get_param, fn[1:])) }});
96 const struct tst_suite tst_suite = {
97 .suite_name = "Gfx API Coverage",
100 @ for pt in pixeltypes:
101 @ if not pt.is_unknown():
102 {.name = "{{ fn[0] }} {{ pt.name }}",
103 .tst_fn = Gfx_{{ fn[0] }}_{{ pt.name }}},