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 5f13bc0a920bfb4b903a6982b66a091825c4228e (commit) via f4623e257dda0ce2f5afffc51be40f4f9022160e (commit) via 5fb5fa695cc7e152587edb6f8d76ed531f0cc6cb (commit) from 472dae1467a2add6bd116bd024c68ff6a5557534 (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/5f13bc0a920bfb4b903a6982b66a091825c42...
commit 5f13bc0a920bfb4b903a6982b66a091825c4228e Author: Cyril Hrubis metan@ucw.cz Date: Fri Oct 19 20:09:36 2012 +0200
tests: Remove trianglefps.
diff --git a/tests/SDL/Makefile b/tests/SDL/Makefile index c11568d..9dd15e9 100644 --- a/tests/SDL/Makefile +++ b/tests/SDL/Makefile @@ -8,7 +8,7 @@ ifeq ($(HAVE_LIBSDL),yes) CSOURCES=$(shell echo *.c)
APPS=pixeltest fonttest linetest randomshapetest- symbolstest textaligntest trianglefps blittest subcontext+ symbolstest textaligntest blittest subcontext aatest mixpixeltest endif
diff --git a/tests/SDL/trianglefps.c b/tests/SDL/trianglefps.c deleted file mode 100644 index 5eda430..0000000 --- a/tests/SDL/trianglefps.c +++ /dev/null @@ -1,186 +0,0 @@ -/***************************************************************************** - * 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-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <SDL/SDL.h> - -#include "GP.h" -#include "GP_SDL.h" - -/* Draw filled triangles? */ -int filled = 0; - -/* The surface used as a display (in fact it is a software surface). */ -SDL_Surface *display = NULL; -GP_Context context; - -/* Frames per second. */ -int fps = 0, fps_min = 1000000, fps_max = 0; - -/* Color pixel values in display format. */ -GP_Pixel black, white; - -/* - * Timer used for FPS measurement and key reactions. - * SDL_USEREVENT is triggered each second. - */ - -SDL_TimerID timer; - -SDL_UserEvent timer_event; - -Uint32 timer_callback(__attribute__((unused)) Uint32 interval, - __attribute__((unused)) void * param) -{ - timer_event.type = SDL_USEREVENT; - SDL_PushEvent((SDL_Event *) &timer_event); - return 1000; -} - - -void draw_frame(void) -{ - int x0 = 0; - int y0 = random() % display->h; - int x1 = display->w; - int y1 = random() % display->h; - int x2 = display->w/2; - int y2 = random() % display->h; - - GP_Pixel pixel; - pixel = GP_RGBToPixel(random() % 255, random() % 255, - random() % 255, context.pixel_type); - - if (filled) - GP_FillTriangle(&context, x0, y0, x1, y1, x2, y2, pixel); - else - GP_Triangle(&context, x0, y0, x1, y1, x2, y2, pixel); -} - -void event_loop(void) -{ - SDL_Event event; - - for (;;) { - while (SDL_PollEvent(&event) > 0) { - switch (event.type) { - case SDL_USEREVENT: - SDL_Flip(display); - fprintf(stdout, "%d triangles/second, min = %d, max = %dr", fps, fps_min, fps_max); - fflush(stdout); - - /* Update frames per second */ - if (fps < fps_min) - fps_min = fps; - if (fps > fps_max) - fps_max = fps; - fps = 0; - break; - case SDL_KEYDOWN: - case SDL_QUIT: - return; - } - } - draw_frame(); - fps++; - } -} - -int main(int argc, char ** argv) -{ - int bit_depth = 0; - - int i; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-f") == 0) { - filled = 1; - } - else if (strcmp(argv[i], "-16") == 0) { - bit_depth = 16; - } - else if (strcmp(argv[i], "-24") == 0) { - bit_depth = 24; - } - else if (strcmp(argv[i], "-32") == 0) { - bit_depth = 32; - } - } - - /* Initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError()); - return 1; - } - - /* Create a window with a software back surface */ - display = SDL_SetVideoMode(640, 480, bit_depth, SDL_SWSURFACE); - if (display == NULL) { - fprintf(stderr, "Could not open display: %sn", SDL_GetError()); - goto fail; - } - - /* Print basic information about the surface */ - printf("Display surface properties:n"); - printf(" width: %4d, height: %4d, pitch: %4dn", - display->w, display->h, display->pitch); - printf(" bits per pixel: %2d, bytes per pixel: %2dn", - display->format->BitsPerPixel, display->format->BytesPerPixel); - printf("Machine properties:n"); - printf(" sizeof(int) = %u, sizeof(long) = %un", - (unsigned int)sizeof(int), (unsigned int)sizeof(long)); - - /* Set up a clipping rectangle to test proper clipping of pixels */ - SDL_Rect clip_rect = { 10, 10, 620, 460 }; - SDL_SetClipRect(display, &clip_rect); - - GP_SDL_ContextFromSurface(&context, display); - - white = GP_ColorToContextPixel(GP_COL_WHITE, &context); - black = GP_ColorToContextPixel(GP_COL_BLACK, &context); - - /* Set up the timer */ - timer = SDL_AddTimer(1000, timer_callback, NULL); - if (timer == 0) { - fprintf(stderr, "Could not set up timer: %sn", SDL_GetError()); - goto fail; - } - - /* Enter the event loop */ - event_loop(); - - /* Preserve the last result by a newline */ - fprintf(stdout, "n"); - - /* We're done */ - SDL_Quit(); - return 0; - -fail: - SDL_Quit(); - return 1; -} -
http://repo.or.cz/w/gfxprim.git/commit/f4623e257dda0ce2f5afffc51be40f4f90221...
commit f4623e257dda0ce2f5afffc51be40f4f9022160e Author: Cyril Hrubis metan@ucw.cz Date: Fri Oct 19 20:06:47 2012 +0200
tests: Remove more unused files.
diff --git a/tests/common/GP_TestingRandom.c b/tests/common/GP_TestingRandom.c deleted file mode 100644 index 17281a9..0000000 --- a/tests/common/GP_TestingRandom.c +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * 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) 2011 Tomas Gavenciak gavento@ucw.cz * - * * - *****************************************************************************/ - -#include <stdlib.h> - -#include "GP_Common.h" -#include "GP_TestingRandom.h" - -/* - * State array for testing random generator - * - * The idea is to have a seperate random generator for generating - * random inputs for tests in case tested algorithms also use - * the random generator. Change in the tested algorithm must not - * change the input data generated for this or other part of the test. - * - * Take care when changing the values - unrelated test might start - * exhibiting a bug, some tests may rely on the exact result. - */ -#define GP_RandomStateSize 256 -static char GP_RandomTestingState[GP_RandomStateSize]; -static struct random_data GP_RandomTestingData; - -long int GP_TestingRandom(void) -{ - int32_t r; - GP_ASSERT(random_r(&GP_RandomTestingData, &r) == 0); - return r; -} - -void GP_InitTestingRandom(const char *text, uint64_t seed) -{ - const char *p = text; - for (; (p) && (*p); p++) - seed = ((seed * 327) + *p) % 0x7B391D50A10A3LL; // TODO replace with large primes - GP_ASSERT(initstate_r(seed, GP_RandomTestingState, GP_RandomStateSize, - &GP_RandomTestingData) == 0); -} - diff --git a/tests/common/GP_TestingRandom.h b/tests/common/GP_TestingRandom.h deleted file mode 100644 index 9f267fb..0000000 --- a/tests/common/GP_TestingRandom.h +++ /dev/null @@ -1,49 +0,0 @@ -/***************************************************************************** - * 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) 2011 Tomas Gavenciak gavento@ucw.cz * - * * - *****************************************************************************/ - -/* - * These routines use a pseudorandom generator with internal state. - * Use this only to provide tests with pseudo-random inputs. - * The seed is initialized with the test name, so the random numbers - * (and therefore inputs) are the same for a test, and do not depend - * on random() called in the tested routines or other tests. - */ - -#ifndef GP_TESTING_RANDOM_H -#define GP_TESTING_RANDOM_H - -#include <stdint.h> - -/* - * Return next random value from the testing random generator - */ -long int GP_TestingRandom(void); - -/* - * Initialize the random generator to a seed computed from the given string - * and the given seed value. Needs to be called at least once. - * - * The string may be for example the name of the test, the seed the number of test iteration. - */ -void GP_InitTestingRandom(const char *text, uint64_t seed); - -#endif /* GP_TESTING_RANDOM_H */ diff --git a/tests/common/GP_Tests.c b/tests/common/GP_Tests.c deleted file mode 100644 index 736c05c..0000000 --- a/tests/common/GP_Tests.c +++ /dev/null @@ -1,79 +0,0 @@ -/***************************************************************************** - * 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) 2011 Tomas Gavenciak gavento@ucw.cz * - * * - *****************************************************************************/ - -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <getopt.h> -#include <check.h> - -typedef Suite* (SuiteFactory)(void); - -/* - * Declare all the manualy created Suite-generating functions here: - */ - -SuiteFactory* manual_suites[] = { - NULL /* Sentinel */ -}; - -/* - * Generated function creating and adding all the suites - */ - -void GP_AddSuitesToSRunner(SRunner *sr); - - -const char usage[] = "Usage:n%s [-v] [-q]n"; - -int main(int argc, char *argv[]) -{ - int verb = CK_NORMAL; - - int opt; - while((opt = getopt(argc, argv, "vq")) >= 0) - switch(opt) { - case 'v': - verb = CK_VERBOSE; - break; - case 'q': - verb = CK_SILENT; - break; - default: - fprintf(stderr, usage, argv[0]); - return(EXIT_FAILURE); - } - - SRunner *sr = srunner_create(NULL); - - SuiteFactory **s; - for (s = manual_suites; *s; s++) { - srunner_add_suite(sr, (*s)()); - } - GP_AddSuitesToSRunner(sr); - - srunner_run_all(sr, verb); - int number_failed = srunner_ntests_failed(sr); - srunner_free(sr); - - return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; -} diff --git a/tests/common/GP_Tests.h b/tests/common/GP_Tests.h deleted file mode 100644 index 72c83bb..0000000 --- a/tests/common/GP_Tests.h +++ /dev/null @@ -1,82 +0,0 @@ -/***************************************************************************** - * 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) 2011 Tomas Gavenciak gavento@ucw.cz * - * * - *****************************************************************************/ - -/* - * Wrappers around check.h unit-test library - * - * Create a .test.c file with (example): - * - * GP_SUITE(suite_name) - * - * GP_TEST(test1) - * { - * fail_unless(1 == 1); - * fail_if(1 < 0, "Impossible!"); - * int i = 3; - * if (1 + 1 == i) fail("Arrgh, 1 + 1 is %d", i); - * } - * GP_ENDTEST - * - * The tests are collected automatically by find_tests.py. - * See below for more options. - */ - -#include <check.h> -#include "GP_TestingRandom.h" - -/* - * Helper macro to allow auto-generation of test-cases and suites. - * Searched for by find_tests.py. - * - * Use alone on a line as - * GP_TEST(testname) - * or - * GP_TEST(testname, "foo=1, bar='baz'") - * The optional string is passed as parameters to Python dict() as parameters - * for the testcase-generator. - * Currently, the following parameters are recognized: - * suite -- name of the suite - * loop_start -- test will be repeated as with: - * loop_end for (int _i = loop_start; _i < loop_end; i++) { ... } - * expect_exit -- expect the function to exit with given exitcode - * expect_signal -- expect the function to exit with given exitcode - * - * Parameters name, fname, line are used internally, do not use them - */ - -#define GP_TEST(name, ...) static void name(int); void GP_TEST_##name(int i) {- GP_InitTestingRandom( #name, i); name(i); } - START_TEST(name) - -#define GP_ENDTEST END_TEST - -/* - * Helper macro to allow auto-generation of suites. - * Defines suite from this point until EOF or redefinition. - * Searched for by find_tests.py - * - * Use alone on a line as - * GP_SUITE(suitename) - */ - -#define GP_SUITE(name, ...) -
http://repo.or.cz/w/gfxprim.git/commit/5fb5fa695cc7e152587edb6f8d76ed531f0cc...
commit 5fb5fa695cc7e152587edb6f8d76ed531f0cc6cb Author: Cyril Hrubis metan@ucw.cz Date: Fri Oct 19 20:04:09 2012 +0200
tests: core: Add simple context test.
diff --git a/tests/core/Context.c b/tests/core/Context.c new file mode 100644 index 0000000..ec83876 --- /dev/null +++ b/tests/core/Context.c @@ -0,0 +1,107 @@ +/***************************************************************************** + * 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 * + * * + *****************************************************************************/ + +/* + + Very basic GP_Context tests. + + */ + +#include <core/GP_Context.h> + +#include "tst_test.h" + +/* + * Check that Context is correctly allocated and freed + */ +static int Context_Alloc_Free(void) +{ + GP_Context *c; + + c = GP_ContextAlloc(100, 200, GP_PIXEL_RGB888); + + if (c == NULL) { + tst_report(0, "GP_ContextAlloc() failed"); + return TST_FAILED; + } + + /* Assert context properties */ + if (c->bpp != 24) { + tst_report(0, "Context->bpp != 24 (== %i)", c->bpp); + return TST_FAILED; + } + + if (c->bytes_per_row != 3 * c->w) { + tst_report(0, "Context->bytes_per_row != %i (== %i)", + 3 * c->w, c->bytes_per_row); + return TST_FAILED; + } + + if (c->w != 100) { + tst_report(0, "Context->w != 100 (== %i)", c->w); + return TST_FAILED; + } + + if (c->h != 200) { + tst_report(0, "Context->h != 200 (== %i)", c->h); + return TST_FAILED; + } + + if (c->offset != 0) { + tst_report(0, "Context->offset != 0"); + return TST_FAILED; + } + + if (c->pixel_type != GP_PIXEL_RGB888) { + tst_report(0, "Context->pixel_type != GP_PIXEL_RGB888"); + return TST_FAILED; + } + + if (c->gamma != NULL) { + tst_report(0, "Context->gamma != NULL"); + return TST_FAILED; + } + + if (c->axes_swap != 0 || c->x_swap != 0 || c->y_swap != 0) { + tst_report(0, "Wrong default orientation %i %i %i", + c->axes_swap, c->x_swap, c->y_swap); + return TST_FAILED; + } + + /* access the pixel buffer */ + *(char*)GP_PIXEL_ADDR(c, 0, 0) = 0; + *(char*)GP_PIXEL_ADDR(c, 100, 100) = 0; + + GP_ContextFree(c); + + return TST_SUCCESS; +} + +const struct tst_suite tst_suite = { + .suite_name = "Context Testsuite", + .tests = { + {.name = "Context Alloc Free", .tst_fn = Context_Alloc_Free, + .flags = TST_CHECK_MALLOC}, + + {.name = NULL}, + } +}; diff --git a/tests/core/Makefile b/tests/core/Makefile index f030894..6b8b9a0 100644 --- a/tests/core/Makefile +++ b/tests/core/Makefile @@ -2,14 +2,14 @@ TOPDIR=../..
include $(TOPDIR)/pre.mk
-#CSOURCES=$(shell echo *.c) +CSOURCES=Context.c
# hack LIBNAME=core
GENSOURCES+=WritePixel_testsuite.gen.c
-APPS=WritePixel_testsuite.gen +APPS=WritePixel_testsuite.gen Context
include ../tests.mk
diff --git a/tests/core/runtest.sh b/tests/core/runtest.sh index 0a9821e..a392647 100755 --- a/tests/core/runtest.sh +++ b/tests/core/runtest.sh @@ -10,3 +10,4 @@ export LIBC_FATAL_STDERR_=1
LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./WritePixel_testsuite.gen "$@" +LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Context "$@"
-----------------------------------------------------------------------
Summary of changes: tests/SDL/Makefile | 2 +- tests/SDL/trianglefps.c | 186 ------------------------- tests/common/GP_TestingRandom.c | 58 -------- tests/common/GP_TestingRandom.h | 49 ------- tests/common/GP_Tests.c | 79 ----------- tests/common/GP_Tests.h | 82 ----------- tests/{framework/tst_job.h => core/Context.c} | 127 +++++++++-------- tests/core/Makefile | 4 +- tests/core/runtest.sh | 1 + 9 files changed, 73 insertions(+), 515 deletions(-) delete mode 100644 tests/SDL/trianglefps.c delete mode 100644 tests/common/GP_TestingRandom.c delete mode 100644 tests/common/GP_TestingRandom.h delete mode 100644 tests/common/GP_Tests.c delete mode 100644 tests/common/GP_Tests.h copy tests/{framework/tst_job.h => core/Context.c} (51%)
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.