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 13f50596531c7c69961d1625a6be2550c3565634 (commit) from 561ae54e3e8468a4368622344e5a90187d15da48 (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/13f50596531c7c69961d1625a6be2550c3565...
commit 13f50596531c7c69961d1625a6be2550c3565634 Author: Cyril Hrubis metan@ucw.cz Date: Sat Dec 15 11:31:00 2012 +0100
tests: loaders: Add regression tests for PNG loader.
diff --git a/tests/loaders/Makefile b/tests/loaders/Makefile index 9497586..d8c1fcb 100644 --- a/tests/loaders/Makefile +++ b/tests/loaders/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/pre.mk
CSOURCES=$(shell echo *.c)
-APPS=loaders_suite +APPS=loaders_suite PNG
include ../tests.mk
diff --git a/tests/loaders/PNG.c b/tests/loaders/PNG.c new file mode 100644 index 0000000..ad9381e --- /dev/null +++ b/tests/loaders/PNG.c @@ -0,0 +1,100 @@ +/***************************************************************************** + * 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 <loaders/GP_Loaders.h> + +#include "tst_test.h" + +static int test_load_PNG(const char *path) +{ + GP_Context *img; + + img = GP_LoadPNG(path, NULL); + + if (img == NULL) { + switch (errno) { + case ENOSYS: + tst_msg("Not Implemented"); + return TST_SKIPPED; + default: + tst_msg("Got %s", strerror(errno)); + return TST_FAILED; + } + } + + /* + * TODO: check correct data. + */ + + GP_ContextFree(img); + + return TST_SUCCESS; +} + +const struct tst_suite tst_suite = { + .suite_name = "PNG", + .tests = { + /* PNG loader tests */ + {.name = "PNG 100x100 RGB", + .tst_fn = test_load_PNG, + .res_path = "data/png/valid/100x100-red.png", + .data = "100x100-red.png", + .flags = TST_TMPDIR | TST_CHECK_MALLOC}, + + {.name = "PNG 100x100 RGB 50% alpha", + .tst_fn = test_load_PNG, + .res_path = "data/png/valid/100x100-red-alpha.png", + .data = "100x100-red-alpha.png", + .flags = TST_TMPDIR | TST_CHECK_MALLOC}, + + {.name = "PNG 100x100 8 bit Grayscale", + .tst_fn = test_load_PNG, + .res_path = "data/png/valid/100x100-black-grayscale.png", + .data = "100x100-black-grayscale.png", + .flags = TST_TMPDIR | TST_CHECK_MALLOC}, + + {.name = "PNG 100x100 8 bit Grayscale + alpha", + .tst_fn = test_load_PNG, + .res_path = "data/png/valid/100x100-black-grayscale-alpha.png", + .data = "100x100-black-grayscale-alpha.png", + .flags = TST_TMPDIR | TST_CHECK_MALLOC}, + + {.name = "PNG 100x100 Palette + alpha", + .tst_fn = test_load_PNG, + .res_path = "data/png/valid/100x100-palette-alpha.png", + .data = "100x100-palette-alpha.png", + .flags = TST_TMPDIR | TST_CHECK_MALLOC}, + + {.name = "PNG 100x100 Palette", + .tst_fn = test_load_PNG, + .res_path = "data/png/valid/100x100-red-palette.png", + .data = "100x100-red-palette.png", + .flags = TST_TMPDIR | TST_CHECK_MALLOC}, + + {.name = NULL}, + } +}; diff --git a/tests/loaders/data/png/valid/100x100-black-grayscale-alpha.png b/tests/loaders/data/png/valid/100x100-black-grayscale-alpha.png new file mode 100644 index 0000000..32db4da Binary files /dev/null and b/tests/loaders/data/png/valid/100x100-black-grayscale-alpha.png differ diff --git a/tests/loaders/data/png/valid/100x100-black-grayscale.png b/tests/loaders/data/png/valid/100x100-black-grayscale.png new file mode 100644 index 0000000..61ae31f Binary files /dev/null and b/tests/loaders/data/png/valid/100x100-black-grayscale.png differ diff --git a/tests/loaders/data/png/valid/100x100-palette-alpha.png b/tests/loaders/data/png/valid/100x100-palette-alpha.png new file mode 100644 index 0000000..409e9cf Binary files /dev/null and b/tests/loaders/data/png/valid/100x100-palette-alpha.png differ diff --git a/tests/loaders/data/png/valid/100x100-red-palette.png b/tests/loaders/data/png/valid/100x100-red-palette.png new file mode 100644 index 0000000..c4bcd3b Binary files /dev/null and b/tests/loaders/data/png/valid/100x100-red-palette.png differ diff --git a/tests/loaders/loaders_suite.c b/tests/loaders/loaders_suite.c index 3d9fed4..3802caa 100644 --- a/tests/loaders/loaders_suite.c +++ b/tests/loaders/loaders_suite.c @@ -560,41 +560,6 @@ static int test_load_BMP_8bpp_1x64000(void) return test_load_BMP("8bpp-1x64000.bmp"); }
-static int test_load_PNG(const char *path) -{ - GP_Context *img; - - img = GP_LoadPNG(path, NULL); - - if (img == NULL) { - switch (errno) { - case ENOSYS: - tst_msg("Not Implemented"); - return TST_SKIPPED; - default: - tst_msg("Got %s", strerror(errno)); - return TST_FAILED; - } - } - - /* - * TODO: check correct data. - */ - GP_ContextFree(img); - - return TST_SUCCESS; -} - -static int test_load_PNG_100x100(void) -{ - return test_load_PNG("100x100-red.png"); -} - -static int test_load_PNG_100x100_alpha(void) -{ - return test_load_PNG("100x100-red-alpha.png"); -} - static int test_load_JPEG(const char *path) { GP_Context *img; @@ -719,16 +684,6 @@ const struct tst_suite tst_suite = { .res_path = "data/bmp/bitmaps/valid/8bpp-1x64000.bmp", .flags = TST_TMPDIR},
- /* PNG loader tests */ - {.name = "PNG 100x100", .tst_fn = test_load_PNG_100x100, - .res_path = "data/png/valid/100x100-red.png", - .flags = TST_TMPDIR}, - - {.name = "PNG 100x100 50% alpha", - .tst_fn = test_load_PNG_100x100_alpha, - .res_path = "data/png/valid/100x100-red-alpha.png", - .flags = TST_TMPDIR}, - /* JPEG loader tests */ {.name = "JPEG 100x100", .tst_fn = test_load_JPEG_100x100, .res_path = "data/jpeg/valid/100x100-red.jpeg", diff --git a/tests/loaders/runtest.sh b/tests/loaders/runtest.sh index 0c6d722..e92c0c4 100755 --- a/tests/loaders/runtest.sh +++ b/tests/loaders/runtest.sh @@ -10,3 +10,4 @@ export LIBC_FATAL_STDERR_=1
LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./loaders_suite "$@" +LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./PNG "$@"
-----------------------------------------------------------------------
Summary of changes: tests/loaders/Makefile | 2 +- tests/loaders/PNG.c | 100 ++++++++++++++++++++ .../png/valid/100x100-black-grayscale-alpha.png | Bin 0 -> 271 bytes .../data/png/valid/100x100-black-grayscale.png | Bin 0 -> 184 bytes .../data/png/valid/100x100-palette-alpha.png | Bin 0 -> 212 bytes .../loaders/data/png/valid/100x100-red-palette.png | Bin 0 -> 309 bytes tests/loaders/loaders_suite.c | 45 --------- tests/loaders/runtest.sh | 1 + 8 files changed, 102 insertions(+), 46 deletions(-) create mode 100644 tests/loaders/PNG.c create mode 100644 tests/loaders/data/png/valid/100x100-black-grayscale-alpha.png create mode 100644 tests/loaders/data/png/valid/100x100-black-grayscale.png create mode 100644 tests/loaders/data/png/valid/100x100-palette-alpha.png create mode 100644 tests/loaders/data/png/valid/100x100-red-palette.png
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.