Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
authorAndreas Schiffler <aschiffler@ferzkopp.net>
Sat, 22 Dec 2012 16:06:55 -0800
changeset 67639cbd31a3450b
parent 6762 c680e085a5f2
child 6765 5448f332bfe6
Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
VisualC/SDLtest/SDLtest_VS2010.vcxproj
VisualC/SDLtest/SDLtest_VS2012.vcxproj
include/SDL_test.h
include/SDL_test_compare.h
include/SDL_test_harness.h
include/SDL_test_images.h
src/test/SDL_test_compare.c
src/test/SDL_test_fuzzer.c
src/test/SDL_test_harness.c
src/test/SDL_test_imageBlit.c
src/test/SDL_test_imageBlitBlend.c
src/test/SDL_test_imageFace.c
src/test/SDL_test_imagePrimitives.c
src/test/SDL_test_imagePrimitivesBlend.c
test/testautomation.c
test/tests/testrender.c
test/tests/testsuites.h
     1.1 --- a/VisualC/SDLtest/SDLtest_VS2010.vcxproj	Thu Dec 20 08:50:36 2012 -0800
     1.2 +++ b/VisualC/SDLtest/SDLtest_VS2010.vcxproj	Sat Dec 22 16:06:55 2012 -0800
     1.3 @@ -162,6 +162,7 @@
     1.4      <ClInclude Include="..\..\include\SDL_test_md5.h" />
     1.5      <ClInclude Include="..\..\include\SDL_test_random.h" />
     1.6      <ClInclude Include="..\..\include\SDL_test_images.h" />
     1.7 +    <ClInclude Include="..\..\include\SDL_test_compare.h" />
     1.8    </ItemGroup>
     1.9    <ItemGroup>
    1.10      <ClCompile Include="..\..\src\test\SDL_test_assert.c" />
    1.11 @@ -178,6 +179,7 @@
    1.12      <ClCompile Include="..\..\src\test\SDL_test_imageFace.c" />
    1.13      <ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c" />
    1.14      <ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c" />
    1.15 +    <ClCompile Include="..\..\src\test\SDL_test_compare.c" />
    1.16    </ItemGroup>
    1.17    <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
    1.18    <ImportGroup Label="ExtensionTargets">
     2.1 --- a/VisualC/SDLtest/SDLtest_VS2012.vcxproj	Thu Dec 20 08:50:36 2012 -0800
     2.2 +++ b/VisualC/SDLtest/SDLtest_VS2012.vcxproj	Sat Dec 22 16:06:55 2012 -0800
     2.3 @@ -166,6 +166,7 @@
     2.4      <ClInclude Include="..\..\include\SDL_test_md5.h" />
     2.5      <ClInclude Include="..\..\include\SDL_test_random.h" />
     2.6      <ClInclude Include="..\..\include\SDL_test_images.h" />
     2.7 +    <ClInclude Include="..\..\include\SDL_test_compare.h" />
     2.8    </ItemGroup>
     2.9    <ItemGroup>
    2.10      <ClCompile Include="..\..\src\test\SDL_test_assert.c" />
    2.11 @@ -182,6 +183,7 @@
    2.12      <ClCompile Include="..\..\src\test\SDL_test_imageFace.c" />
    2.13      <ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c" />
    2.14      <ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c" />
    2.15 +    <ClCompile Include="..\..\src\test\SDL_test_compare.c" />
    2.16    </ItemGroup>
    2.17    <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
    2.18    <ImportGroup Label="ExtensionTargets">
     3.1 --- a/include/SDL_test.h	Thu Dec 20 08:50:36 2012 -0800
     3.2 +++ b/include/SDL_test.h	Sat Dec 22 16:06:55 2012 -0800
     3.3 @@ -41,6 +41,7 @@
     3.4  #include "SDL_test_assert.h"
     3.5  #include "SDL_test_harness.h"
     3.6  #include "SDL_test_images.h"
     3.7 +#include "SDL_test_compare.h"
     3.8  
     3.9  #include "begin_code.h"
    3.10  /* Set up for C function definitions, even when using C++ */
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/include/SDL_test_compare.h	Sat Dec 22 16:06:55 2012 -0800
     4.3 @@ -0,0 +1,72 @@
     4.4 +/*
     4.5 +  Simple DirectMedia Layer
     4.6 +  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     4.7 +
     4.8 +  This software is provided 'as-is', without any express or implied
     4.9 +  warranty.  In no event will the authors be held liable for any damages
    4.10 +  arising from the use of this software.
    4.11 +
    4.12 +  Permission is granted to anyone to use this software for any purpose,
    4.13 +  including commercial applications, and to alter it and redistribute it
    4.14 +  freely, subject to the following restrictions:
    4.15 +
    4.16 +  1. The origin of this software must not be misrepresented; you must not
    4.17 +     claim that you wrote the original software. If you use this software
    4.18 +     in a product, an acknowledgment in the product documentation would be
    4.19 +     appreciated but is not required.
    4.20 +  2. Altered source versions must be plainly marked as such, and must not be
    4.21 +     misrepresented as being the original software.
    4.22 +  3. This notice may not be removed or altered from any source distribution.
    4.23 +*/
    4.24 +
    4.25 +/**
    4.26 + *  \file SDL_test_compare.h
    4.27 + *  
    4.28 + *  Include file for SDL test framework.
    4.29 + *
    4.30 + *  This code is a part of the SDL2_test library, not the main SDL library.
    4.31 + */
    4.32 +
    4.33 +/* 
    4.34 +
    4.35 + Defines comparison functions (i.e. for surfaces).
    4.36 +  
    4.37 +*/
    4.38 +
    4.39 +#ifndef _SDL_test_compare_h
    4.40 +#define _SDL_test_compare_h
    4.41 +
    4.42 +#include "SDL.h"
    4.43 +#include "SDL_test_images.h"
    4.44 +
    4.45 +#include "begin_code.h"
    4.46 +/* Set up for C function definitions, even when using C++ */
    4.47 +#ifdef __cplusplus
    4.48 +/* *INDENT-OFF* */
    4.49 +extern "C" {
    4.50 +/* *INDENT-ON* */
    4.51 +#endif
    4.52 +
    4.53 +/**
    4.54 + * \brief Compares a surface and with reference image data for equality
    4.55 + *
    4.56 + * \param sur Surface used in comparison
    4.57 + * \param img Test Surface used in comparison
    4.58 + * \param allowable_error Allowable difference in blending accuracy
    4.59 + *
    4.60 + * \returns 0 if comparison succeeded, >0 (=number of pixels where comparison failed) if comparison failed, <0 for any other error.
    4.61 + */
    4.62 +int SDLTest_CompareSurfaces(SDL_Surface *sur, SDL_Surface *img, int allowable_error);
    4.63 +      
    4.64 +
    4.65 +/* Ends C function definitions when using C++ */
    4.66 +#ifdef __cplusplus
    4.67 +/* *INDENT-OFF* */
    4.68 +}
    4.69 +/* *INDENT-ON* */
    4.70 +#endif
    4.71 +#include "close_code.h"
    4.72 +
    4.73 +#endif /* _SDL_test_compare_h */
    4.74 +
    4.75 +/* vi: set ts=4 sw=4 expandtab: */
     5.1 --- a/include/SDL_test_harness.h	Thu Dec 20 08:50:36 2012 -0800
     5.2 +++ b/include/SDL_test_harness.h	Sat Dec 22 16:06:55 2012 -0800
     5.3 @@ -105,11 +105,12 @@
     5.4   * \param testSuites Suites containing the test case.
     5.5   * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
     5.6   * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
     5.7 + * \param filter Filter specification. NULL disables. Case sensitive.
     5.8   * \param testIterations Number of iterations to run each test case.
     5.9   *
    5.10   * \returns Test run result; 0 when all tests passed, 1 if any tests failed.
    5.11   */
    5.12 -int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, Uint64 userExecKey, int testIterations);
    5.13 +int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, Uint64 userExecKey, char *filter, int testIterations);
    5.14           
    5.15  
    5.16  /* Ends C function definitions when using C++ */
     6.1 --- a/include/SDL_test_images.h	Thu Dec 20 08:50:36 2012 -0800
     6.2 +++ b/include/SDL_test_images.h	Sat Dec 22 16:06:55 2012 -0800
     6.3 @@ -36,6 +36,8 @@
     6.4  #ifndef _SDL_test_images_h
     6.5  #define _SDL_test_images_h
     6.6  
     6.7 +#include "SDL.h"
     6.8 +
     6.9  #include "begin_code.h"
    6.10  /* Set up for C function definitions, even when using C++ */
    6.11  #ifdef __cplusplus
    6.12 @@ -44,29 +46,28 @@
    6.13  /* *INDENT-ON* */
    6.14  #endif
    6.15  
    6.16 -
    6.17  /**
    6.18   *Type for test images.
    6.19   */
    6.20  typedef struct SDLTest_SurfaceImage_s {
    6.21    int width;
    6.22    int height;
    6.23 -  unsigned int  bytes_per_pixel; /* 3:RGB, 4:RGBA */ 
    6.24 +  unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ 
    6.25    const unsigned char pixel_data[];
    6.26  } SDLTest_SurfaceImage_t;
    6.27  
    6.28  /* Test images */
    6.29 -const SDLTest_SurfaceImage_t SDLTest_imageBlit;
    6.30 -const SDLTest_SurfaceImage_t SDLTest_imageBlitColor;
    6.31 -const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha;
    6.32 -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd;
    6.33 -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend;
    6.34 -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod;
    6.35 -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone;
    6.36 -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll;
    6.37 -const SDLTest_SurfaceImage_t SDLTest_ImageFace;
    6.38 -const SDLTest_SurfaceImage_t SDLTest_imagePrimitives;
    6.39 -const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend;
    6.40 +SDL_Surface *SDLTest_ImageBlit();
    6.41 +SDL_Surface *SDLTest_ImageBlitColor();
    6.42 +SDL_Surface *SDLTest_ImageBlitAlpha();
    6.43 +SDL_Surface *SDLTest_ImageBlitBlendAdd();
    6.44 +SDL_Surface *SDLTest_ImageBlitBlend();
    6.45 +SDL_Surface *SDLTest_ImageBlitBlendMod();
    6.46 +SDL_Surface *SDLTest_ImageBlitBlendNone();
    6.47 +SDL_Surface *SDLTest_ImageBlitBlendAll();
    6.48 +SDL_Surface *SDLTest_ImageFace();
    6.49 +SDL_Surface *SDLTest_ImagePrimitives();
    6.50 +SDL_Surface *SDLTest_ImagePrimitivesBlend();
    6.51  
    6.52  /* Ends C function definitions when using C++ */
    6.53  #ifdef __cplusplus
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/test/SDL_test_compare.c	Sat Dec 22 16:06:55 2012 -0800
     7.3 @@ -0,0 +1,83 @@
     7.4 +/*
     7.5 +  Simple DirectMedia Layer
     7.6 +  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     7.7 +
     7.8 +  This software is provided 'as-is', without any express or implied
     7.9 +  warranty.  In no event will the authors be held liable for any damages
    7.10 +  arising from the use of this software.
    7.11 +
    7.12 +  Permission is granted to anyone to use this software for any purpose,
    7.13 +  including commercial applications, and to alter it and redistribute it
    7.14 +  freely, subject to the following restrictions:
    7.15 +
    7.16 +  1. The origin of this software must not be misrepresented; you must not
    7.17 +     claim that you wrote the original software. If you use this software
    7.18 +     in a product, an acknowledgment in the product documentation would be
    7.19 +     appreciated but is not required.
    7.20 +  2. Altered source versions must be plainly marked as such, and must not be
    7.21 +     misrepresented as being the original software.
    7.22 +  3. This notice may not be removed or altered from any source distribution.
    7.23 +*/
    7.24 +
    7.25 +/*
    7.26 +
    7.27 + Based on automated SDL_Surface tests originally written by Edgar Simo 'bobbens'.
    7.28 + 
    7.29 + Rewritten for test lib by Andreas Schiffler.
    7.30 +
    7.31 +*/
    7.32 +
    7.33 +#include "SDL_config.h"
    7.34 +
    7.35 +#include "SDL_test.h"
    7.36 +
    7.37 +
    7.38 +int SDLTest_CompareSurfaces( SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error )
    7.39 +{
    7.40 +   int ret;
    7.41 +   int i,j;
    7.42 +   int bpp, bpp_reference;
    7.43 +   Uint8 *p, *p_reference;
    7.44 +   int dist;
    7.45 +   Uint8 R, G, B, A;
    7.46 +   Uint8 Rd, Gd, Bd, Ad;
    7.47 +
    7.48 +   /* Make surfacee size is the same. */
    7.49 +   if ((surface->w != referenceSurface->w) || (surface->h != referenceSurface->h))
    7.50 +   {
    7.51 +      return -1;
    7.52 +   }
    7.53 +
    7.54 +   SDL_LockSurface( surface );
    7.55 +   SDL_LockSurface( referenceSurface );
    7.56 +
    7.57 +   ret = 0;
    7.58 +   bpp = surface->format->BytesPerPixel;
    7.59 +   bpp_reference = referenceSurface->format->BytesPerPixel;
    7.60 +
    7.61 +   /* Compare image - should be same format. */
    7.62 +   for (j=0; j<surface->h; j++) {
    7.63 +      for (i=0; i<surface->w; i++) {
    7.64 +         p  = (Uint8 *)surface->pixels + j * surface->pitch + i * bpp;
    7.65 +         p_reference = (Uint8 *)referenceSurface->pixels + j * referenceSurface->pitch + i * bpp_reference;
    7.66 +         dist = 0;
    7.67 +
    7.68 +         SDL_GetRGBA(*(Uint32*)p, surface->format, &R, &G, &B, &A);
    7.69 +         SDL_GetRGBA(*(Uint32*)p_reference, referenceSurface->format, &Rd, &Gd, &Bd, &Ad);
    7.70 +
    7.71 +         dist += (R-Rd)*(R-Rd);
    7.72 +         dist += (G-Gd)*(G-Gd);
    7.73 +         dist += (B-Bd)*(B-Bd);
    7.74 +                  
    7.75 +         /* Allow some difference in blending accuracy */
    7.76 +         if (dist > allowable_error) {
    7.77 +            ret++;
    7.78 +         }
    7.79 +      }
    7.80 +   }
    7.81 +
    7.82 +   SDL_UnlockSurface( surface );
    7.83 +   SDL_UnlockSurface( referenceSurface );
    7.84 +
    7.85 +   return ret;
    7.86 +}
     8.1 --- a/src/test/SDL_test_fuzzer.c	Thu Dec 20 08:50:36 2012 -0800
     8.2 +++ b/src/test/SDL_test_fuzzer.c	Sat Dec 22 16:06:55 2012 -0800
     8.3 @@ -116,8 +116,8 @@
     8.4  Uint64
     8.5  SDLTest_RandomUint64()
     8.6  {
     8.7 -	Uint64 value;
     8.8 -	Uint32 *vp = (void*)&value;
     8.9 +	Uint64 value = 0;
    8.10 +	Uint32 *vp = (void *)&value;
    8.11  
    8.12  	fuzzerInvocationCounter++;
    8.13  
    8.14 @@ -130,8 +130,8 @@
    8.15  Sint64
    8.16  SDLTest_RandomSint64()
    8.17  {
    8.18 -	Uint64 value;
    8.19 -	Uint32 *vp = (void*)&value;
    8.20 +	Uint64 value = 0;
    8.21 +	Uint32 *vp = (void *)&value;
    8.22  
    8.23  	fuzzerInvocationCounter++;
    8.24  
     9.1 --- a/src/test/SDL_test_harness.c	Thu Dec 20 08:50:36 2012 -0800
     9.2 +++ b/src/test/SDL_test_harness.c	Sat Dec 22 16:06:55 2012 -0800
     9.3 @@ -1,22 +1,22 @@
     9.4  /*
     9.5 -  Simple DirectMedia Layer
     9.6 -  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     9.7 +Simple DirectMedia Layer
     9.8 +Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     9.9  
    9.10 -  This software is provided 'as-is', without any express or implied
    9.11 -  warranty.  In no event will the authors be held liable for any damages
    9.12 -  arising from the use of this software.
    9.13 +This software is provided 'as-is', without any express or implied
    9.14 +warranty.  In no event will the authors be held liable for any damages
    9.15 +arising from the use of this software.
    9.16  
    9.17 -  Permission is granted to anyone to use this software for any purpose,
    9.18 -  including commercial applications, and to alter it and redistribute it
    9.19 -  freely, subject to the following restrictions:
    9.20 +Permission is granted to anyone to use this software for any purpose,
    9.21 +including commercial applications, and to alter it and redistribute it
    9.22 +freely, subject to the following restrictions:
    9.23  
    9.24 -  1. The origin of this software must not be misrepresented; you must not
    9.25 -     claim that you wrote the original software. If you use this software
    9.26 -     in a product, an acknowledgment in the product documentation would be
    9.27 -     appreciated but is not required.
    9.28 -  2. Altered source versions must be plainly marked as such, and must not be
    9.29 -     misrepresented as being the original software.
    9.30 -  3. This notice may not be removed or altered from any source distribution.
    9.31 +1. The origin of this software must not be misrepresented; you must not
    9.32 +claim that you wrote the original software. If you use this software
    9.33 +in a product, an acknowledgment in the product documentation would be
    9.34 +appreciated but is not required.
    9.35 +2. Altered source versions must be plainly marked as such, and must not be
    9.36 +misrepresented as being the original software.
    9.37 +3. This notice may not be removed or altered from any source distribution.
    9.38  */
    9.39  
    9.40  #include "SDL_config.h"
    9.41 @@ -41,17 +41,17 @@
    9.42  static Uint32 SDLTest_TestCaseTimeout = 3600;
    9.43  
    9.44  /**
    9.45 - * Generates a random run seed string for the harness. The generated seed
    9.46 - * will contain alphanumeric characters (0-9A-Z).
    9.47 - *
    9.48 - * Note: The returned string needs to be deallocated by the caller.
    9.49 - *
    9.50 - * \param length The length of the seed string to generate
    9.51 - *
    9.52 - * \returns The generated seed string
    9.53 - */
    9.54 +* Generates a random run seed string for the harness. The generated seed
    9.55 +* will contain alphanumeric characters (0-9A-Z).
    9.56 +*
    9.57 +* Note: The returned string needs to be deallocated by the caller.
    9.58 +*
    9.59 +* \param length The length of the seed string to generate
    9.60 +*
    9.61 +* \returns The generated seed string
    9.62 +*/
    9.63  char *
    9.64 -SDLTest_GenerateRunSeed(const int length)
    9.65 +	SDLTest_GenerateRunSeed(const int length)
    9.66  {
    9.67  	char *seed = NULL;
    9.68  	SDLTest_RandomContext randomContext;
    9.69 @@ -86,18 +86,18 @@
    9.70  }
    9.71  
    9.72  /**
    9.73 - * Generates an execution key for the fuzzer.
    9.74 - *
    9.75 - * \param runSeed		The run seed to use
    9.76 - * \param suiteName		The name of the test suite
    9.77 - * \param testName		The name of the test
    9.78 - * \param iteration		The iteration count
    9.79 - *
    9.80 - * \returns The generated execution key to initialize the fuzzer with.
    9.81 - *
    9.82 - */
    9.83 +* Generates an execution key for the fuzzer.
    9.84 +*
    9.85 +* \param runSeed		The run seed to use
    9.86 +* \param suiteName		The name of the test suite
    9.87 +* \param testName		The name of the test
    9.88 +* \param iteration		The iteration count
    9.89 +*
    9.90 +* \returns The generated execution key to initialize the fuzzer with.
    9.91 +*
    9.92 +*/
    9.93  Uint64
    9.94 -SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration)
    9.95 +	SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration)
    9.96  {
    9.97  	SDLTest_Md5Context md5Context;
    9.98  	Uint64 *keys;
    9.99 @@ -157,17 +157,17 @@
   9.100  }
   9.101  
   9.102  /**
   9.103 - * \brief Set timeout handler for test.
   9.104 - *
   9.105 - * Note: SDL_Init(SDL_INIT_TIMER) will be called if it wasn't done so before.
   9.106 - *
   9.107 - * \param timeout Timeout interval in seconds.
   9.108 - * \param callback Function that will be called after timeout has elapsed.
   9.109 - * 
   9.110 - * \return Timer id or -1 on failure.
   9.111 - */
   9.112 +* \brief Set timeout handler for test.
   9.113 +*
   9.114 +* Note: SDL_Init(SDL_INIT_TIMER) will be called if it wasn't done so before.
   9.115 +*
   9.116 +* \param timeout Timeout interval in seconds.
   9.117 +* \param callback Function that will be called after timeout has elapsed.
   9.118 +* 
   9.119 +* \return Timer id or -1 on failure.
   9.120 +*/
   9.121  SDL_TimerID
   9.122 -SDLTest_SetTestTimeout(int timeout, void (*callback)())
   9.123 +	SDLTest_SetTestTimeout(int timeout, void (*callback)())
   9.124  {
   9.125  	Uint32 timeoutInMilliseconds;
   9.126  	SDL_TimerID timerID;
   9.127 @@ -201,24 +201,27 @@
   9.128  	return timerID;
   9.129  }
   9.130  
   9.131 +/**
   9.132 +* \brief Timeout handler. Aborts test run and exits harness process.
   9.133 +*/
   9.134  void
   9.135 -SDLTest_BailOut()
   9.136 +	SDLTest_BailOut()
   9.137  {
   9.138  	SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run.");
   9.139  	exit(TEST_ABORTED); // bail out from the test
   9.140  }
   9.141  
   9.142  /**
   9.143 - * \brief Execute a test using the given execution key.
   9.144 - *
   9.145 - * \param testSuite Suite containing the test case.
   9.146 - * \param testCase Case to execute.
   9.147 - * \param execKey Execution key for the fuzzer.
   9.148 - *
   9.149 - * \returns Test case result.
   9.150 - */
   9.151 +* \brief Execute a test using the given execution key.
   9.152 +*
   9.153 +* \param testSuite Suite containing the test case.
   9.154 +* \param testCase Case to execute.
   9.155 +* \param execKey Execution key for the fuzzer.
   9.156 +*
   9.157 +* \returns Test case result.
   9.158 +*/
   9.159  int
   9.160 -SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey)
   9.161 +	SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey)
   9.162  {
   9.163  	SDL_TimerID timer = 0;
   9.164  	int testResult = 0;
   9.165 @@ -232,11 +235,12 @@
   9.166  
   9.167  	if (!testCase->enabled)
   9.168  	{
   9.169 -		SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped");
   9.170 +		SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped (Disabled)");
   9.171  		return TEST_RESULT_SKIPPED;
   9.172  	}
   9.173  
   9.174 -        // Initialize fuzzer
   9.175 +
   9.176 +	// Initialize fuzzer
   9.177  	SDLTest_FuzzerInit(execKey);
   9.178  
   9.179  	// Reset assert tracker
   9.180 @@ -315,17 +319,21 @@
   9.181  }
   9.182  
   9.183  /**
   9.184 - * \brief Execute a test suite using the given run seend and execution key.
   9.185 - *
   9.186 - * \param testSuites Suites containing the test case.
   9.187 - * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
   9.188 - * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
   9.189 - * \param testIterations Number of iterations to run each test case.
   9.190 - *
   9.191 - * \returns Test run result; 0 when all tests passed, 1 if any tests failed.
   9.192 - */
   9.193 +* \brief Execute a test suite using the given run seend and execution key.
   9.194 +*
   9.195 +* The filter string is matched to the suite name (full comparison) to select a single suite,
   9.196 +* or if no suite matches, it is matched to the test names (full comparison) to select a single test.
   9.197 +*
   9.198 +* \param testSuites Suites containing the test case.
   9.199 +* \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
   9.200 +* \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
   9.201 +* \param filter Filter specification. NULL disables. Case sensitive.
   9.202 +* \param testIterations Number of iterations to run each test case.
   9.203 +*
   9.204 +* \returns Test run result; 0 when all tests passed, 1 if any tests failed.
   9.205 +*/
   9.206  int
   9.207 -SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, Uint64 userExecKey, int testIterations)
   9.208 +	SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, Uint64 userExecKey, char *filter, int testIterations)
   9.209  {
   9.210  	int suiteCounter;
   9.211  	int testCounter;
   9.212 @@ -343,6 +351,10 @@
   9.213  	float suiteEndSeconds;
   9.214  	float testEndSeconds;
   9.215  	float runtime;
   9.216 +	int suiteFilter = 0;
   9.217 +	char *suiteFilterName = NULL;
   9.218 +	int testFilter = 0;
   9.219 +	char *testFilterName = NULL;
   9.220  	int testResult = 0;
   9.221  	int runResult = 0;
   9.222  	Uint32 totalTestFailedCount = 0;
   9.223 @@ -370,6 +382,7 @@
   9.224  		runSeed = userRunSeed;
   9.225  	}
   9.226  
   9.227 +
   9.228  	// Reset per-run counters
   9.229  	totalTestFailedCount = 0;
   9.230  	totalTestPassedCount = 0;
   9.231 @@ -381,121 +394,184 @@
   9.232  	// Log run with fuzzer parameters
   9.233  	SDLTest_Log("::::: Test Run /w seed '%s' started\n", runSeed);
   9.234  
   9.235 +	// Initialize filtering
   9.236 +	if (filter != NULL && SDL_strlen(filter) > 0) {
   9.237 +		/* Loop over all suites to check if we have a filter match */
   9.238 +		suiteCounter = 0;
   9.239 +		while (testSuites[suiteCounter] && suiteFilter == 0) {
   9.240 +			testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
   9.241 +			suiteCounter++;
   9.242 +			if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) {
   9.243 +				/* Matched a suite name */
   9.244 +				suiteFilter = 1;
   9.245 +				suiteFilterName = testSuite->name;
   9.246 +				SDLTest_Log("Filtering: running only suite '%s'", suiteFilterName);
   9.247 +				break;
   9.248 +			}
   9.249 +
   9.250 +			/* Within each suite, loop over all test cases to check if we have a filter match */
   9.251 +			testCounter = 0;
   9.252 +			while (testSuite->testCases[testCounter] && testFilter == 0)
   9.253 +			{
   9.254 +				testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
   9.255 +				testCounter++;
   9.256 +				if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) {
   9.257 +					/* Matched a test name */
   9.258 +					suiteFilter = 1;
   9.259 +					suiteFilterName = testSuite->name;
   9.260 +					testFilter = 1;
   9.261 +					testFilterName = testCase->name;
   9.262 +					SDLTest_Log("Filtering: running only test '%s' in suite '%s'", testFilterName, suiteFilterName);					
   9.263 +					break;
   9.264 +				}
   9.265 +			}						
   9.266 +		}
   9.267 +		
   9.268 +		if (suiteFilter == 0 && testFilter == 0) {
   9.269 +			SDLTest_LogError("Filter '%s' did not match any test suite/case.", filter);
   9.270 +			SDLTest_Log("Exit code: 2");	
   9.271 +			return 2;
   9.272 +		}		
   9.273 +	}
   9.274 +
   9.275  	// Loop over all suites
   9.276  	suiteCounter = 0;
   9.277  	while(testSuites[suiteCounter]) {
   9.278  		testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
   9.279 +		currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTest_InvalidNameFormat);
   9.280  		suiteCounter++;
   9.281  
   9.282 -		// Reset per-suite counters
   9.283 -		testFailedCount = 0;
   9.284 -		testPassedCount = 0;
   9.285 -		testSkippedCount = 0;
   9.286 +		// Filter suite if flag set and we have a name
   9.287 +		if (suiteFilter == 1 && suiteFilterName != NULL && testSuite->name != NULL &&
   9.288 +			SDL_strcmp(suiteFilterName, testSuite->name) != 0) {
   9.289 +				// Skip suite
   9.290 +				SDLTest_Log("===== Test Suite %i: '%s' skipped\n", 
   9.291 +					suiteCounter, 
   9.292 +					currentSuiteName);
   9.293 +		} else {
   9.294  
   9.295 -		// Take time - suite start
   9.296 -		suiteStartSeconds = GetClock();
   9.297 +			// Reset per-suite counters
   9.298 +			testFailedCount = 0;
   9.299 +			testPassedCount = 0;
   9.300 +			testSkippedCount = 0;
   9.301  
   9.302 -		// Log suite started
   9.303 -		currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTest_InvalidNameFormat);
   9.304 -		SDLTest_Log("===== Test Suite %i: '%s' started\n", 
   9.305 -			suiteCounter, 
   9.306 -			currentSuiteName);
   9.307 +			// Take time - suite start
   9.308 +			suiteStartSeconds = GetClock();
   9.309  
   9.310 -		// Loop over all test cases
   9.311 -		testCounter = 0;
   9.312 -		while(testSuite->testCases[testCounter])
   9.313 -		{
   9.314 -			testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
   9.315 -			testCounter++;
   9.316 -			
   9.317 -			// Take time - test start
   9.318 -			testStartSeconds = GetClock();
   9.319 +			// Log suite started
   9.320 +			SDLTest_Log("===== Test Suite %i: '%s' started\n", 
   9.321 +				suiteCounter, 
   9.322 +				currentSuiteName);
   9.323  
   9.324 -			// Log test started
   9.325 -			currentTestName = (char *)((testCase->name) ? testCase->name : SDLTest_InvalidNameFormat);
   9.326 -			SDLTest_Log("----- Test Case %i.%i: '%s' started",
   9.327 -			        suiteCounter,
   9.328 -				testCounter, 
   9.329 -				currentTestName);
   9.330 -			if (testCase->description != NULL && strlen(testCase->description)>0) {
   9.331 -				SDLTest_Log("Test Description: '%s'", 
   9.332 -					(testCase->description) ? testCase->description : SDLTest_InvalidNameFormat);
   9.333 -			}
   9.334 -			
   9.335 -			// Loop over all iterations
   9.336 -			iterationCounter = 0;
   9.337 -			while(iterationCounter < testIterations)
   9.338 +			// Loop over all test cases
   9.339 +			testCounter = 0;
   9.340 +			while(testSuite->testCases[testCounter])
   9.341  			{
   9.342 -				iterationCounter++;
   9.343 +				testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
   9.344 +				currentTestName = (char *)((testCase->name) ? testCase->name : SDLTest_InvalidNameFormat);
   9.345 +				testCounter++;
   9.346  
   9.347 -				if (userExecKey != 0) {
   9.348 -					execKey = userExecKey;
   9.349 +				// Filter tests if flag set and we have a name
   9.350 +				if (testFilter == 1 && testFilterName != NULL && testCase->name != NULL &&
   9.351 +					SDL_strcmp(testFilterName, testCase->name) != 0) {
   9.352 +						// Skip test
   9.353 +						SDLTest_Log("===== Test Case %i.%i: '%s' skipped\n", 
   9.354 +							suiteCounter,
   9.355 +							testCounter,
   9.356 +							currentTestName);
   9.357  				} else {
   9.358 -					execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter);
   9.359 -				}
   9.360  
   9.361 -				SDLTest_Log("Test Iteration %i: execKey %llu", iterationCounter, execKey);
   9.362 -				testResult = SDLTest_RunTest(testSuite, testCase, execKey);
   9.363 +					// Take time - test start
   9.364 +					testStartSeconds = GetClock();
   9.365  
   9.366 -				if (testResult == TEST_RESULT_PASSED) {
   9.367 -					testPassedCount++;
   9.368 -					totalTestPassedCount++;
   9.369 -				} else if (testResult == TEST_RESULT_SKIPPED) {
   9.370 -					testSkippedCount++;
   9.371 -					totalTestSkippedCount++;
   9.372 -				} else {
   9.373 -					testFailedCount++;
   9.374 -					totalTestFailedCount++;
   9.375 +					// Log test started
   9.376 +					SDLTest_Log("----- Test Case %i.%i: '%s' started",
   9.377 +						suiteCounter,
   9.378 +						testCounter, 
   9.379 +						currentTestName);
   9.380 +					if (testCase->description != NULL && strlen(testCase->description)>0) {
   9.381 +						SDLTest_Log("Test Description: '%s'", 
   9.382 +							(testCase->description) ? testCase->description : SDLTest_InvalidNameFormat);
   9.383 +					}
   9.384 +
   9.385 +					// Loop over all iterations
   9.386 +					iterationCounter = 0;
   9.387 +					while(iterationCounter < testIterations)
   9.388 +					{
   9.389 +						iterationCounter++;
   9.390 +
   9.391 +						if (userExecKey != 0) {
   9.392 +							execKey = userExecKey;
   9.393 +						} else {
   9.394 +							execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter);
   9.395 +						}
   9.396 +
   9.397 +						SDLTest_Log("Test Iteration %i: execKey %llu", iterationCounter, execKey);
   9.398 +						testResult = SDLTest_RunTest(testSuite, testCase, execKey);
   9.399 +
   9.400 +						if (testResult == TEST_RESULT_PASSED) {
   9.401 +							testPassedCount++;
   9.402 +							totalTestPassedCount++;
   9.403 +						} else if (testResult == TEST_RESULT_SKIPPED) {
   9.404 +							testSkippedCount++;
   9.405 +							totalTestSkippedCount++;
   9.406 +						} else {
   9.407 +							testFailedCount++;
   9.408 +							totalTestFailedCount++;
   9.409 +						}
   9.410 +					}
   9.411 +
   9.412 +					// Take time - test end
   9.413 +					testEndSeconds = GetClock();
   9.414 +					runtime = testEndSeconds - testStartSeconds;
   9.415 +					if (runtime < 0.0f) runtime = 0.0f;
   9.416 +
   9.417 +					if (testIterations > 1) {
   9.418 +						// Log test runtime
   9.419 +						SDLTest_Log("Runtime of %i iterations: %.1f sec", testIterations, runtime);
   9.420 +						SDLTest_Log("Average Test runtime: %.5f sec", runtime / (float)testIterations);
   9.421 +					} else {
   9.422 +						// Log test runtime
   9.423 +						SDLTest_Log("Total Test runtime: %.1f sec", runtime);
   9.424 +					}
   9.425 +
   9.426 +					// Log final test result
   9.427 +					switch (testResult) {
   9.428 +					case TEST_RESULT_PASSED:
   9.429 +						SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Passed");
   9.430 +						break;
   9.431 +					case TEST_RESULT_FAILED:
   9.432 +						SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Failed");
   9.433 +						break;
   9.434 +					case TEST_RESULT_NO_ASSERT:
   9.435 +						SDLTest_LogError((char *)SDLTest_FinalResultFormat,"Test", currentTestName, "No Asserts");
   9.436 +						break;
   9.437 +					}
   9.438 +
   9.439  				}
   9.440  			}
   9.441  
   9.442 -			// Take time - test end
   9.443 -			testEndSeconds = GetClock();
   9.444 -			runtime = testEndSeconds - testStartSeconds;
   9.445 +			// Take time - suite end
   9.446 +			suiteEndSeconds = GetClock();
   9.447 +			runtime = suiteEndSeconds - suiteStartSeconds;
   9.448  			if (runtime < 0.0f) runtime = 0.0f;
   9.449  
   9.450 -			if (testIterations > 1) {
   9.451 -        			// Log test runtime
   9.452 -	        		SDLTest_Log("Runtime of %i iterations: %.1f sec", testIterations, runtime);
   9.453 -	        		SDLTest_Log("Test runtime: %.5f sec", runtime / (float)testIterations);
   9.454 -                        } else {
   9.455 -        			// Log test runtime
   9.456 -	        		SDLTest_Log("Test runtime: %.1f sec", runtime);
   9.457 -                        }
   9.458 +			// Log suite runtime
   9.459 +			SDLTest_Log("Total Suite runtime: %.1f sec", runtime);
   9.460  
   9.461 -			// Log final test result
   9.462 -			switch (testResult) {
   9.463 -				case TEST_RESULT_PASSED:
   9.464 -					SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Passed");
   9.465 -					break;
   9.466 -				case TEST_RESULT_FAILED:
   9.467 -					SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Failed");
   9.468 -					break;
   9.469 -				case TEST_RESULT_NO_ASSERT:
   9.470 -					SDLTest_LogError((char *)SDLTest_FinalResultFormat,"Test", currentTestName, "No Asserts");
   9.471 -					break;
   9.472 +			// Log summary and final Suite result
   9.473 +			countSum = testPassedCount + testFailedCount + testSkippedCount;
   9.474 +			if (testFailedCount == 0)
   9.475 +			{
   9.476 +				SDLTest_Log(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
   9.477 +				SDLTest_Log((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Passed");
   9.478 +			} 
   9.479 +			else 
   9.480 +			{
   9.481 +				SDLTest_LogError(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
   9.482 +				SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Failed");
   9.483  			}
   9.484 -		}
   9.485  
   9.486 -		// Take time - suite end
   9.487 -		suiteEndSeconds = GetClock();
   9.488 -		runtime = suiteEndSeconds - suiteStartSeconds;
   9.489 -		if (runtime < 0.0f) runtime = 0.0f;
   9.490 -
   9.491 -		// Log suite runtime
   9.492 -		SDLTest_Log("Suite runtime: %.1f sec", runtime);
   9.493 -
   9.494 -		// Log summary and final Suite result
   9.495 -		countSum = testPassedCount + testFailedCount + testSkippedCount;
   9.496 -		if (testFailedCount == 0)
   9.497 -		{
   9.498 -			SDLTest_Log(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
   9.499 -			SDLTest_Log((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Passed");
   9.500 -		} 
   9.501 -		else 
   9.502 -		{
   9.503 -			SDLTest_LogError(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
   9.504 -			SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Failed");
   9.505  		}
   9.506  	}
   9.507  
   9.508 @@ -505,11 +581,11 @@
   9.509  	if (runtime < 0.0f) runtime = 0.0f;
   9.510  
   9.511  	// Log total runtime
   9.512 -	SDLTest_Log("Total runtime: %.1f sec", runtime);
   9.513 +	SDLTest_Log("Total Run runtime: %.1f sec", runtime);
   9.514  
   9.515  	// Log summary and final run result
   9.516  	countSum = totalTestPassedCount + totalTestFailedCount + totalTestSkippedCount;
   9.517 -	if (testFailedCount == 0)
   9.518 +	if (totalTestFailedCount == 0)
   9.519  	{
   9.520  		runResult = 0;
   9.521  		SDLTest_Log(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
    10.1 --- a/src/test/SDL_test_imageBlit.c	Thu Dec 20 08:50:36 2012 -0800
    10.2 +++ b/src/test/SDL_test_imageBlit.c	Sat Dec 22 16:06:55 2012 -0800
    10.3 @@ -535,6 +535,32 @@
    10.4    "\0\0",
    10.5  };
    10.6  
    10.7 +/**
    10.8 + * \brief Returns the Blit test image as SDL_Surface.
    10.9 + */
   10.10 +SDL_Surface *SDLTest_ImageBlit()
   10.11 +{
   10.12 +   SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( 
   10.13 +        (void*)SDLTest_imageBlit.pixel_data,
   10.14 +        SDLTest_imageBlit.width, 
   10.15 +        SDLTest_imageBlit.height, 
   10.16 +        SDLTest_imageBlit.bytes_per_pixel * 8, 
   10.17 +        SDLTest_imageBlit.width * SDLTest_imageBlit.bytes_per_pixel,
   10.18 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
   10.19 +         0xff000000, /* Red bit mask. */
   10.20 +         0x00ff0000, /* Green bit mask. */
   10.21 +         0x0000ff00, /* Blue bit mask. */
   10.22 +         0x000000ff  /* Alpha bit mask. */
   10.23 +#else
   10.24 +         0x000000ff, /* Red bit mask. */
   10.25 +         0x0000ff00, /* Green bit mask. */
   10.26 +         0x00ff0000, /* Blue bit mask. */
   10.27 +         0xff000000  /* Alpha bit mask. */
   10.28 +#endif
   10.29 +         );
   10.30 +   return surface;
   10.31 +}
   10.32 +
   10.33  const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
   10.34    80, 60, 3,
   10.35    "\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"
   10.36 @@ -992,6 +1018,32 @@
   10.37    "\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",
   10.38  };
   10.39  
   10.40 +/**
   10.41 + * \brief Returns the BlitColor test image as SDL_Surface.
   10.42 + */
   10.43 +SDL_Surface *SDLTest_ImageBlitColor()
   10.44 +{
   10.45 +   SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( 
   10.46 +        (void*)SDLTest_imageBlitColor.pixel_data,
   10.47 +        SDLTest_imageBlitColor.width, 
   10.48 +        SDLTest_imageBlitColor.height, 
   10.49 +        SDLTest_imageBlitColor.bytes_per_pixel * 8, 
   10.50 +        SDLTest_imageBlitColor.width * SDLTest_imageBlitColor.bytes_per_pixel,
   10.51 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
   10.52 +         0xff000000, /* Red bit mask. */
   10.53 +         0x00ff0000, /* Green bit mask. */
   10.54 +         0x0000ff00, /* Blue bit mask. */
   10.55 +         0x000000ff  /* Alpha bit mask. */
   10.56 +#else
   10.57 +         0x000000ff, /* Red bit mask. */
   10.58 +         0x0000ff00, /* Green bit mask. */
   10.59 +         0x00ff0000, /* Blue bit mask. */
   10.60 +         0xff000000  /* Alpha bit mask. */
   10.61 +#endif
   10.62 +         );
   10.63 +   return surface;
   10.64 +}
   10.65 +
   10.66  const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
   10.67    80, 60, 3,
   10.68    "\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"
   10.69 @@ -1478,3 +1530,28 @@
   10.70    "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
   10.71  };
   10.72  
   10.73 +/**
   10.74 + * \brief Returns the BlitAlpha test image as SDL_Surface.
   10.75 + */
   10.76 +SDL_Surface *SDLTest_ImageBlitAlpha()
   10.77 +{
   10.78 +   SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( 
   10.79 +        (void*)SDLTest_imageBlitAlpha.pixel_data,
   10.80 +        SDLTest_imageBlitAlpha.width, 
   10.81 +        SDLTest_imageBlitAlpha.height, 
   10.82 +        SDLTest_imageBlitAlpha.bytes_per_pixel * 8,
   10.83 +        SDLTest_imageBlitAlpha.width * SDLTest_imageBlitAlpha.bytes_per_pixel,
   10.84 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
   10.85 +         0xff000000, /* Red bit mask. */
   10.86 +         0x00ff0000, /* Green bit mask. */
   10.87 +         0x0000ff00, /* Blue bit mask. */
   10.88 +         0x000000ff  /* Alpha bit mask. */
   10.89 +#else
   10.90 +         0x000000ff, /* Red bit mask. */
   10.91 +         0x0000ff00, /* Green bit mask. */
   10.92 +         0x00ff0000, /* Blue bit mask. */
   10.93 +         0xff000000  /* Alpha bit mask. */
   10.94 +#endif
   10.95 +         );
   10.96 +   return surface;
   10.97 +}
    11.1 --- a/src/test/SDL_test_imageBlitBlend.c	Thu Dec 20 08:50:36 2012 -0800
    11.2 +++ b/src/test/SDL_test_imageBlitBlend.c	Sat Dec 22 16:06:55 2012 -0800
    11.3 @@ -575,6 +575,32 @@
    11.4    "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
    11.5  };
    11.6  
    11.7 +/**
    11.8 + * \brief Returns the BlitBlendAdd test image as SDL_Surface.
    11.9 + */
   11.10 +SDL_Surface *SDLTest_ImageBlitBlendAdd()
   11.11 +{
   11.12 +   SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( 
   11.13 +        (void*)SDLTest_imageBlitBlendAdd.pixel_data,
   11.14 +        SDLTest_imageBlitBlendAdd.width, 
   11.15 +        SDLTest_imageBlitBlendAdd.height, 
   11.16 +        SDLTest_imageBlitBlendAdd.bytes_per_pixel * 8, 
   11.17 +        SDLTest_imageBlitBlendAdd.width * SDLTest_imageBlitBlendAdd.bytes_per_pixel,
   11.18 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
   11.19 +         0xff000000, /* Red bit mask. */
   11.20 +         0x00ff0000, /* Green bit mask. */
   11.21 +         0x0000ff00, /* Blue bit mask. */
   11.22 +         0x000000ff  /* Alpha bit mask. */
   11.23 +#else
   11.24 +         0x000000ff, /* Red bit mask. */
   11.25 +         0x0000ff00, /* Green bit mask. */
   11.26 +         0x00ff0000, /* Blue bit mask. */
   11.27 +         0xff000000  /* Alpha bit mask. */
   11.28 +#endif
   11.29 +         );
   11.30 +   return surface;
   11.31 +}
   11.32 +
   11.33  const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
   11.34    80, 60, 3,
   11.35    "\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"
   11.36 @@ -1079,6 +1105,32 @@
   11.37    "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
   11.38  };
   11.39  
   11.40 +/**
   11.41 + * \brief Returns the BlitBlend test image as SDL_Surface.
   11.42 + */
   11.43 +SDL_Surface *SDLTest_ImageBlitBlend()
   11.44 +{
   11.45 +   SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( 
   11.46 +        (void*)SDLTest_imageBlitBlend.pixel_data,
   11.47 +        SDLTest_imageBlitBlend.width, 
   11.48 +        SDLTest_imageBlitBlend.height, 
   11.49 +        SDLTest_imageBlitBlend.bytes_per_pixel * 8, 
   11.50 +        SDLTest_imageBlitBlend.width * SDLTest_imageBlitBlend.bytes_per_pixel,
   11.51 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
   11.52 +         0xff000000, /* Red bit mask. */
   11.53 +         0x00ff0000, /* Green bit mask. */
   11.54 +         0x0000ff00, /* Blue bit mask. */
   11.55 +         0x000000ff  /* Alpha bit mask. */
   11.56 +#else
   11.57 +         0x000000ff, /* Red bit mask. */
   11.58 +         0x0000ff00, /* Green bit mask. */
   11.59 +         0x00ff0000, /* Blue bit mask. */
   11.60 +         0xff000000  /* Alpha bit mask. */
   11.61 +#endif
   11.62 +         );
   11.63 +   return surface;
   11.64 +}
   11.65 +
   11.66  const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
   11.67    80, 60, 3,
   11.68    "\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"
   11.69 @@ -1483,6 +1535,32 @@
   11.70    "\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",
   11.71  };
   11.72  
   11.73 +/**
   11.74 + * \brief Returns the BlitBlendMod test image as SDL_Surface.
   11.75 + */
   11.76 +SDL_Surface *SDLTest_ImageBlitBlendMod()
   11.77 +{
   11.78 +   SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( 
   11.79 +        (void*)SDLTest_imageBlitBlendMod.pixel_data,
   11.80 +        SDLTest_imageBlitBlendMod.width, 
   11.81 +        SDLTest_imageBlitBlendMod.height, 
   11.82 +        SDLTest_imageBlitBlendMod.bytes_per_pixel * 8, 
   11.83 +        SDLTest_imageBlitBlendMod.width * SDLTest_imageBlitBlendMod.bytes_per_pixel,
   11.84 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
   11.85 +         0xff000000, /* Red bit mask. */
   11.86 +         0x00ff0000, /* Green bit mask. */
   11.87 +         0x0000ff00, /* Blue bit mask. */
   11.88 +         0x000000ff  /* Alpha bit mask. */
   11.89 +#else
   11.90 +         0x000000ff, /* Red bit mask. */
   11.91 +         0x0000ff00, /* Green bit mask. */
   11.92 +         0x00ff0000, /* Blue bit mask. */
   11.93 +         0xff000000  /* Alpha bit mask. */
   11.94 +#endif
   11.95 +         );
   11.96 +   return surface;
   11.97 +}
   11.98 +
   11.99  const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
  11.100    80, 60, 3,
  11.101    "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
  11.102 @@ -2270,6 +2348,32 @@
  11.103    "\377\377\377\377\377\377\377\377",
  11.104  };
  11.105  
  11.106 +/**
  11.107 + * \brief Returns the BlitBlendNone test image as SDL_Surface.
  11.108 + */
  11.109 +SDL_Surface *SDLTest_ImageBlitBlendNone()
  11.110 +{
  11.111 +   SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( 
  11.112 +        (void*)SDLTest_imageBlitBlendNone.pixel_data,
  11.113 +        SDLTest_imageBlitBlendNone.width, 
  11.114 +        SDLTest_imageBlitBlendNone.height, 
  11.115 +        SDLTest_imageBlitBlendNone.bytes_per_pixel * 8, 
  11.116 +        SDLTest_imageBlitBlendNone.width * SDLTest_imageBlitBlendNone.bytes_per_pixel,
  11.117 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
  11.118 +         0xff000000, /* Red bit mask. */
  11.119 +         0x00ff0000, /* Green bit mask. */
  11.120 +         0x0000ff00, /* Blue bit mask. */
  11.121 +         0x000000ff  /* Alpha bit mask. */
  11.122 +#else
  11.123 +         0x000000ff, /* Red bit mask. */
  11.124 +         0x0000ff00, /* Green bit mask. */
  11.125 +         0x00ff0000, /* Blue bit mask. */
  11.126 +         0xff000000  /* Alpha bit mask. */
  11.127 +#endif
  11.128 +         );
  11.129 +   return surface;
  11.130 +}
  11.131 +
  11.132  const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
  11.133    80, 60, 3,
  11.134    "\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"
  11.135 @@ -2712,3 +2816,28 @@
  11.136    "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
  11.137  };
  11.138  
  11.139 +/**
  11.140 + * \brief Returns the BlitBlendAll test image as SDL_Surface.
  11.141 + */
  11.142 +SDL_Surface *SDLTest_ImageBlitBlendAll()
  11.143 +{
  11.144 +   SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( 
  11.145 +        (void*)SDLTest_imageBlitBlendAll.pixel_data,
  11.146 +        SDLTest_imageBlitBlendAll.width, 
  11.147 +        SDLTest_imageBlitBlendAll.height, 
  11.148 +        SDLTest_imageBlitBlendAll.bytes_per_pixel * 8, 
  11.149 +        SDLTest_imageBlitBlendAll.width * SDLTest_imageBlitBlendAll.bytes_per_pixel,
  11.150 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
  11.151 +         0xff000000, /* Red bit mask. */
  11.152 +         0x00ff0000, /* Green bit mask. */
  11.153 +         0x0000ff00, /* Blue bit mask. */
  11.154 +         0x000000ff  /* Alpha bit mask. */
  11.155 +#else
  11.156 +         0x000000ff, /* Red bit mask. */
  11.157 +         0x0000ff00, /* Green bit mask. */
  11.158 +         0x00ff0000, /* Blue bit mask. */
  11.159 +         0xff000000  /* Alpha bit mask. */
  11.160 +#endif
  11.161 +         );
  11.162 +   return surface;
  11.163 +}
    12.1 --- a/src/test/SDL_test_imageFace.c	Thu Dec 20 08:50:36 2012 -0800
    12.2 +++ b/src/test/SDL_test_imageFace.c	Sat Dec 22 16:06:55 2012 -0800
    12.3 @@ -24,7 +24,7 @@
    12.4  
    12.5  /* GIMP RGBA C-Source image dump (face.c) */
    12.6  
    12.7 -const SDLTest_SurfaceImage_t SDLTest_ImageFace = {
    12.8 +const SDLTest_SurfaceImage_t SDLTest_imageFace = {
    12.9    32, 32, 4,
   12.10    "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
   12.11    "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
   12.12 @@ -218,3 +218,29 @@
   12.13    "\377\377\0\377\377\377\0",
   12.14  };
   12.15  
   12.16 +/**
   12.17 + * \brief Returns the Face test image as SDL_Surface.
   12.18 + */
   12.19 +SDL_Surface *SDLTest_ImageFace()
   12.20 +{
   12.21 +   SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( 
   12.22 +        (void*)SDLTest_imageFace.pixel_data,
   12.23 +        SDLTest_imageFace.width, 
   12.24 +        SDLTest_imageFace.height, 
   12.25 +        SDLTest_imageFace.bytes_per_pixel * 8, 
   12.26 +        SDLTest_imageFace.width * SDLTest_imageFace.bytes_per_pixel,
   12.27 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
   12.28 +         0xff000000, /* Red bit mask. */
   12.29 +         0x00ff0000, /* Green bit mask. */
   12.30 +         0x0000ff00, /* Blue bit mask. */
   12.31 +         0x000000ff  /* Alpha bit mask. */
   12.32 +#else
   12.33 +         0x000000ff, /* Red bit mask. */
   12.34 +         0x0000ff00, /* Green bit mask. */
   12.35 +         0x00ff0000, /* Blue bit mask. */
   12.36 +         0xff000000  /* Alpha bit mask. */
   12.37 +#endif
   12.38 +         );
   12.39 +   return surface;
   12.40 +}
   12.41 +
    13.1 --- a/src/test/SDL_test_imagePrimitives.c	Thu Dec 20 08:50:36 2012 -0800
    13.2 +++ b/src/test/SDL_test_imagePrimitives.c	Sat Dec 22 16:06:55 2012 -0800
    13.3 @@ -485,3 +485,28 @@
    13.4    "\310\15I\310\15I\310\15I\310\15I\310\5ii",
    13.5  };
    13.6  
    13.7 +/**
    13.8 + * \brief Returns the Primitives test image as SDL_Surface.
    13.9 + */
   13.10 +SDL_Surface *SDLTest_ImagePrimitives()
   13.11 +{
   13.12 +   SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( 
   13.13 +        (void*)SDLTest_imagePrimitives.pixel_data,
   13.14 +        SDLTest_imagePrimitives.width, 
   13.15 +        SDLTest_imagePrimitives.height,
   13.16 +        SDLTest_imagePrimitives.bytes_per_pixel * 8, 
   13.17 +        SDLTest_imagePrimitives.width * SDLTest_imagePrimitives.bytes_per_pixel,
   13.18 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
   13.19 +         0xff000000, /* Red bit mask. */
   13.20 +         0x00ff0000, /* Green bit mask. */
   13.21 +         0x0000ff00, /* Blue bit mask. */
   13.22 +         0x000000ff  /* Alpha bit mask. */
   13.23 +#else
   13.24 +         0x000000ff, /* Red bit mask. */
   13.25 +         0x0000ff00, /* Green bit mask. */
   13.26 +         0x00ff0000, /* Blue bit mask. */
   13.27 +         0xff000000  /* Alpha bit mask. */
   13.28 +#endif
   13.29 +         );
   13.30 +   return surface;
   13.31 +}
    14.1 --- a/src/test/SDL_test_imagePrimitivesBlend.c	Thu Dec 20 08:50:36 2012 -0800
    14.2 +++ b/src/test/SDL_test_imagePrimitivesBlend.c	Sat Dec 22 16:06:55 2012 -0800
    14.3 @@ -667,3 +667,28 @@
    14.4    "\377\377\377\377\377\377\377\377\324X2\377\377\377\333bB\377\377\377",
    14.5  };
    14.6  
    14.7 +/**
    14.8 + * \brief Returns the PrimitivesBlend test image as SDL_Surface.
    14.9 + */
   14.10 +SDL_Surface *SDLTest_ImagePrimitivesBlend()
   14.11 +{
   14.12 +   SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( 
   14.13 +        (void*)SDLTest_imagePrimitivesBlend.pixel_data,
   14.14 +        SDLTest_imagePrimitivesBlend.width, 
   14.15 +        SDLTest_imagePrimitivesBlend.height, 
   14.16 +        SDLTest_imagePrimitivesBlend.bytes_per_pixel * 8, 
   14.17 +        SDLTest_imagePrimitivesBlend.width * SDLTest_imagePrimitivesBlend.bytes_per_pixel,
   14.18 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
   14.19 +         0xff000000, /* Red bit mask. */
   14.20 +         0x00ff0000, /* Green bit mask. */
   14.21 +         0x0000ff00, /* Blue bit mask. */
   14.22 +         0x000000ff  /* Alpha bit mask. */
   14.23 +#else
   14.24 +         0x000000ff, /* Red bit mask. */
   14.25 +         0x0000ff00, /* Green bit mask. */
   14.26 +         0x00ff0000, /* Blue bit mask. */
   14.27 +         0xff000000  /* Alpha bit mask. */
   14.28 +#endif
   14.29 +         );
   14.30 +   return surface;
   14.31 +}
    15.1 --- a/test/testautomation.c	Thu Dec 20 08:50:36 2012 -0800
    15.2 +++ b/test/testautomation.c	Sat Dec 22 16:06:55 2012 -0800
    15.3 @@ -37,6 +37,7 @@
    15.4      int testIterations = 1;
    15.5      Uint64 userExecKey = 0;
    15.6      char *userRunSeed = NULL;
    15.7 +    char *filter = NULL;
    15.8      int i;
    15.9  
   15.10      /* Initialize test framework */
   15.11 @@ -74,6 +75,12 @@
   15.12                      consumed = 2;
   15.13                  }
   15.14              } 
   15.15 +            else if (SDL_strcasecmp(argv[i], "--filter") == 0) {
   15.16 +                if (argv[i + 1]) {
   15.17 +                    filter = SDL_strdup(argv[i + 1]);
   15.18 +                    consumed = 2;
   15.19 +                }
   15.20 +            } 
   15.21          }
   15.22          if (consumed < 0) {
   15.23              fprintf(stderr,
   15.24 @@ -98,12 +105,15 @@
   15.25      }
   15.26  
   15.27      /* Call Harness */
   15.28 -    result = SDLTest_RunSuites(testSuites, userRunSeed, userExecKey, testIterations);
   15.29 +    result = SDLTest_RunSuites(testSuites, userRunSeed, userExecKey, filter, testIterations);
   15.30  
   15.31      /* Clean up */
   15.32      if (userRunSeed != NULL) {
   15.33          SDL_free(userRunSeed);
   15.34      }
   15.35 +    if (filter != NULL) {
   15.36 +        SDL_free(filter);
   15.37 +    }
   15.38          
   15.39      /* Shutdown everything */
   15.40      quit(result);        
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/test/tests/testrender.c	Sat Dec 22 16:06:55 2012 -0800
    16.3 @@ -0,0 +1,1025 @@
    16.4 +/**
    16.5 + * Original code: automated SDL platform test written by Edgar Simo "bobbens"
    16.6 + * Extended and extensively updated by aschiffler at ferzkopp dot net
    16.7 + */
    16.8 +
    16.9 +#include <stdio.h>
   16.10 +
   16.11 +#include "SDL.h"
   16.12 +#include "SDL_test.h"
   16.13 +
   16.14 +/* ================= Test Case Implementation ================== */
   16.15 +
   16.16 +#define TESTRENDER_SCREEN_W     80
   16.17 +#define TESTRENDER_SCREEN_H     60
   16.18 +
   16.19 +#define RENDER_COMPARE_FORMAT  SDL_PIXELFORMAT_ARGB8888
   16.20 +#define RENDER_COMPARE_AMASK   0xff000000 /**< Alpha bit mask. */
   16.21 +#define RENDER_COMPARE_RMASK   0x00ff0000 /**< Red bit mask. */
   16.22 +#define RENDER_COMPARE_GMASK   0x0000ff00 /**< Green bit mask. */
   16.23 +#define RENDER_COMPARE_BMASK   0x000000ff /**< Blue bit mask. */
   16.24 +
   16.25 +#define ALLOWABLE_ERROR_OPAQUE	0
   16.26 +#define ALLOWABLE_ERROR_BLENDED	64
   16.27 +
   16.28 +SDL_Window *window = NULL;
   16.29 +SDL_Renderer *renderer = NULL;
   16.30 +
   16.31 +/* Prototypes for helper functions */
   16.32 +
   16.33 +static int _clearScreen (void);
   16.34 +static void _compare(const char *msg, SDL_Surface *s, int allowable_error);
   16.35 +static int _hasTexAlpha(void);
   16.36 +static int _hasTexColor(void);
   16.37 +static SDL_Texture *_loadTestFace(void);
   16.38 +static int _hasBlendModes(void);
   16.39 +static int _hasDrawColor(void);
   16.40 +static int _isSupported(int code);
   16.41 +
   16.42 +/**
   16.43 + * Create software renderer for tests
   16.44 + */
   16.45 +void InitCreateRenderer(void *arg)
   16.46 +{
   16.47 +  int posX = 100, posY = 100, width = 320, height = 240;
   16.48 +  renderer = NULL;
   16.49 +  window = SDL_CreateWindow("render_testCreateRenderer", posX, posY, width, height, 0);
   16.50 +  SDLTest_AssertPass("SDL_CreateWindow()");
   16.51 +  SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result");
   16.52 +  if (window == NULL) {
   16.53 +      return;
   16.54 +  }
   16.55 +  
   16.56 +  renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
   16.57 +  SDLTest_AssertPass("SDL_CreateRenderer()");
   16.58 +  SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result");
   16.59 +  if (renderer == 0) {
   16.60 +      SDL_DestroyWindow(window);
   16.61 +      return;
   16.62 +  }
   16.63 +}
   16.64 +
   16.65 +/*
   16.66 + * Destroy renderer for tests  
   16.67 + */
   16.68 +void CleanupDestroyRenderer(void *arg)
   16.69 +{
   16.70 +  if (renderer != NULL) {  
   16.71 +     SDL_DestroyRenderer(renderer);
   16.72 +     SDLTest_AssertPass("SDL_DestroyRenderer()");
   16.73 +  }
   16.74 +  
   16.75 +  if (window != NULL) {  
   16.76 +     SDL_DestroyWindow(window);
   16.77 +     SDLTest_AssertPass("SDL_DestroyWindow");
   16.78 +  }
   16.79 +}
   16.80 +
   16.81 +
   16.82 +/**
   16.83 + * @brief Tests call to SDL_GetNumRenderDrivers
   16.84 + *
   16.85 + * \sa
   16.86 + * http://wiki.libsdl.org/moin.cgi/SDL_GetNumRenderDrivers
   16.87 + */
   16.88 +int
   16.89 +render_testGetNumRenderDrivers(void *arg)
   16.90 +{
   16.91 +  int n;
   16.92 +  n = SDL_GetNumRenderDrivers();
   16.93 +  SDLTest_AssertCheck(n >= 1, "Number of renderers >= 1, reported as %i", n);
   16.94 +  return TEST_COMPLETED;
   16.95 +}
   16.96 +
   16.97 +
   16.98 +/**
   16.99 + * @brief Tests the SDL primitives for rendering.
  16.100 + *
  16.101 + * \sa
  16.102 + * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
  16.103 + * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
  16.104 + * http://wiki.libsdl.org/moin.cgi/SDL_RenderDrawLine
  16.105 + *
  16.106 + */
  16.107 +int render_testPrimitives (void *arg)
  16.108 +{
  16.109 +   int ret;
  16.110 +   int x, y;
  16.111 +   SDL_Rect rect;
  16.112 +   int checkFailCount1;
  16.113 +   int checkFailCount2;
  16.114 +
  16.115 +   /* Need drawcolour or just skip test. */
  16.116 +   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
  16.117 +
  16.118 +   /* Draw a rectangle. */
  16.119 +   rect.x = 40;
  16.120 +   rect.y = 0;
  16.121 +   rect.w = 40;
  16.122 +   rect.h = 80;
  16.123 +
  16.124 +   ret = SDL_SetRenderDrawColor(renderer, 13, 73, 200, SDL_ALPHA_OPAQUE );
  16.125 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  16.126 +
  16.127 +   ret = SDL_RenderFillRect(renderer, &rect );
  16.128 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  16.129 +
  16.130 +   /* Draw a rectangle. */
  16.131 +   rect.x = 10;
  16.132 +   rect.y = 10;
  16.133 +   rect.w = 60;
  16.134 +   rect.h = 40;
  16.135 +   ret = SDL_SetRenderDrawColor(renderer, 200, 0, 100, SDL_ALPHA_OPAQUE );
  16.136 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  16.137 +
  16.138 +   ret = SDL_RenderFillRect(renderer, &rect );
  16.139 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  16.140 +
  16.141 +   /* Draw some points like so:
  16.142 +    * X.X.X.X..
  16.143 +    * .X.X.X.X.
  16.144 +    * X.X.X.X.. */
  16.145 +   checkFailCount1 = 0;
  16.146 +   checkFailCount2 = 0;
  16.147 +   for (y=0; y<3; y++) {
  16.148 +      for (x = y % 2; x<TESTRENDER_SCREEN_W; x+=2) {
  16.149 +         ret = SDL_SetRenderDrawColor(renderer, x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE );
  16.150 +         if (ret != 0) checkFailCount1++;
  16.151 +
  16.152 +         ret = SDL_RenderDrawPoint(renderer, x, y );
  16.153 +         if (ret != 0) checkFailCount2++;
  16.154 +      }
  16.155 +   }
  16.156 +   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
  16.157 +   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount2);
  16.158 +
  16.159 +   /* Draw some lines. */
  16.160 +   ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE );
  16.161 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor");
  16.162 +
  16.163 +   ret = SDL_RenderDrawLine(renderer, 0, 30, TESTRENDER_SCREEN_W, 30 );
  16.164 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  16.165 +
  16.166 +   ret = SDL_SetRenderDrawColor(renderer, 55, 55, 5, SDL_ALPHA_OPAQUE );
  16.167 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  16.168 +
  16.169 +   ret = SDL_RenderDrawLine(renderer, 40, 30, 40, 60 );
  16.170 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  16.171 +
  16.172 +   ret = SDL_SetRenderDrawColor(renderer, 5, 105, 105, SDL_ALPHA_OPAQUE );
  16.173 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  16.174 +
  16.175 +   ret = SDL_RenderDrawLine(renderer, 0, 0, 29, 29 );
  16.176 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  16.177 +
  16.178 +   ret = SDL_RenderDrawLine(renderer, 29, 30, 0, 59 );
  16.179 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  16.180 +
  16.181 +   ret = SDL_RenderDrawLine(renderer, 79, 0, 50, 29 );
  16.182 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  16.183 +
  16.184 +   ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
  16.185 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  16.186 +
  16.187 +   /* See if it's the same. */
  16.188 +   _compare( "Primitives output not the same.", SDLTest_ImagePrimitives(), ALLOWABLE_ERROR_OPAQUE );
  16.189 +
  16.190 +   return TEST_COMPLETED;
  16.191 +}
  16.192 +
  16.193 +/**
  16.194 + * @brief Tests the SDL primitives with alpha for rendering.
  16.195 + *
  16.196 + * \sa
  16.197 + * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
  16.198 + * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
  16.199 + * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
  16.200 + */
  16.201 +int render_testPrimitivesBlend (void *arg)
  16.202 +{
  16.203 +   int ret;
  16.204 +   int i, j;
  16.205 +   SDL_Rect rect;
  16.206 +   int checkFailCount1;
  16.207 +   int checkFailCount2;
  16.208 +   int checkFailCount3;
  16.209 +
  16.210 +   /* Need drawcolour and blendmode or just skip test. */
  16.211 +   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
  16.212 +   SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
  16.213 +
  16.214 +   /* Create some rectangles for each blend mode. */
  16.215 +   ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0 );
  16.216 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  16.217 +
  16.218 +   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
  16.219 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
  16.220 +
  16.221 +   ret = SDL_RenderFillRect(renderer, NULL );
  16.222 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  16.223 +
  16.224 +   rect.x = 10;
  16.225 +   rect.y = 25;
  16.226 +   rect.w = 40;
  16.227 +   rect.h = 25;
  16.228 +   ret = SDL_SetRenderDrawColor(renderer, 240, 10, 10, 75 );
  16.229 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  16.230 +
  16.231 +   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
  16.232 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
  16.233 +
  16.234 +   ret = SDL_RenderFillRect(renderer, &rect );
  16.235 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  16.236 +
  16.237 +   rect.x = 30;
  16.238 +   rect.y = 40;
  16.239 +   rect.w = 45;
  16.240 +   rect.h = 15;
  16.241 +   ret = SDL_SetRenderDrawColor(renderer, 10, 240, 10, 100 );
  16.242 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  16.243 +
  16.244 +   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
  16.245 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
  16.246 +
  16.247 +   ret = SDL_RenderFillRect(renderer, &rect );
  16.248 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  16.249 +
  16.250 +   rect.x = 25;
  16.251 +   rect.y = 25;
  16.252 +   rect.w = 25;
  16.253 +   rect.h = 25;
  16.254 +   ret = SDL_SetRenderDrawColor(renderer, 10, 10, 240, 125 );
  16.255 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  16.256 +
  16.257 +   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
  16.258 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
  16.259 +
  16.260 +   ret = SDL_RenderFillRect(renderer, &rect );
  16.261 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  16.262 +
  16.263 +
  16.264 +   /* Draw blended lines, lines for everyone. */
  16.265 +   checkFailCount1 = 0;
  16.266 +   checkFailCount2 = 0;
  16.267 +   checkFailCount3 = 0;
  16.268 +   for (i=0; i<TESTRENDER_SCREEN_W; i+=2)  {
  16.269 +      ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
  16.270 +      if (ret != 0) checkFailCount1++;
  16.271 +
  16.272 +      ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
  16.273 +            (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
  16.274 +      if (ret != 0) checkFailCount2++;
  16.275 +
  16.276 +      ret = SDL_RenderDrawLine(renderer, 0, 0, i, 59 );
  16.277 +      if (ret != 0) checkFailCount3++;
  16.278 +   }
  16.279 +   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
  16.280 +   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
  16.281 +   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
  16.282 +   
  16.283 +   checkFailCount1 = 0;
  16.284 +   checkFailCount2 = 0;
  16.285 +   checkFailCount3 = 0;
  16.286 +   for (i=0; i<TESTRENDER_SCREEN_H; i+=2)  {
  16.287 +      ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
  16.288 +      if (ret != 0) checkFailCount1++;
  16.289 +
  16.290 +      ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
  16.291 +            (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
  16.292 +      if (ret != 0) checkFailCount2++;
  16.293 +
  16.294 +      ret = SDL_RenderDrawLine(renderer, 0, 0, 79, i );
  16.295 +      if (ret != 0) checkFailCount3++;
  16.296 +   }
  16.297 +   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
  16.298 +   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
  16.299 +   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
  16.300 +
  16.301 +   /* Draw points. */
  16.302 +   checkFailCount1 = 0;
  16.303 +   checkFailCount2 = 0;
  16.304 +   checkFailCount3 = 0;
  16.305 +   for (j=0; j<TESTRENDER_SCREEN_H; j+=3) {
  16.306 +      for (i=0; i<TESTRENDER_SCREEN_W; i+=3) {
  16.307 +         ret = SDL_SetRenderDrawColor(renderer, j*4, i*3, j*4, i*3 );
  16.308 +         if (ret != 0) checkFailCount1++;
  16.309 +
  16.310 +         ret = SDL_SetRenderDrawBlendMode(renderer, ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
  16.311 +               ((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
  16.312 +         if (ret != 0) checkFailCount2++;
  16.313 +
  16.314 +         ret = SDL_RenderDrawPoint(renderer, i, j );
  16.315 +         if (ret != 0) checkFailCount3++;
  16.316 +      }
  16.317 +   }   
  16.318 +   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
  16.319 +   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
  16.320 +   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
  16.321 +
  16.322 +   /* See if it's the same. */
  16.323 +   _compare( "Blended primitives output not the same.", SDLTest_ImagePrimitivesBlend(), ALLOWABLE_ERROR_BLENDED );
  16.324 +
  16.325 +    return TEST_COMPLETED;
  16.326 +}
  16.327 +
  16.328 +
  16.329 +
  16.330 +/**
  16.331 + * @brief Tests some blitting routines.
  16.332 + *
  16.333 + * \sa
  16.334 + * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
  16.335 + * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  16.336 + */
  16.337 +int
  16.338 +render_testBlit(void *arg)
  16.339 +{
  16.340 +   int ret;
  16.341 +   SDL_Rect rect;
  16.342 +   SDL_Texture *tface;
  16.343 +   Uint32 tformat;
  16.344 +   int taccess, tw, th;
  16.345 +   int i, j, ni, nj;
  16.346 +   int checkFailCount1;
  16.347 +
  16.348 +
  16.349 +   /* Need drawcolour or just skip test. */
  16.350 +   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor)");
  16.351 +
  16.352 +   /* Create face surface. */
  16.353 +   tface = _loadTestFace();
  16.354 +   SDLTest_AssertCheck(tface != NULL,  "Verify _loadTestFace() result");
  16.355 +   if (tface == NULL) {
  16.356 +       return TEST_ABORTED;
  16.357 +   }
  16.358 +
  16.359 +   /* Constant values. */
  16.360 +   ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
  16.361 +   SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
  16.362 +   rect.w = tw;
  16.363 +   rect.h = th;
  16.364 +   ni     = TESTRENDER_SCREEN_W - tw;
  16.365 +   nj     = TESTRENDER_SCREEN_H - th;
  16.366 +
  16.367 +   /* Loop blit. */
  16.368 +   checkFailCount1 = 0;
  16.369 +   for (j=0; j <= nj; j+=4) {
  16.370 +      for (i=0; i <= ni; i+=4) {
  16.371 +         /* Blitting. */
  16.372 +         rect.x = i;
  16.373 +         rect.y = j;
  16.374 +         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
  16.375 +         if (ret != 0) checkFailCount1++;
  16.376 +      }
  16.377 +   }
  16.378 +   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
  16.379 +
  16.380 +   /* Clean up. */
  16.381 +   SDL_DestroyTexture( tface );
  16.382 +
  16.383 +   /* See if it's the same */
  16.384 +   _compare( "Blit output not the same.", SDLTest_ImageBlit(), ALLOWABLE_ERROR_OPAQUE );
  16.385 +
  16.386 +   return TEST_COMPLETED;
  16.387 +}
  16.388 +
  16.389 +
  16.390 +/**
  16.391 + * @brief Blits doing colour tests.
  16.392 + *
  16.393 + * \sa
  16.394 + * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
  16.395 + * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
  16.396 + * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  16.397 + */
  16.398 +int
  16.399 +render_testBlitColor (void *arg)
  16.400 +{
  16.401 +   int ret;
  16.402 +   SDL_Rect rect;
  16.403 +   SDL_Texture *tface;
  16.404 +   Uint32 tformat;
  16.405 +   int taccess, tw, th;
  16.406 +   int i, j, ni, nj;
  16.407 +   int checkFailCount1;
  16.408 +   int checkFailCount2;
  16.409 +
  16.410 +   /* Create face surface. */
  16.411 +   tface = _loadTestFace();
  16.412 +   SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
  16.413 +   if (tface == NULL) {
  16.414 +       return TEST_ABORTED;
  16.415 +   }
  16.416 +
  16.417 +   /* Constant values. */
  16.418 +   ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
  16.419 +   SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
  16.420 +   rect.w = tw;
  16.421 +   rect.h = th;
  16.422 +   ni     = TESTRENDER_SCREEN_W - tw;
  16.423 +   nj     = TESTRENDER_SCREEN_H - th;
  16.424 +
  16.425 +   /* Test blitting with colour mod. */
  16.426 +   checkFailCount1 = 0;
  16.427 +   checkFailCount2 = 0;
  16.428 +   for (j=0; j <= nj; j+=4) {
  16.429 +      for (i=0; i <= ni; i+=4) {
  16.430 +         /* Set colour mod. */
  16.431 +         ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
  16.432 +         if (ret != 0) checkFailCount1++;
  16.433 +
  16.434 +         /* Blitting. */
  16.435 +         rect.x = i;
  16.436 +         rect.y = j;
  16.437 +         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
  16.438 +         if (ret != 0) checkFailCount2++;
  16.439 +      }
  16.440 +   }
  16.441 +   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
  16.442 +   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
  16.443 +
  16.444 +   /* Clean up. */
  16.445 +   SDL_DestroyTexture( tface );
  16.446 +
  16.447 +   /* See if it's the same. */
  16.448 +   _compare( "Blit output not the same (using SDL_SetTextureColorMod).",
  16.449 +            SDLTest_ImageBlitColor(), ALLOWABLE_ERROR_OPAQUE );
  16.450 +
  16.451 +   return TEST_COMPLETED;
  16.452 +}
  16.453 +
  16.454 +
  16.455 +/**
  16.456 + * @brief Tests blitting with alpha.
  16.457 + *
  16.458 + * \sa
  16.459 + * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
  16.460 + * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
  16.461 + * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  16.462 + */
  16.463 +int
  16.464 +render_testBlitAlpha (void *arg)
  16.465 +{
  16.466 +   int ret;
  16.467 +   SDL_Rect rect;
  16.468 +   SDL_Texture *tface;
  16.469 +   Uint32 tformat;
  16.470 +   int taccess, tw, th;
  16.471 +   int i, j, ni, nj;
  16.472 +   int checkFailCount1;
  16.473 +   int checkFailCount2;
  16.474 +
  16.475 +
  16.476 +   /* Need alpha or just skip test. */
  16.477 +   SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
  16.478 +
  16.479 +   /* Create face surface. */
  16.480 +   tface = _loadTestFace();
  16.481 +   SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
  16.482 +   if (tface == NULL) {
  16.483 +       return TEST_ABORTED;
  16.484 +   }
  16.485 +
  16.486 +   /* Constant values. */
  16.487 +   ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
  16.488 +   SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
  16.489 +   rect.w = tw;
  16.490 +   rect.h = th;
  16.491 +   ni     = TESTRENDER_SCREEN_W - tw;
  16.492 +   nj     = TESTRENDER_SCREEN_H - th;
  16.493 +
  16.494 +   /* Test blitting with alpha mod. */
  16.495 +   checkFailCount1 = 0;
  16.496 +   checkFailCount2 = 0;
  16.497 +   for (j=0; j <= nj; j+=4) {
  16.498 +      for (i=0; i <= ni; i+=4) {
  16.499 +         /* Set alpha mod. */
  16.500 +         ret = SDL_SetTextureAlphaMod( tface, (255/ni)*i );
  16.501 +         if (ret != 0) checkFailCount1++;
  16.502 +
  16.503 +         /* Blitting. */
  16.504 +         rect.x = i;
  16.505 +         rect.y = j;
  16.506 +         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
  16.507 +         if (ret != 0) checkFailCount2++;
  16.508 +      }
  16.509 +   }   
  16.510 +   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
  16.511 +   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
  16.512 +
  16.513 +   /* Clean up. */
  16.514 +   SDL_DestroyTexture( tface );
  16.515 +
  16.516 +   /* See if it's the same. */
  16.517 +   _compare( "Blit output not the same (using SDL_SetSurfaceAlphaMod).",
  16.518 +            SDLTest_ImageBlitAlpha(), ALLOWABLE_ERROR_BLENDED );
  16.519 +
  16.520 +   return TEST_COMPLETED;
  16.521 +}
  16.522 +
  16.523 +/* Helper functions */
  16.524 +
  16.525 +/**
  16.526 + * @brief Tests a blend mode.
  16.527 + *
  16.528 + * \sa
  16.529 + * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
  16.530 + * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
  16.531 + */
  16.532 +static void
  16.533 +_testBlitBlendMode( SDL_Texture * tface, int mode )
  16.534 +{
  16.535 +   int ret;
  16.536 +   Uint32 tformat;
  16.537 +   int taccess, tw, th;
  16.538 +   int i, j, ni, nj;
  16.539 +   SDL_Rect rect;
  16.540 +   int checkFailCount1;
  16.541 +   int checkFailCount2;
  16.542 +
  16.543 +   /* Clear surface. */
  16.544 +   _clearScreen();
  16.545 +
  16.546 +   /* Constant values. */
  16.547 +   ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
  16.548 +   SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
  16.549 +   rect.w = tw;
  16.550 +   rect.h = th;
  16.551 +   ni     = TESTRENDER_SCREEN_W - tw;
  16.552 +   nj     = TESTRENDER_SCREEN_H - th;
  16.553 +
  16.554 +   /* Test blend mode. */
  16.555 +   checkFailCount1 = 0;
  16.556 +   checkFailCount2 = 0;
  16.557 +   for (j=0; j <= nj; j+=4) {
  16.558 +      for (i=0; i <= ni; i+=4) {
  16.559 +         /* Set blend mode. */
  16.560 +         ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
  16.561 +         if (ret != 0) checkFailCount1++;
  16.562 +
  16.563 +         /* Blitting. */
  16.564 +         rect.x = i;
  16.565 +         rect.y = j;
  16.566 +         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
  16.567 +         if (ret != 0) checkFailCount2++;
  16.568 +      }
  16.569 +   }
  16.570 +   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount1);
  16.571 +   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
  16.572 +}
  16.573 +
  16.574 +
  16.575 +/**
  16.576 + * @brief Tests some more blitting routines.
  16.577 + *
  16.578 + * \sa
  16.579 + * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
  16.580 + * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
  16.581 + * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
  16.582 + * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  16.583 + */
  16.584 +int
  16.585 +render_testBlitBlend (void *arg)
  16.586 +{
  16.587 +   int ret;
  16.588 +   SDL_Rect rect;
  16.589 +   SDL_Texture *tface;
  16.590 +   Uint32 tformat;
  16.591 +   int taccess, tw, th;
  16.592 +   int i, j, ni, nj;
  16.593 +   int mode;
  16.594 +   int checkFailCount1;
  16.595 +   int checkFailCount2;
  16.596 +   int checkFailCount3;
  16.597 +   int checkFailCount4;
  16.598 +
  16.599 +   SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
  16.600 +   SDLTest_AssertCheck(_hasTexColor(), "_hasTexColor");
  16.601 +   SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
  16.602 +
  16.603 +   /* Create face surface. */
  16.604 +   tface = _loadTestFace();
  16.605 +   SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
  16.606 +   if (tface == NULL) {
  16.607 +       return TEST_ABORTED;
  16.608 +   }
  16.609 +
  16.610 +   /* Constant values. */
  16.611 +   ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
  16.612 +   SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
  16.613 +   rect.w = tw;
  16.614 +   rect.h = th;
  16.615 +   ni = TESTRENDER_SCREEN_W - tw;
  16.616 +   nj = TESTRENDER_SCREEN_H - th;
  16.617 +
  16.618 +   /* Set alpha mod. */
  16.619 +   ret = SDL_SetTextureAlphaMod( tface, 100 );
  16.620 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetTextureAlphaMod, expected: 0, got: %i", ret);
  16.621 +
  16.622 +   /* Test None. */
  16.623 +   _testBlitBlendMode( tface, SDL_BLENDMODE_NONE );
  16.624 +   /* See if it's the same. */
  16.625 +   _compare( "Blit blending output not the same (using SDL_BLENDMODE_NONE).",
  16.626 +            SDLTest_ImageBlitBlendNone(), ALLOWABLE_ERROR_OPAQUE ); 
  16.627 +
  16.628 +
  16.629 +   /* Test Blend. */
  16.630 +   _testBlitBlendMode( tface, SDL_BLENDMODE_BLEND );
  16.631 +   _compare( "Blit blending output not the same (using SDL_BLENDMODE_BLEND).",
  16.632 +            SDLTest_ImageBlitBlend(), ALLOWABLE_ERROR_BLENDED );
  16.633 +
  16.634 +
  16.635 +   /* Test Add. */
  16.636 +   _testBlitBlendMode( tface, SDL_BLENDMODE_ADD );
  16.637 +   _compare( "Blit blending output not the same (using SDL_BLENDMODE_ADD).",
  16.638 +            SDLTest_ImageBlitBlendAdd(), ALLOWABLE_ERROR_BLENDED );
  16.639 +
  16.640 +   /* Test Mod. */
  16.641 +   _testBlitBlendMode( tface, SDL_BLENDMODE_MOD);
  16.642 +   _compare( "Blit blending output not the same (using SDL_BLENDMODE_MOD).",
  16.643 +            SDLTest_ImageBlitBlendMod(), ALLOWABLE_ERROR_BLENDED );
  16.644 +
  16.645 +   /* Clear surface. */
  16.646 +   _clearScreen();
  16.647 +
  16.648 +   /* Loop blit. */
  16.649 +   checkFailCount1 = 0;
  16.650 +   checkFailCount2 = 0;
  16.651 +   checkFailCount3 = 0;
  16.652 +   checkFailCount4 = 0;
  16.653 +   for (j=0; j <= nj; j+=4) {
  16.654 +      for (i=0; i <= ni; i+=4) {
  16.655 +
  16.656 +         /* Set colour mod. */
  16.657 +         ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
  16.658 +         if (ret != 0) checkFailCount1++;
  16.659 +
  16.660 +         /* Set alpha mod. */
  16.661 +         ret = SDL_SetTextureAlphaMod( tface, (100/ni)*i );
  16.662 +         if (ret != 0) checkFailCount2++;
  16.663 +
  16.664 +         /* Crazy blending mode magic. */
  16.665 +         mode = (i/4*j/4) % 4;
  16.666 +         if (mode==0) mode = SDL_BLENDMODE_NONE;
  16.667 +         else if (mode==1) mode = SDL_BLENDMODE_BLEND;
  16.668 +         else if (mode==2) mode = SDL_BLENDMODE_ADD;
  16.669 +         else if (mode==3) mode = SDL_BLENDMODE_MOD;
  16.670 +         ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
  16.671 +         if (ret != 0) checkFailCount3++;
  16.672 +
  16.673 +         /* Blitting. */
  16.674 +         rect.x = i;
  16.675 +         rect.y = j;
  16.676 +         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
  16.677 +         if (ret != 0) checkFailCount4++;
  16.678 +      }
  16.679 +   }
  16.680 +   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
  16.681 +   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount2);
  16.682 +   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount3);
  16.683 +   SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount4);
  16.684 +
  16.685 +   /* Clean up. */
  16.686 +   SDL_DestroyTexture( tface );
  16.687 +
  16.688 +   /* Check to see if matches. */
  16.689 +   _compare( "Blit blending output not the same (using SDL_BLENDMODE_*).",
  16.690 +            SDLTest_ImageBlitBlendAll(), ALLOWABLE_ERROR_BLENDED);
  16.691 +
  16.692 +   return TEST_COMPLETED;
  16.693 +}
  16.694 +
  16.695 +
  16.696 +
  16.697 +/**
  16.698 + * @brief Checks to see if functionality is supported. Helper function.
  16.699 + */
  16.700 +static int
  16.701 +_isSupported( int code )
  16.702 +{
  16.703 +   return (code == 0);
  16.704 +}
  16.705 +
  16.706 +/**
  16.707 + * @brief Test to see if we can vary the draw colour. Helper function.
  16.708 + *
  16.709 + * \sa
  16.710 + * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
  16.711 + * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawColor
  16.712 + */
  16.713 +static int
  16.714 +_hasDrawColor (void)
  16.715 +{
  16.716 +   int ret, fail;
  16.717 +   Uint8 r, g, b, a;
  16.718 +
  16.719 +   fail = 0;
  16.720 +
  16.721 +   /* Set colour. */
  16.722 +   ret = SDL_SetRenderDrawColor(renderer, 100, 100, 100, 100 );
  16.723 +   if (!_isSupported(ret))
  16.724 +      fail = 1;
  16.725 +   ret = SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a );
  16.726 +   if (!_isSupported(ret))
  16.727 +      fail = 1;
  16.728 +   /* Restore natural. */
  16.729 +   ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
  16.730 +   if (!_isSupported(ret))
  16.731 +      fail = 1;
  16.732 +
  16.733 +   /* Something failed, consider not available. */
  16.734 +   if (fail)
  16.735 +      return 0;
  16.736 +   /* Not set properly, consider failed. */
  16.737 +   else if ((r != 100) || (g != 100) || (b != 100) || (a != 100))
  16.738 +      return 0;
  16.739 +   return 1;
  16.740 +}
  16.741 +
  16.742 +/**
  16.743 + * @brief Test to see if we can vary the blend mode. Helper function.
  16.744 + *
  16.745 + * \sa
  16.746 + * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
  16.747 + * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawBlendMode
  16.748 + */
  16.749 +static int
  16.750 +_hasBlendModes (void)
  16.751 +{
  16.752 +   int fail;
  16.753 +   int ret;
  16.754 +   SDL_BlendMode mode;
  16.755 +
  16.756 +   fail = 0;
  16.757 +
  16.758 +   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
  16.759 +   if (!_isSupported(ret))
  16.760 +      fail = 1;
  16.761 +   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
  16.762 +   if (!_isSupported(ret))
  16.763 +      fail = 1;
  16.764 +   ret = (mode != SDL_BLENDMODE_BLEND);
  16.765 +   if (!_isSupported(ret))
  16.766 +      fail = 1;
  16.767 +   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
  16.768 +   if (!_isSupported(ret))
  16.769 +      fail = 1;
  16.770 +   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
  16.771 +   if (!_isSupported(ret))
  16.772 +      fail = 1;
  16.773 +   ret = (mode != SDL_BLENDMODE_ADD);
  16.774 +   if (!_isSupported(ret))
  16.775 +      fail = 1;
  16.776 +   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_MOD );
  16.777 +   if (!_isSupported(ret))
  16.778 +      fail = 1;
  16.779 +   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
  16.780 +   if (!_isSupported(ret))
  16.781 +      fail = 1;
  16.782 +   ret = (mode != SDL_BLENDMODE_MOD);
  16.783 +   if (!_isSupported(ret))
  16.784 +      fail = 1;
  16.785 +   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
  16.786 +   if (!_isSupported(ret))
  16.787 +      fail = 1;
  16.788 +   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
  16.789 +   if (!_isSupported(ret))
  16.790 +      fail = 1;
  16.791 +   ret = (mode != SDL_BLENDMODE_NONE);
  16.792 +   if (!_isSupported(ret))
  16.793 +      fail = 1;
  16.794 +
  16.795 +   return !fail;
  16.796 +}
  16.797 +
  16.798 +
  16.799 +/**
  16.800 + * @brief Loads the test image 'Face' as texture. Helper function.
  16.801 + *
  16.802 + * \sa
  16.803 + * http://wiki.libsdl.org/moin.cgi/SDL_CreateTextureFromSurface
  16.804 + */
  16.805 +static SDL_Texture *
  16.806 +_loadTestFace(void)
  16.807 +{
  16.808 +   SDL_Surface *face;
  16.809 +   SDL_Texture *tface;
  16.810 +
  16.811 +   face = SDLTest_ImageFace();
  16.812 +   if (face == NULL) {
  16.813 +      return NULL;
  16.814 +   }
  16.815 +   
  16.816 +   tface = SDL_CreateTextureFromSurface(renderer, face);
  16.817 +   if (tface == NULL) {
  16.818 +       SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
  16.819 +   }
  16.820 +
  16.821 +   SDL_FreeSurface(face);
  16.822 +
  16.823 +   return tface;
  16.824 +}
  16.825 +
  16.826 +
  16.827 +/**
  16.828 + * @brief Test to see if can set texture colour mode. Helper function.
  16.829 + *
  16.830 + * \sa
  16.831 + * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
  16.832 + * http://wiki.libsdl.org/moin.cgi/SDL_GetTextureColorMod
  16.833 + * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  16.834 + */
  16.835 +static int
  16.836 +_hasTexColor (void)
  16.837 +{
  16.838 +   int fail;
  16.839 +   int ret;
  16.840 +   SDL_Texture *tface;
  16.841 +   Uint8 r, g, b;
  16.842 +
  16.843 +   /* Get test face. */
  16.844 +   tface = _loadTestFace();
  16.845 +   if (tface == 0)
  16.846 +      return 0;
  16.847 +
  16.848 +   /* See if supported. */
  16.849 +   fail = 0;
  16.850 +   ret = SDL_SetTextureColorMod( tface, 100, 100, 100 );
  16.851 +   if (!_isSupported(ret))
  16.852 +      fail = 1;
  16.853 +   ret = SDL_GetTextureColorMod( tface, &r, &g, &b );
  16.854 +   if (!_isSupported(ret))
  16.855 +      fail = 1;
  16.856 +
  16.857 +   /* Clean up. */
  16.858 +   SDL_DestroyTexture( tface );
  16.859 +
  16.860 +   if (fail)
  16.861 +      return 0;
  16.862 +   else if ((r != 100) || (g != 100) || (b != 100))
  16.863 +      return 0;
  16.864 +   return 1;
  16.865 +}
  16.866 +
  16.867 +/**
  16.868 + * @brief Test to see if we can vary the alpha of the texture. Helper function.
  16.869 + *
  16.870 + * \sa
  16.871 + *  http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
  16.872 + *  http://wiki.libsdl.org/moin.cgi/SDL_GetTextureAlphaMod
  16.873 + *  http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  16.874 + */
  16.875 +static int
  16.876 +_hasTexAlpha(void)
  16.877 +{
  16.878 +   int fail;
  16.879 +   int ret;
  16.880 +   SDL_Texture *tface;
  16.881 +   Uint8 a;
  16.882 +
  16.883 +   /* Get test face. */
  16.884 +   tface = _loadTestFace();
  16.885 +   if (tface == 0)
  16.886 +      return 0;
  16.887 +
  16.888 +   /* See if supported. */
  16.889 +   fail = 0;
  16.890 +   ret = SDL_SetTextureAlphaMod( tface, 100 );
  16.891 +   if (!_isSupported(ret))
  16.892 +      fail = 1;
  16.893 +   ret = SDL_GetTextureAlphaMod( tface, &a );
  16.894 +   if (!_isSupported(ret))
  16.895 +      fail = 1;
  16.896 +
  16.897 +   /* Clean up. */
  16.898 +   SDL_DestroyTexture( tface );
  16.899 +
  16.900 +   if (fail)
  16.901 +      return 0;
  16.902 +   else if (a != 100)
  16.903 +      return 0;
  16.904 +   return 1;
  16.905 +}
  16.906 +
  16.907 +static _renderCompareCount = 0;
  16.908 +
  16.909 +/**
  16.910 + * @brief Compares screen pixels with image pixels. Helper function.
  16.911 + *
  16.912 + * @param msg Message on failure.
  16.913 + * @param s Image to compare against.
  16.914 + * @return 0 on success.
  16.915 + *
  16.916 + * \sa
  16.917 + * http://wiki.libsdl.org/moin.cgi/SDL_RenderReadPixels
  16.918 + * http://wiki.libsdl.org/moin.cgi/SDL_CreateRGBSurfaceFrom
  16.919 + * http://wiki.libsdl.org/moin.cgi/SDL_FreeSurface
  16.920 + */
  16.921 +static void
  16.922 +_compare(const char *msg, SDL_Surface *s, int allowable_error)
  16.923 +{
  16.924 +   int ret;
  16.925 +   SDL_Rect rect;
  16.926 +   Uint8 pix[4*80*60];
  16.927 +   SDL_Surface *testsur;
  16.928 +   char imageFilename[128];
  16.929 +   char referenceFilename[128];
  16.930 +
  16.931 +   /* Read pixels. */
  16.932 +   /* Explicitly specify the rect in case the window isn't expected size... */
  16.933 +   rect.x = 0;
  16.934 +   rect.y = 0;
  16.935 +   rect.w = 80;
  16.936 +   rect.h = 60;
  16.937 +   ret = SDL_RenderReadPixels(renderer, &rect, RENDER_COMPARE_FORMAT, pix, 80*4 );
  16.938 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderReadPixels, expected: 0, got: %i", ret);
  16.939 +
  16.940 +   /* Create surface. */
  16.941 +   testsur = SDL_CreateRGBSurfaceFrom( pix, TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, 32, TESTRENDER_SCREEN_W*4,
  16.942 +                                       RENDER_COMPARE_RMASK, RENDER_COMPARE_GMASK, RENDER_COMPARE_BMASK, RENDER_COMPARE_AMASK);
  16.943 +   SDLTest_AssertCheck(testsur != NULL, "Verify result from SDL_CreateRGBSurfaceFrom");
  16.944 +
  16.945 +   /* Compare surface. */
  16.946 +   ret = SDLTest_CompareSurfaces( testsur, s, allowable_error );
  16.947 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  16.948 +
  16.949 +   _renderCompareCount++;
  16.950 +   if (ret != 0) {
  16.951 +      SDL_snprintf(imageFilename, 127, "image%i.bmp", _renderCompareCount);
  16.952 +      SDL_SaveBMP(testsur, imageFilename);
  16.953 +      SDL_snprintf(referenceFilename, 127, "reference%i.bmp", _renderCompareCount);
  16.954 +      SDL_SaveBMP(s, referenceFilename);
  16.955 +      SDLTest_LogError("Surfaces from failed comparison saved as %s and %s", imageFilename, referenceFilename);
  16.956 +   }
  16.957 +
  16.958 +   /* Clean up. */
  16.959 +   SDL_FreeSurface( testsur );
  16.960 +}
  16.961 +
  16.962 +/**
  16.963 + * @brief Clears the screen. Helper function.
  16.964 + *
  16.965 + * \sa
  16.966 + * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
  16.967 + * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
  16.968 + * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
  16.969 + */
  16.970 +static int
  16.971 +_clearScreen(void)
  16.972 +{
  16.973 +   int ret;
  16.974 +
  16.975 +   /* Set colour. */
  16.976 +   ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
  16.977 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  16.978 +
  16.979 +   /* Clear screen. */
  16.980 +   ret = SDL_RenderFillRect(renderer, NULL );
  16.981 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  16.982 +
  16.983 +   /* Set defaults. */
  16.984 +   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
  16.985 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
  16.986 +
  16.987 +   ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE );
  16.988 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  16.989 +
  16.990 +   return 0;
  16.991 +}
  16.992 +
  16.993 +/* ================= Test References ================== */
  16.994 +
  16.995 +/* Render test cases */
  16.996 +static const SDLTest_TestCaseReference renderTest1 =
  16.997 +		{ (SDLTest_TestCaseFp)render_testGetNumRenderDrivers, "render_testGetNumRenderDrivers", "Tests call to SDL_GetNumRenderDrivers", TEST_ENABLED };
  16.998 +
  16.999 +static const SDLTest_TestCaseReference renderTest2 =
 16.1000 +		{ (SDLTest_TestCaseFp)render_testPrimitives, "render_testPrimitives", "Tests rendering primitives", TEST_ENABLED };
 16.1001 +
 16.1002 +static const SDLTest_TestCaseReference renderTest3 =
 16.1003 +		{ (SDLTest_TestCaseFp)render_testPrimitivesBlend, "render_testPrimitivesBlend", "Tests rendering primitives with blending", TEST_ENABLED };
 16.1004 +
 16.1005 +static const SDLTest_TestCaseReference renderTest4 =
 16.1006 +		{ (SDLTest_TestCaseFp)render_testBlit, "render_testBlit", "Tests blitting", TEST_ENABLED };
 16.1007 +
 16.1008 +static const SDLTest_TestCaseReference renderTest5 =
 16.1009 +		{ (SDLTest_TestCaseFp)render_testBlitColor, "render_testBlitColor", "Tests blitting with color", TEST_ENABLED };
 16.1010 +
 16.1011 +static const SDLTest_TestCaseReference renderTest6 =
 16.1012 +		{ (SDLTest_TestCaseFp)render_testBlitAlpha, "render_testBlitAlpha", "Tests blitting with alpha", TEST_ENABLED };
 16.1013 +
 16.1014 +static const SDLTest_TestCaseReference renderTest7 =
 16.1015 +		{  (SDLTest_TestCaseFp)render_testBlitBlend, "render_testBlitBlend", "Tests blitting with blending", TEST_ENABLED };
 16.1016 +
 16.1017 +/* Sequence of Render test cases */
 16.1018 +static const SDLTest_TestCaseReference *renderTests[] =  {
 16.1019 +	&renderTest1, &renderTest2, &renderTest3, &renderTest4, &renderTest5, &renderTest6, &renderTest7, NULL
 16.1020 +};
 16.1021 +
 16.1022 +/* Render test suite (global) */
 16.1023 +SDLTest_TestSuiteReference renderTestSuite = {
 16.1024 +	"Render",
 16.1025 +	InitCreateRenderer,
 16.1026 +	renderTests,
 16.1027 +	CleanupDestroyRenderer
 16.1028 +};
    17.1 --- a/test/tests/testsuites.h	Thu Dec 20 08:50:36 2012 -0800
    17.2 +++ b/test/tests/testsuites.h	Sat Dec 22 16:06:55 2012 -0800
    17.3 @@ -15,7 +15,7 @@
    17.4  //extern SDLTest_TestSuiteReference keyboardTestSuite;
    17.5  extern SDLTest_TestSuiteReference platformTestSuite;
    17.6  extern SDLTest_TestSuiteReference rectTestSuite;
    17.7 -//extern SDLTest_TestSuiteReference renderTestSuite;
    17.8 +extern SDLTest_TestSuiteReference renderTestSuite;
    17.9  extern SDLTest_TestSuiteReference rwopsTestSuite;
   17.10  //extern SDLTest_TestSuiteReference surfaceTestSuite;
   17.11  //extern SDLTest_TestSuiteReference syswmTestSuite;
   17.12 @@ -29,7 +29,7 @@
   17.13  //	&keyboardTestSuite,
   17.14  	&platformTestSuite,
   17.15  	&rectTestSuite,
   17.16 -//	&renderTestSuite,
   17.17 +	&renderTestSuite,
   17.18  	&rwopsTestSuite,
   17.19  //	&surfaceTestSuite,
   17.20  //	&syswmTestSuite,