filters/gp_filter_resize_alloc: Check w and h
[gfxprim.git] / tests / gfx / APICoverage.gen.c.t
blob982752444a7459961aeccd27b9e8c5c0851e8b73
1 @ include source.t
2 /*
3  * The purpose of this test is to exercise as much codepaths as possible
4  * without checking for result corectness.
5  *
6  * Copyright (C) 2009-2014 Cyril Hrubis <metan@ucw.cz>
7  */
9 #include <stdio.h>
11 #include <core/GP_Pixmap.h>
12 #include <gfx/GP_Gfx.h>
14 #include "tst_test.h"
16 @ API_List = [
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'],
54 @ ]
56 @ def prep_pixmap(id, pt):
57 gp_pixmap *{{ id }} = gp_pixmap_alloc(331, 331, GP_PIXEL_{{ pt.name }});
58 @ end
60 @ def prep_int(id):
61 int {{ id }} = 2;
62 @ end
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]) @}
71 @ end
73 @ def get_param(param):
74 @    if len(param.split(':', 1)) == 1:
75 @         return 'NULL'
76 @    else:
77 @         return param.split(':', 1)[1]
78 @ end
80 @ for fn in API_List:
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) @}
87 @             end
89         gp_{{ fn[0] }}({{ ', '.join(map(get_param, fn[1:])) }});
91         return TST_SUCCESS;
94 @ end
96 const struct tst_suite tst_suite = {
97         .suite_name = "Gfx API Coverage",
98         .tests = {
99 @ for fn in API_List:
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 }}},
104 @ end
105                 {.name = NULL}
106         }