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 1b12b87ffd658031b16cd398bbf7a38637d774ce (commit) from 5fb7aa901f930330ad55c1441a96869424d3c3c7 (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/1b12b87ffd658031b16cd398bbf7a38637d77...
commit 1b12b87ffd658031b16cd398bbf7a38637d774ce Author: Cyril Hrubis metan@ucw.cz Date: Wed Oct 31 19:38:02 2012 +0100
tests: gfx: Add very basic tests for Line.
diff --git a/tests/gfx/Line.c b/tests/gfx/Line.c new file mode 100644 index 0000000..5821b25 --- /dev/null +++ b/tests/gfx/Line.c @@ -0,0 +1,133 @@ +/***************************************************************************** + * 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-2012 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +#include <string.h> +#include <errno.h> +#include <sys/stat.h> + +#include <core/GP_Context.h> +#include <gfx/GP_Line.h> + +#include "tst_test.h" + +#include "common.h" + +static const char line_5_5_5_5_11x11[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 1, +}; + +static int test_line(const char *pattern, GP_Size w, GP_Size h, + GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1) +{ + GP_Context *c; + int err; + + c = GP_ContextAlloc(w, h, GP_PIXEL_G8); + + if (c == NULL) { + tst_report(0, "Failed to allocate context"); + return TST_UNTESTED; + } + + /* zero the pixels buffer */ + memset(c->pixels, 0, c->w * c->h); + + GP_Line(c, x0, y0, x1, y1, 1); + + err = compare_buffers(pattern, c); + + if (err) { + tst_report(0, "Patterns are different"); + return TST_FAILED; + } + + return TST_SUCCESS; +} + +static int test_line_5_5_5_5(void) +{ + return test_line(line_5_5_5_5_11x11, 11, 11, 5, 5, 5, 5); +} + +static int test_line_1_5_9_5(void) +{ + return test_line(line_1_5_9_5_11x11, 11, 11, 1, 5, 9, 5); +} + +static int test_line_0_0_10_10(void) +{ + return test_line(line_0_0_10_10_11x11, 11, 11, 0, 0, 10, 10); +} + +static int test_line__1__1_11_11(void) +{ + return test_line(line_0_0_10_10_11x11, 11, 11, -1, -1, 11, 11); +} + +const struct tst_suite tst_suite = { + .suite_name = "GFX Line Testsuite", + .tests = { + {.name = "Line 5x5 - 5x5", .tst_fn = test_line_5_5_5_5}, + {.name = "Line 1x5 - 9x5", .tst_fn = test_line_1_5_9_5}, + {.name = "Line 0x0 - 10x10", .tst_fn = test_line_0_0_10_10}, + {.name = "Line -1x-1 - 11x11", .tst_fn = test_line__1__1_11_11}, + {.name = NULL} + } +}; diff --git a/tests/gfx/Makefile b/tests/gfx/Makefile index 4cbf36a..d3c9b0e 100644 --- a/tests/gfx/Makefile +++ b/tests/gfx/Makefile @@ -3,9 +3,10 @@ include $(TOPDIR)/pre.mk
CSOURCES=$(shell echo *.c)
-APPS=gfx_benchmark Circle CircleSeg +APPS=gfx_benchmark Circle Line CircleSeg
Circle: common.o +Line: common.o CircleSeg: common.o
include ../tests.mk diff --git a/tests/gfx/runtest.sh b/tests/gfx/runtest.sh index e9ba8ef..bcef95e 100755 --- a/tests/gfx/runtest.sh +++ b/tests/gfx/runtest.sh @@ -11,4 +11,5 @@ 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/ ./Circle "$@" +LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Line "$@" LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./CircleSeg "$@"
-----------------------------------------------------------------------
Summary of changes: tests/gfx/{Circle.c => Line.c} | 104 +++++++++++----------------------------- tests/gfx/Makefile | 3 +- tests/gfx/runtest.sh | 1 + 3 files changed, 32 insertions(+), 76 deletions(-) copy tests/gfx/{Circle.c => Line.c} (55%)
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.