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 *****************************************************************************/
26 #include <core/GP_Pixmap.h>
27 #include <gfx/GP_VLine.h>
34 /* VLine description */
49 static int test_vline(struct testcase
*t
)
54 c
= GP_PixmapAlloc(t
->w
, t
->h
, GP_PIXEL_G8
);
57 tst_err("Failed to allocate pixmap");
61 /* zero the pixels buffer */
62 memset(c
->pixels
, 0, c
->w
* c
->h
);
65 GP_VLineXYH(c
, t
->x
, t
->y
, t
->lh
, 1);
67 GP_VLine(c
, t
->x
, t
->y0
, t
->y1
, 1);
69 err
= compare_buffers(t
->pixmap
, c
);
72 tst_msg("Patterns are different");
79 static struct testcase testcase_1_px
= {
93 static struct testcase testcase_3_px_1
= {
109 static struct testcase testcase_3_px_2
= {
125 static struct testcase testcase_clipping_1
= {
141 static struct testcase testcase_clipping_2
= {
157 static struct testcase testcase_clipping_3
= {
173 static struct testcase testcase_xyh_1
= {
189 static struct testcase testcase_xyh_2
= {
206 static struct testcase testcase_xyh_clipp_1
= {
222 static struct testcase testcase_xyh_clipp_2
= {
238 static struct testcase testcase_xyh_clipp_3
= {
254 const struct tst_suite tst_suite
= {
255 .suite_name
= "VLine Testsuite",
257 {.name
= "VLine 1px",
258 .tst_fn
= test_vline
,
259 .data
= &testcase_1_px
},
261 {.name
= "VLine 3px 1",
262 .tst_fn
= test_vline
,
263 .data
= &testcase_3_px_1
},
265 {.name
= "VLine 3px 2",
266 .tst_fn
= test_vline
,
267 .data
= &testcase_3_px_2
},
269 {.name
= "VLine clipping 1",
270 .tst_fn
= test_vline
,
271 .data
= &testcase_clipping_1
},
273 {.name
= "VLine clipping 2",
274 .tst_fn
= test_vline
,
275 .data
= &testcase_clipping_2
},
277 {.name
= "VLine clipping 3",
278 .tst_fn
= test_vline
,
279 .data
= &testcase_clipping_3
},
281 {.name
= "VLineXYH 1",
282 .tst_fn
= test_vline
,
283 .data
= &testcase_xyh_1
},
285 {.name
= "VLineXYH 2",
286 .tst_fn
= test_vline
,
287 .data
= &testcase_xyh_2
},
289 {.name
= "VLineXYH clipping 1",
290 .tst_fn
= test_vline
,
291 .data
= &testcase_xyh_clipp_1
},
293 {.name
= "VLineXYH clipping 2",
294 .tst_fn
= test_vline
,
295 .data
= &testcase_xyh_clipp_2
},
297 {.name
= "VLineXYH clipping 3",
298 .tst_fn
= test_vline
,
299 .data
= &testcase_xyh_clipp_3
},