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 @ ['FillCircle', '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 @ ['FillEllipse', '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 @ ['FillRing', '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 @ ['FillRect', '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 @ ['FillTriangle', '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 @ ['FillTetragon', '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_PixmapAlloc(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 }}},