1 /*****************************************************************************
2 * This file is part of gfxprim library. *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
19 * Copyright (C) 2009-2013 Cyril Hrubis <metan@ucw.cz> *
21 *****************************************************************************/
25 The purpose of this test is to exercise as much codepaths as possible
26 without checking for result corectness.
30 %% extends "base.test.c.t"
32 {% block descr %}GFX API converage tests.{% endblock %}
38 #include <core/GP_Context.h>
39 #include <gfx/GP_Gfx.h>
44 ['Fill', 'GP_Context:in', 'int:pixel'],
46 ['HLine', 'GP_Context:in', 'int:x0', 'int:x1', 'int:y', 'int:pixel'],
47 ['VLine', 'GP_Context:in', 'int:x', 'int:y0', 'int:y1', 'int:pixel'],
49 ['Line', 'GP_Context:in', 'int:x0', 'int:y0',
50 'int:x1', 'int:y1', 'int:pixel'],
52 ['Circle', 'GP_Context:in', 'int:xcenter', 'int:ycenter',
53 'int:r', 'int:pixel'],
54 ['FillCircle', 'GP_Context:in', 'int:xcenter', 'int:ycenter',
55 'int:r', 'int:pixel'],
57 ['Ellipse', 'GP_Context:in', 'int:xcenter', 'int:ycenter',
58 'int:a', 'int:b', 'int:pixel'],
59 ['FillEllipse', 'GP_Context:in', 'int:xcenter', 'int:ycenter',
60 'int:a', 'int:b', 'int:pixel'],
62 ['Ring', 'GP_Context:in', 'int:xc', 'int:yc',
63 'int:r1', 'int:r2', 'int:pixel'],
64 ['FillRing', 'GP_Context:in', 'int:xc', 'int:yc',
65 'int:r1', 'int:r2', 'int:pixel'],
67 ['Rect', 'GP_Context:in', 'int:x0', 'int:y0',
68 'int:x1', 'int:y1', 'int:pixel'],
69 ['FillRect', 'GP_Context:in', 'int:x0', 'int:y0',
70 'int:x1', 'int:y1', 'int:pixel'],
72 ['Triangle', 'GP_Context:in', 'int:x0', 'int:y0',
73 'int:x1', 'int:y1', 'int:x2', 'int:y2', 'int:pixel'],
74 ['FillTriangle', 'GP_Context:in', 'int:x0', 'int:y0',
75 'int:x1', 'int:y1', 'int:x2', 'int:y2', 'int:pixel'],
77 ['Tetragon', 'GP_Context:in', 'int:x0', 'int:y0', 'int:x1', 'int:y1',
78 'int:x2', 'int:y2', 'int:x3', 'int:y3', 'int:pixel'],
79 ['FillTetragon', 'GP_Context:in', 'int:x0', 'int:y0', 'int:x1', 'int:y1',
80 'int:x2', 'int:y2', 'int:x3', 'int:y3', 'int:pixel'],
84 %% macro prep_context(id, pt)
85 GP_Context *{{ id }} = GP_ContextAlloc(331, 331, GP_PIXEL_{{ pt.name }});
92 %% macro prep_param(param, pt)
93 %% if (param.split(':', 1)[0] == 'GP_Context')
94 {{ prep_context(param.split(':', 1)[1], pt) }}
96 %% if (param.split(':', 1)[0] == 'float')
97 {{ prep_float(param.split(':', 1)[1]) }}
99 %% if (param.split(':', 1)[0] == 'int')
100 {{ prep_int(param.split(':', 1)[1]) }}
104 {% macro get_param(param) %}{% if len(param.split(':', 1)) == 1 %}NULL{% else %}{{ param.split(':', 1)[1] }}{% endif %}{% endmacro %}
106 %% for fn in API_List
107 %% for pt in pixeltypes
108 %% if not pt.is_unknown()
110 static int Gfx_{{ fn[0]}}_{{ pt.name }}(void)
112 %% for param in fn[1:]
113 {{ prep_param(param, pt) }}
116 GP_{{ fn[0] }}({{ get_param(fn[1]) }}{% for param in fn[2:] %}, {{ get_param(param) }}{% endfor %});
125 const struct tst_suite tst_suite = {
126 .suite_name = "Gfx API Coverage",
128 %% for fn in API_List
129 %% for pt in pixeltypes
130 %% if not pt.is_unknown()
131 {.name = "{{ fn[0] }} {{ pt.name }}",
132 .tst_fn = Gfx_{{ fn[0] }}_{{ pt.name }}},