This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via d2137791166e8469f0671c4081260c7a9bff3235 (commit) via e513bc804335827858f0c963b1021eecc4794b93 (commit) from 5e3a5fc7952aa8e2b8ab0337d87d053fa69cec76 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/d2137791166e8469f0671c4081260c7a9bff3...
commit d2137791166e8469f0671c4081260c7a9bff3235 Author: Cyril Hrubis metan@ucw.cz Date: Sat Jan 19 12:22:44 2013 +0100
test: gfx: Add simple VLine testsuite.
diff --git a/tests/gfx/Makefile b/tests/gfx/Makefile index 1edbb99..0229a5c 100644 --- a/tests/gfx/Makefile +++ b/tests/gfx/Makefile @@ -3,7 +3,8 @@ include $(TOPDIR)/pre.mk
CSOURCES=$(shell echo *.c)
-APPS=gfx_benchmark Circle FillCircle Line CircleSeg Polygon Ellipse HLine +APPS=gfx_benchmark Circle FillCircle Line CircleSeg Polygon Ellipse HLine+ VLine
Circle: common.o FillCircle: common.o @@ -12,6 +13,7 @@ Line: common.o CircleSeg: common.o Polygon: common.o HLine: common.o +VLine: common.o
include ../tests.mk
diff --git a/tests/gfx/VLine.c b/tests/gfx/VLine.c new file mode 100644 index 0000000..03b2d62 --- /dev/null +++ b/tests/gfx/VLine.c @@ -0,0 +1,303 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +#include <string.h> +#include <errno.h> + +#include <core/GP_Context.h> +#include <gfx/GP_VLine.h> + +#include "tst_test.h" + +#include "common.h" + +struct testcase { + /* VLine description */ + GP_Coord x; + GP_Coord y0; + GP_Coord y1; + + GP_Coord y; + GP_Size lh; + + int flag; + + /* expected result */ + GP_Size w, h; + const char pixmap[]; +}; + +static int test_vline(struct testcase *t) +{ + GP_Context *c; + int err; + + c = GP_ContextAlloc(t->w, t->h, GP_PIXEL_G8); + + if (c == NULL) { + tst_err("Failed to allocate context"); + return TST_UNTESTED; + } + + /* zero the pixels buffer */ + memset(c->pixels, 0, c->w * c->h); + + if (t->flag) + GP_VLineXYH(c, t->x, t->y, t->lh, 1); + else + GP_VLine(c, t->x, t->y0, t->y1, 1); + + err = compare_buffers(t->pixmap, c); + + if (err) { + tst_msg("Patterns are different"); + return TST_FAILED; + } + + return TST_SUCCESS; +} + +static struct testcase testcase_1_px = { + .x = 1, + .y0 = 1, + .y1 = 1, + + .w = 3, + .h = 3, + .pixmap = { + 0, 0, 0, + 0, 1, 0, + 0, 0, 0, + } +}; + +static struct testcase testcase_3_px_1 = { + .x = 1, + .y0 = 1, + .y1 = 3, + + .w = 3, + .h = 5, + .pixmap = { + 0, 0, 0, + 0, 1, 0, + 0, 1, 0, + 0, 1, 0, + 0, 0, 0, + } +}; + +static struct testcase testcase_3_px_2 = { + .x = 1, + .y0 = 3, + .y1 = 1, + + .w = 3, + .h = 5, + .pixmap = { + 0, 0, 0, + 0, 1, 0, + 0, 1, 0, + 0, 1, 0, + 0, 0, 0, + } +}; + +static struct testcase testcase_clipping_1 = { + .x = 1, + .y0 = -10000, + .y1 = 10000, + + .w = 3, + .h = 5, + .pixmap = { + 0, 1, 0, + 0, 1, 0, + 0, 1, 0, + 0, 1, 0, + 0, 1, 0, + } +}; + +static struct testcase testcase_clipping_2 = { + .x = 4, + .y0 = -10000, + .y1 = 10000, + + .w = 3, + .h = 5, + .pixmap = { + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + } +}; + +static struct testcase testcase_clipping_3 = { + .x = -4, + .y0 = -100000, + .y1 = 100000, + + .w = 3, + .h = 5, + .pixmap = { + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + } +}; + +static struct testcase testcase_xyh_1 = { + .x = 1, + .y = 1, + .lh = 0, + + .flag = 1, + + .w = 3, + .h = 3, + .pixmap = { + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + } +}; + +static struct testcase testcase_xyh_2 = { + .x = 1, + .y = 1, + .lh = 2, + + .flag = 1, + + .w = 4, + .h = 4, + .pixmap = { + 0, 0, 0, 0, + 0, 1, 0, 0, + 0, 1, 0, 0, + 0, 0, 0, 0, + } +}; + +static struct testcase testcase_xyh_clipp_1 = { + .x = 1, + .y = -10000, + .lh = 20000, + + .flag = 1, + + .w = 3, + .h = 3, + .pixmap = { + 0, 1, 0, + 0, 1, 0, + 0, 1, 0, + } +}; + +static struct testcase testcase_xyh_clipp_2 = { + .x = 1, + .y = 1, + .lh = 200000, + + .flag = 1, + + .w = 3, + .h = 3, + .pixmap = { + 0, 0, 0, + 0, 1, 0, + 0, 1, 0, + } +}; + +static struct testcase testcase_xyh_clipp_3 = { + .x = -10000, + .y = -10000, + .lh = -1, + + .flag = 1, + + .w = 3, + .h = 3, + .pixmap = { + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + } +}; + +const struct tst_suite tst_suite = { + .suite_name = "VLine Testsuite", + .tests = { + {.name = "VLine 1px", + .tst_fn = test_vline, + .data = &testcase_1_px}, + + {.name = "VLine 3px 1", + .tst_fn = test_vline, + .data = &testcase_3_px_1}, + + {.name = "VLine 3px 2", + .tst_fn = test_vline, + .data = &testcase_3_px_2}, + + {.name = "VLine clipping 1", + .tst_fn = test_vline, + .data = &testcase_clipping_1}, + + {.name = "VLine clipping 2", + .tst_fn = test_vline, + .data = &testcase_clipping_2}, + + {.name = "VLine clipping 3", + .tst_fn = test_vline, + .data = &testcase_clipping_3}, + + {.name = "VLineXYH 1", + .tst_fn = test_vline, + .data = &testcase_xyh_1}, + + {.name = "VLineXYH 2", + .tst_fn = test_vline, + .data = &testcase_xyh_2}, + + {.name = "VLineXYH clipping 1", + .tst_fn = test_vline, + .data = &testcase_xyh_clipp_1}, + + {.name = "VLineXYH clipping 2", + .tst_fn = test_vline, + .data = &testcase_xyh_clipp_2}, + + {.name = "VLineXYH clipping 3", + .tst_fn = test_vline, + .data = &testcase_xyh_clipp_3}, + + {.name = NULL} + } +}; diff --git a/tests/gfx/runtest.sh b/tests/gfx/runtest.sh index c890920..faf62bf 100755 --- a/tests/gfx/runtest.sh +++ b/tests/gfx/runtest.sh @@ -11,6 +11,7 @@ export LIBC_FATAL_STDERR_=1
#LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./gfx_benchmark "$@" LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./HLine "$@" +LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./VLine "$@" LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Line "$@" LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Circle "$@" LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./FillCircle "$@"
http://repo.or.cz/w/gfxprim.git/commit/e513bc804335827858f0c963b1021eecc4794...
commit e513bc804335827858f0c963b1021eecc4794b93 Author: Cyril Hrubis metan@ucw.cz Date: Sat Jan 19 12:05:06 2013 +0100
tests: gfx: Fix HLineXYW expectations.
diff --git a/tests/gfx/HLine.c b/tests/gfx/HLine.c index ddab1c7..14dfd51 100644 --- a/tests/gfx/HLine.c +++ b/tests/gfx/HLine.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -171,7 +171,7 @@ static struct testcase testcase_xyw_1 = { .h = 3, .pixmap = { 0, 0, 0, - 0, 1, 0, + 0, 0, 0, 0, 0, 0, } }; @@ -179,7 +179,7 @@ static struct testcase testcase_xyw_1 = { static struct testcase testcase_xyw_2 = { .x = 1, .y = 1, - .lw = 1, + .lw = 2,
.flag = 1,
-----------------------------------------------------------------------
Summary of changes: tests/gfx/HLine.c | 6 +- tests/gfx/Makefile | 4 +- tests/gfx/{HLine.c => VLine.c} | 219 +++++++++++++++++++++------------------- tests/gfx/runtest.sh | 1 + 4 files changed, 122 insertions(+), 108 deletions(-) copy tests/gfx/{HLine.c => VLine.c} (62%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.