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 *****************************************************************************/
27 #include <core/GP_Context.h>
28 #include <gfx/GP_Rect.h>
35 /* rect description */
46 static int test_rect(const struct testcase
*t
)
51 c
= GP_ContextAlloc(t
->w
, t
->h
, GP_PIXEL_G8
);
54 tst_err("Failed to allocate context");
58 /* zero the pixels buffer */
59 memset(c
->pixels
, 0, c
->w
* c
->h
);
61 GP_FillRect(c
, t
->x1
, t
->y1
, t
->x2
, t
->y2
, 1);
63 err
= compare_buffers(t
->pixmap
, c
);
71 struct testcase testcase_rect_1
= {
89 struct testcase testcase_rect_9a
= {
107 struct testcase testcase_rect_9b
= {
125 struct testcase testcase_rect_9lu
= {
143 struct testcase testcase_rect_9ld
= {
161 struct testcase testcase_rect_9ru
= {
179 struct testcase testcase_rect_9rd
= {
197 struct testcase testcase_rect_9r
= {
215 struct testcase testcase_rect_9l
= {
233 struct testcase testcase_rect_9u
= {
251 struct testcase testcase_rect_9d
= {
269 struct testcase testcase_rect_0a
= {
287 struct testcase testcase_rect_0b
= {
305 struct testcase testcase_rect_25
= {
323 const struct tst_suite tst_suite
= {
324 .suite_name
= "FillRect Testsuite",
326 {.name
= "FillRect x1=x2 y1=y2",
328 .data
= &testcase_rect_1
},
330 {.name
= "FillRect x1<x2 y1<y2",
332 .data
= &testcase_rect_9a
},
334 {.name
= "FillRect x1>x2 y1>y2",
336 .data
= &testcase_rect_9b
},
338 {.name
= "FillRect x1,y1 out of context",
340 .data
= &testcase_rect_9lu
,
343 {.name
= "FillRect x1,y2 out of context",
345 .data
= &testcase_rect_9ld
,
348 {.name
= "FillRect x2,y1 out of context",
350 .data
= &testcase_rect_9ru
,
353 {.name
= "FillRect x2,y2 out of context",
355 .data
= &testcase_rect_9rd
,
358 {.name
= "FillRect x1 out of context",
360 .data
= &testcase_rect_9r
,
363 {.name
= "FillRect x2 out of context",
365 .data
= &testcase_rect_9l
,
368 {.name
= "FillRect y1 out of context",
370 .data
= &testcase_rect_9u
,
373 {.name
= "FillRect y2 out of context",
375 .data
= &testcase_rect_9d
,
378 {.name
= "FillRect rect out of context 1",
380 .data
= &testcase_rect_0a
,
383 {.name
= "FillRect rect out of context 2",
385 .data
= &testcase_rect_0b
,
388 {.name
= "FillRect full rect",
390 .data
= &testcase_rect_25
,