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 111cef13540298997a42d245a80c81aca5d4cc68 (commit) from 2cf30f8101ea618085a197ea6bb8bad9d5cb0708 (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/111cef13540298997a42d245a80c81aca5d4c...
commit 111cef13540298997a42d245a80c81aca5d4cc68 Author: Cyril Hrubis metan@ucw.cz Date: Sun Dec 9 23:30:04 2012 +0100
tests: gfx: Add Ellipse.c testsuite.
diff --git a/tests/gfx/Ellipse.c b/tests/gfx/Ellipse.c new file mode 100644 index 0000000..5b0add6 --- /dev/null +++ b/tests/gfx/Ellipse.c @@ -0,0 +1,367 @@ +/***************************************************************************** + * 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_Ellipse.h> + +#include "tst_test.h" + +#include "common.h" + +struct testcase { + /* cicle description */ + GP_Coord x; + GP_Coord y; + GP_Size a; + GP_Size b; + + /* expected result */ + GP_Size w, h; + const char pixmap[]; +}; + +static int test_ellipse(const 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); + + GP_Ellipse(c, t->x, t->y, t->a, t->b, 1); + + err = compare_buffers(t->pixmap, c); + + if (err) + return TST_FAILED; + + return TST_SUCCESS; +} + +static struct testcase testcase_ellipse_a0_b0 = { + .x = 2, + .y = 2, + .a = 0, + .b = 0, + + .w = 5, + .h = 5, + + .pixmap = { + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a1_b0 = { + .x = 2, + .y = 2, + .a = 1, + .b = 0, + + .w = 5, + .h = 5, + + .pixmap = { + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a0_b1 = { + .x = 2, + .y = 2, + .a = 0, + .b = 1, + + .w = 5, + .h = 5, + + .pixmap = { + 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a1_b1 = { + .x = 2, + .y = 2, + .a = 1, + .b = 1, + + .w = 5, + .h = 5, + + .pixmap = { + 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 1, 0, 1, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a2_b1 = { + .x = 3, + .y = 3, + .a = 2, + .b = 1, + + .w = 7, + .h = 7, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 0, 0, + 0, 1, 0, 0, 0, 1, 0, + 0, 0, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a1_b2 = { + .x = 3, + .y = 3, + .a = 1, + .b = 2, + + .w = 7, + .h = 7, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, + 0, 0, 1, 0, 1, 0, 0, + 0, 0, 1, 0, 1, 0, 0, + 0, 0, 1, 0, 1, 0, 0, + 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a2_b2 = { + .x = 3, + .y = 3, + .a = 2, + .b = 2, + + .w = 7, + .h = 7, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 0, 0, + 0, 1, 0, 0, 0, 1, 0, + 0, 1, 0, 0, 0, 1, 0, + 0, 1, 0, 0, 0, 1, 0, + 0, 0, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a1_b3 = { + .x = 4, + .y = 4, + .a = 1, + .b = 3, + + .w = 9, + .h = 9, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a3_b2 = { + .x = 4, + .y = 4, + .a = 3, + .b = 2, + + .w = 9, + .h = 9, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 1, 1, 0, 0, 0, 1, 1, 0, + 0, 1, 0, 0, 0, 0, 0, 1, 0, + 0, 1, 1, 0, 0, 0, 1, 1, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a3_b3 = { + .x = 4, + .y = 4, + .a = 3, + .b = 3, + + .w = 9, + .h = 9, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 1, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 1, 0, + 0, 1, 0, 0, 0, 0, 0, 1, 0, + 0, 1, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a6_b6_clip = { + .x = 0, + .y = 0, + .a = 6, + .b = 6, + + .w = 8, + .h = 8, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 1, 1, 0, 0, 0, + 1, 1, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a5_b5_clip = { + .x = 0, + .y = 5, + .a = 5, + .b = 5, + + .w = 11, + .h = 11, + + .pixmap = { + 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + } +}; + +const struct tst_suite tst_suite = { + .suite_name = "Ellipse Testsuite", + .tests = { + {.name = "Ellipse a=0 b=0", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a0_b0}, + + {.name = "Ellipse a=1 b=0", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a1_b0}, + + {.name = "Ellipse a=0 b=1", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a0_b1}, + + {.name = "Ellipse a=1 b=1", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a1_b1}, + + {.name = "Ellipse a=2 b=1", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a2_b1}, + + {.name = "Ellipse a=1 b=2", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a1_b2}, + + {.name = "Ellipse a=2 b=2", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a2_b2}, + + {.name = "Ellipse a=1 b=3", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a1_b3}, + + {.name = "Ellipse a=3 b=2", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a3_b2}, + + {.name = "Ellipse a=3 b=3", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a3_b3}, + + {.name = "Ellipse a=5 b=5 clipped", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a5_b5_clip}, + + {.name = "Ellipse a=6 b=6 clipped", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a6_b6_clip}, + + {.name = NULL} + } +}; diff --git a/tests/gfx/Makefile b/tests/gfx/Makefile index fafb1cb..d8090a9 100644 --- a/tests/gfx/Makefile +++ b/tests/gfx/Makefile @@ -3,10 +3,11 @@ include $(TOPDIR)/pre.mk
CSOURCES=$(shell echo *.c)
-APPS=gfx_benchmark Circle FillCircle Line CircleSeg Polygon +APPS=gfx_benchmark Circle FillCircle Line CircleSeg Polygon Ellipse
Circle: common.o FillCircle: common.o +Ellipse: common.o Line: common.o CircleSeg: common.o Polygon: common.o diff --git a/tests/gfx/runtest.sh b/tests/gfx/runtest.sh index 0e50fb6..2edd6b4 100755 --- a/tests/gfx/runtest.sh +++ b/tests/gfx/runtest.sh @@ -13,5 +13,6 @@ export LIBC_FATAL_STDERR_=1 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 "$@" +LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Ellipse "$@" LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./CircleSeg "$@" LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Polygon "$@"
-----------------------------------------------------------------------
Summary of changes: tests/gfx/{Circle.c => Ellipse.c} | 280 ++++++++++++++++++++++++++---------- tests/gfx/Makefile | 3 +- tests/gfx/runtest.sh | 1 + 3 files changed, 205 insertions(+), 79 deletions(-) copy tests/gfx/{Circle.c => Ellipse.c} (52%)
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.