Merged Andreas' changes

This commit is contained in:
Sam Lantinga 2012-12-22 16:52:00 -08:00
commit f1d2b88a2f
17 changed files with 1739 additions and 184 deletions

View file

@ -41,6 +41,7 @@
#include "SDL_test_assert.h"
#include "SDL_test_harness.h"
#include "SDL_test_images.h"
#include "SDL_test_compare.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */

View file

@ -0,0 +1,72 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_test_compare.h
*
* Include file for SDL test framework.
*
* This code is a part of the SDL2_test library, not the main SDL library.
*/
/*
Defines comparison functions (i.e. for surfaces).
*/
#ifndef _SDL_test_compare_h
#define _SDL_test_compare_h
#include "SDL.h"
#include "SDL_test_images.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
extern "C" {
/* *INDENT-ON* */
#endif
/**
* \brief Compares a surface and with reference image data for equality
*
* \param sur Surface used in comparison
* \param img Test Surface used in comparison
* \param allowable_error Allowable difference in blending accuracy
*
* \returns 0 if comparison succeeded, >0 (=number of pixels where comparison failed) if comparison failed, <0 for any other error.
*/
int SDLTest_CompareSurfaces(SDL_Surface *sur, SDL_Surface *img, int allowable_error);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
}
/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_test_compare_h */
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -105,11 +105,12 @@ typedef struct SDLTest_TestSuiteReference {
* \param testSuites Suites containing the test case.
* \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
* \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
* \param filter Filter specification. NULL disables. Case sensitive.
* \param testIterations Number of iterations to run each test case.
*
* \returns Test run result; 0 when all tests passed, 1 if any tests failed.
*/
int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, Uint64 userExecKey, int testIterations);
int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, Uint64 userExecKey, char *filter, int testIterations);
/* Ends C function definitions when using C++ */

View file

@ -36,6 +36,8 @@
#ifndef _SDL_test_images_h
#define _SDL_test_images_h
#include "SDL.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
@ -44,29 +46,28 @@ extern "C" {
/* *INDENT-ON* */
#endif
/**
*Type for test images.
*/
typedef struct SDLTest_SurfaceImage_s {
int width;
int height;
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
const unsigned char pixel_data[];
} SDLTest_SurfaceImage_t;
/* Test images */
const SDLTest_SurfaceImage_t SDLTest_imageBlit;
const SDLTest_SurfaceImage_t SDLTest_imageBlitColor;
const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha;
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd;
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend;
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod;
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone;
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll;
const SDLTest_SurfaceImage_t SDLTest_ImageFace;
const SDLTest_SurfaceImage_t SDLTest_imagePrimitives;
const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend;
SDL_Surface *SDLTest_ImageBlit();
SDL_Surface *SDLTest_ImageBlitColor();
SDL_Surface *SDLTest_ImageBlitAlpha();
SDL_Surface *SDLTest_ImageBlitBlendAdd();
SDL_Surface *SDLTest_ImageBlitBlend();
SDL_Surface *SDLTest_ImageBlitBlendMod();
SDL_Surface *SDLTest_ImageBlitBlendNone();
SDL_Surface *SDLTest_ImageBlitBlendAll();
SDL_Surface *SDLTest_ImageFace();
SDL_Surface *SDLTest_ImagePrimitives();
SDL_Surface *SDLTest_ImagePrimitivesBlend();
/* Ends C function definitions when using C++ */
#ifdef __cplusplus