Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
authorAndreas Schiffler <aschiffler@ferzkopp.net>
Wed, 26 Dec 2012 22:26:44 -0800
changeset 67735ebc5a9e35b4
parent 6772 5229a117ef97
child 6774 ad8522052ce6
Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
include/SDL_test_images.h
src/test/SDL_test_compare.c
test/Makefile.in
test/testautomation_render.c
test/testautomation_suites.h
test/testautomation_surface.c
     1.1 --- a/include/SDL_test_images.h	Mon Dec 24 14:43:57 2012 -0800
     1.2 +++ b/include/SDL_test_images.h	Wed Dec 26 22:26:44 2012 -0800
     1.3 @@ -53,7 +53,7 @@
     1.4    int width;
     1.5    int height;
     1.6    unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ 
     1.7 -  const unsigned char pixel_data[];
     1.8 +  unsigned char pixel_data[];
     1.9  } SDLTest_SurfaceImage_t;
    1.10  
    1.11  /* Test images */
     2.1 --- a/src/test/SDL_test_compare.c	Mon Dec 24 14:43:57 2012 -0800
     2.2 +++ b/src/test/SDL_test_compare.c	Wed Dec 26 22:26:44 2012 -0800
     2.3 @@ -32,7 +32,11 @@
     2.4  #include "SDL_test.h"
     2.5  
     2.6  
     2.7 -int SDLTest_CompareSurfaces( SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error )
     2.8 +/* Counter for _CompareSurface calls; used for filename creation when comparisons fail */
     2.9 +static int _CompareSurfaceCount = 0;
    2.10 +
    2.11 +/* Compare surfaces */
    2.12 +int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error)
    2.13  {
    2.14     int ret;
    2.15     int i,j;
    2.16 @@ -41,18 +45,20 @@
    2.17     int dist;
    2.18     Uint8 R, G, B, A;
    2.19     Uint8 Rd, Gd, Bd, Ad;
    2.20 +   char imageFilename[128];
    2.21 +   char referenceFilename[128];
    2.22  
    2.23     /* Validate input surfaces */
    2.24     if (surface == NULL || referenceSurface == NULL) {
    2.25        return -1;
    2.26     }
    2.27  
    2.28 -   /* Make surface size is the same. */
    2.29 +   /* Make sure surface size is the same. */
    2.30     if ((surface->w != referenceSurface->w) || (surface->h != referenceSurface->h)) {
    2.31        return -2;
    2.32     }
    2.33  
    2.34 -   /* Sanitize input */
    2.35 +   /* Sanitize input value */
    2.36     if (allowable_error<0) {
    2.37        allowable_error = 0;
    2.38     }
    2.39 @@ -87,5 +93,15 @@
    2.40     SDL_UnlockSurface( surface );
    2.41     SDL_UnlockSurface( referenceSurface );
    2.42  
    2.43 +   /* Save test image and reference for analysis on failures */
    2.44 +   _CompareSurfaceCount++;
    2.45 +   if (ret != 0) {
    2.46 +      SDL_snprintf(imageFilename, 127, "CompareSurfaces%04d_TestOutput.bmp", _CompareSurfaceCount);
    2.47 +      SDL_SaveBMP(surface, imageFilename);
    2.48 +      SDL_snprintf(referenceFilename, 127, "CompareSurfaces%04d_Reference.bmp", _CompareSurfaceCount);
    2.49 +      SDL_SaveBMP(referenceSurface, referenceFilename);
    2.50 +      SDLTest_LogError("Surfaces from failed comparison saved as '%s' and '%s'", imageFilename, referenceFilename);
    2.51 +   }
    2.52 +
    2.53     return ret;
    2.54  }
     3.1 --- a/test/Makefile.in	Mon Dec 24 14:43:57 2012 -0800
     3.2 +++ b/test/Makefile.in	Wed Dec 26 22:26:44 2012 -0800
     3.3 @@ -74,7 +74,8 @@
     3.4  		      $(srcdir)/testautomation_rect.c \
     3.5  		      $(srcdir)/testautomation_render.c \
     3.6  		      $(srcdir)/testautomation_rwops.c \
     3.7 -		      $(srcdir)/testautomation_audio.c
     3.8 +		      $(srcdir)/testautomation_audio.c \
     3.9 +		      $(srcdir)/testautomation_surface.c
    3.10  	$(CC) -o $@ $^ $(CFLAGS) -lSDL2_test $(LIBS) 
    3.11  
    3.12  testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c
     4.1 --- a/test/testautomation_render.c	Mon Dec 24 14:43:57 2012 -0800
     4.2 +++ b/test/testautomation_render.c	Wed Dec 26 22:26:44 2012 -0800
     4.3 @@ -22,13 +22,14 @@
     4.4  #define ALLOWABLE_ERROR_OPAQUE	0
     4.5  #define ALLOWABLE_ERROR_BLENDED	64
     4.6  
     4.7 +/* Test window and renderer */
     4.8  SDL_Window *window = NULL;
     4.9  SDL_Renderer *renderer = NULL;
    4.10  
    4.11  /* Prototypes for helper functions */
    4.12  
    4.13  static int _clearScreen (void);
    4.14 -static void _compare(const char *msg, SDL_Surface *s, int allowable_error);
    4.15 +static void _compare(SDL_Surface *reference, int allowable_error);
    4.16  static int _hasTexAlpha(void);
    4.17  static int _hasTexColor(void);
    4.18  static SDL_Texture *_loadTestFace(void);
    4.19 @@ -53,7 +54,7 @@
    4.20    renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
    4.21    SDLTest_AssertPass("SDL_CreateRenderer()");
    4.22    SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result");
    4.23 -  if (renderer == 0) {
    4.24 +  if (renderer == NULL) {
    4.25        SDL_DestroyWindow(window);
    4.26        return;
    4.27    }
    4.28 @@ -66,11 +67,13 @@
    4.29  {
    4.30    if (renderer != NULL) {  
    4.31       SDL_DestroyRenderer(renderer);
    4.32 +     renderer = NULL;
    4.33       SDLTest_AssertPass("SDL_DestroyRenderer()");
    4.34    }
    4.35    
    4.36    if (window != NULL) {  
    4.37       SDL_DestroyWindow(window);
    4.38 +     window = NULL;
    4.39       SDLTest_AssertPass("SDL_DestroyWindow");
    4.40    }
    4.41  }
    4.42 @@ -106,6 +109,7 @@
    4.43     int ret;
    4.44     int x, y;
    4.45     SDL_Rect rect;
    4.46 +   SDL_Surface *referenceSurface = NULL;
    4.47     int checkFailCount1;
    4.48     int checkFailCount2;
    4.49  
    4.50 @@ -182,7 +186,14 @@
    4.51     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
    4.52  
    4.53     /* See if it's the same. */
    4.54 -   _compare( "Primitives output not the same.", SDLTest_ImagePrimitives(), ALLOWABLE_ERROR_OPAQUE );
    4.55 +   referenceSurface = SDLTest_ImagePrimitives();
    4.56 +   _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
    4.57 +
    4.58 +   /* Clean up. */
    4.59 +   if (referenceSurface != NULL) {
    4.60 +      SDL_FreeSurface(referenceSurface);
    4.61 +      referenceSurface = NULL;
    4.62 +   }
    4.63  
    4.64     return TEST_COMPLETED;
    4.65  }
    4.66 @@ -200,6 +211,7 @@
    4.67     int ret;
    4.68     int i, j;
    4.69     SDL_Rect rect;
    4.70 +   SDL_Surface *referenceSurface = NULL;
    4.71     int checkFailCount1;
    4.72     int checkFailCount2;
    4.73     int checkFailCount3;
    4.74 @@ -317,9 +329,16 @@
    4.75     SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
    4.76  
    4.77     /* See if it's the same. */
    4.78 -   _compare( "Blended primitives output not the same.", SDLTest_ImagePrimitivesBlend(), ALLOWABLE_ERROR_BLENDED );
    4.79 +   referenceSurface = SDLTest_ImagePrimitivesBlend();
    4.80 +   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
    4.81  
    4.82 -    return TEST_COMPLETED;
    4.83 +   /* Clean up. */
    4.84 +   if (referenceSurface != NULL) {
    4.85 +      SDL_FreeSurface(referenceSurface);
    4.86 +      referenceSurface = NULL;
    4.87 +   }
    4.88 +
    4.89 +   return TEST_COMPLETED;
    4.90  }
    4.91  
    4.92  
    4.93 @@ -337,6 +356,7 @@
    4.94     int ret;
    4.95     SDL_Rect rect;
    4.96     SDL_Texture *tface;
    4.97 +   SDL_Surface *referenceSurface = NULL;
    4.98     Uint32 tformat;
    4.99     int taccess, tw, th;
   4.100     int i, j, ni, nj;
   4.101 @@ -374,11 +394,16 @@
   4.102     }
   4.103     SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
   4.104  
   4.105 +   /* See if it's the same */
   4.106 +   referenceSurface = SDLTest_ImageBlit();
   4.107 +   _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
   4.108 +
   4.109     /* Clean up. */
   4.110     SDL_DestroyTexture( tface );
   4.111 -
   4.112 -   /* See if it's the same */
   4.113 -   _compare( "Blit output not the same.", SDLTest_ImageBlit(), ALLOWABLE_ERROR_OPAQUE );
   4.114 +   if (referenceSurface != NULL) {
   4.115 +      SDL_FreeSurface(referenceSurface);
   4.116 +      referenceSurface = NULL;
   4.117 +   }
   4.118  
   4.119     return TEST_COMPLETED;
   4.120  }
   4.121 @@ -398,6 +423,7 @@
   4.122     int ret;
   4.123     SDL_Rect rect;
   4.124     SDL_Texture *tface;
   4.125 +   SDL_Surface *referenceSurface = NULL;
   4.126     Uint32 tformat;
   4.127     int taccess, tw, th;
   4.128     int i, j, ni, nj;
   4.129 @@ -438,12 +464,16 @@
   4.130     SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
   4.131     SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
   4.132  
   4.133 +   /* See if it's the same. */
   4.134 +   referenceSurface = SDLTest_ImageBlitColor();
   4.135 +   _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
   4.136 +
   4.137     /* Clean up. */
   4.138     SDL_DestroyTexture( tface );
   4.139 -
   4.140 -   /* See if it's the same. */
   4.141 -   _compare( "Blit output not the same (using SDL_SetTextureColorMod).",
   4.142 -            SDLTest_ImageBlitColor(), ALLOWABLE_ERROR_OPAQUE );
   4.143 +   if (referenceSurface != NULL) {
   4.144 +      SDL_FreeSurface(referenceSurface);
   4.145 +      referenceSurface = NULL;
   4.146 +   }
   4.147  
   4.148     return TEST_COMPLETED;
   4.149  }
   4.150 @@ -463,13 +493,13 @@
   4.151     int ret;
   4.152     SDL_Rect rect;
   4.153     SDL_Texture *tface;
   4.154 +   SDL_Surface *referenceSurface = NULL;
   4.155     Uint32 tformat;
   4.156     int taccess, tw, th;
   4.157     int i, j, ni, nj;
   4.158     int checkFailCount1;
   4.159     int checkFailCount2;
   4.160  
   4.161 -
   4.162     /* Need alpha or just skip test. */
   4.163     SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
   4.164  
   4.165 @@ -507,12 +537,16 @@
   4.166     SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
   4.167     SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
   4.168  
   4.169 +   /* See if it's the same. */
   4.170 +   referenceSurface = SDLTest_ImageBlitAlpha();
   4.171 +   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   4.172 +
   4.173     /* Clean up. */
   4.174     SDL_DestroyTexture( tface );
   4.175 -
   4.176 -   /* See if it's the same. */
   4.177 -   _compare( "Blit output not the same (using SDL_SetSurfaceAlphaMod).",
   4.178 -            SDLTest_ImageBlitAlpha(), ALLOWABLE_ERROR_BLENDED );
   4.179 +   if (referenceSurface != NULL) {
   4.180 +      SDL_FreeSurface(referenceSurface);
   4.181 +      referenceSurface = NULL;
   4.182 +   }
   4.183  
   4.184     return TEST_COMPLETED;
   4.185  }
   4.186 @@ -584,6 +618,7 @@
   4.187     int ret;
   4.188     SDL_Rect rect;
   4.189     SDL_Texture *tface;
   4.190 +   SDL_Surface *referenceSurface = NULL;
   4.191     Uint32 tformat;
   4.192     int taccess, tw, th;
   4.193     int i, j, ni, nj;
   4.194 @@ -618,26 +653,39 @@
   4.195  
   4.196     /* Test None. */
   4.197     _testBlitBlendMode( tface, SDL_BLENDMODE_NONE );
   4.198 -   /* See if it's the same. */
   4.199 -   _compare( "Blit blending output not the same (using SDL_BLENDMODE_NONE).",
   4.200 -            SDLTest_ImageBlitBlendNone(), ALLOWABLE_ERROR_OPAQUE ); 
   4.201 -
   4.202 -
   4.203 +   referenceSurface = SDLTest_ImageBlitBlendNone();
   4.204 +   _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE ); 
   4.205 +   if (referenceSurface != NULL) {
   4.206 +      SDL_FreeSurface(referenceSurface);
   4.207 +      referenceSurface = NULL;
   4.208 +   }
   4.209 +   
   4.210     /* Test Blend. */
   4.211     _testBlitBlendMode( tface, SDL_BLENDMODE_BLEND );
   4.212 -   _compare( "Blit blending output not the same (using SDL_BLENDMODE_BLEND).",
   4.213 -            SDLTest_ImageBlitBlend(), ALLOWABLE_ERROR_BLENDED );
   4.214 -
   4.215 +   referenceSurface = SDLTest_ImageBlitBlend();
   4.216 +   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   4.217 +   if (referenceSurface != NULL) {
   4.218 +      SDL_FreeSurface(referenceSurface);
   4.219 +      referenceSurface = NULL;
   4.220 +   }
   4.221  
   4.222     /* Test Add. */
   4.223     _testBlitBlendMode( tface, SDL_BLENDMODE_ADD );
   4.224 -   _compare( "Blit blending output not the same (using SDL_BLENDMODE_ADD).",
   4.225 -            SDLTest_ImageBlitBlendAdd(), ALLOWABLE_ERROR_BLENDED );
   4.226 +   referenceSurface = SDLTest_ImageBlitBlendAdd();
   4.227 +   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   4.228 +   if (referenceSurface != NULL) {
   4.229 +      SDL_FreeSurface(referenceSurface);
   4.230 +      referenceSurface = NULL;
   4.231 +   }
   4.232  
   4.233     /* Test Mod. */
   4.234     _testBlitBlendMode( tface, SDL_BLENDMODE_MOD);
   4.235 -   _compare( "Blit blending output not the same (using SDL_BLENDMODE_MOD).",
   4.236 -            SDLTest_ImageBlitBlendMod(), ALLOWABLE_ERROR_BLENDED );
   4.237 +   referenceSurface = SDLTest_ImageBlitBlendMod();
   4.238 +   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   4.239 +   if (referenceSurface != NULL) {
   4.240 +      SDL_FreeSurface(referenceSurface);
   4.241 +      referenceSurface = NULL;
   4.242 +   }
   4.243  
   4.244     /* Clear surface. */
   4.245     _clearScreen();
   4.246 @@ -682,9 +730,13 @@
   4.247     /* Clean up. */
   4.248     SDL_DestroyTexture( tface );
   4.249  
   4.250 -   /* Check to see if matches. */
   4.251 -   _compare( "Blit blending output not the same (using SDL_BLENDMODE_*).",
   4.252 -            SDLTest_ImageBlitBlendAll(), ALLOWABLE_ERROR_BLENDED);
   4.253 +   /* Check to see if final image matches. */
   4.254 +   referenceSurface = SDLTest_ImageBlitBlendAll();
   4.255 +   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
   4.256 +   if (referenceSurface != NULL) {
   4.257 +      SDL_FreeSurface(referenceSurface);
   4.258 +      referenceSurface = NULL;
   4.259 +   }
   4.260  
   4.261     return TEST_COMPLETED;
   4.262  }
   4.263 @@ -902,9 +954,6 @@
   4.264     return 1;
   4.265  }
   4.266  
   4.267 -/* Counter for _compare calls use for filename creation when comparisons fail */
   4.268 -static int _renderCompareCount = 0;
   4.269 -
   4.270  /**
   4.271   * @brief Compares screen pixels with image pixels. Helper function.
   4.272   *
   4.273 @@ -918,17 +967,15 @@
   4.274   * http://wiki.libsdl.org/moin.cgi/SDL_FreeSurface
   4.275   */
   4.276  static void
   4.277 -_compare(const char *msg, SDL_Surface *s, int allowable_error)
   4.278 +_compare(SDL_Surface *referenceSurface, int allowable_error)
   4.279  {
   4.280     int ret;
   4.281     SDL_Rect rect;
   4.282     Uint8 pix[4*TESTRENDER_SCREEN_W*TESTRENDER_SCREEN_H];
   4.283 -   SDL_Surface *testsur;
   4.284 -   char imageFilename[128];
   4.285 -   char referenceFilename[128];
   4.286 +   SDL_Surface *testSurface;
   4.287  
   4.288     /* Read pixels. */
   4.289 -   /* Explicitly specify the rect in case the window isn't expected size... */
   4.290 +   /* Explicitly specify the rect in case the window isn't the expected size... */
   4.291     rect.x = 0;
   4.292     rect.y = 0;
   4.293     rect.w = TESTRENDER_SCREEN_W;
   4.294 @@ -937,26 +984,18 @@
   4.295     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderReadPixels, expected: 0, got: %i", ret);
   4.296  
   4.297     /* Create surface. */
   4.298 -   testsur = SDL_CreateRGBSurfaceFrom( pix, TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, 32, TESTRENDER_SCREEN_W*4,
   4.299 +   testSurface = SDL_CreateRGBSurfaceFrom( pix, TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, 32, TESTRENDER_SCREEN_W*4,
   4.300                                         RENDER_COMPARE_RMASK, RENDER_COMPARE_GMASK, RENDER_COMPARE_BMASK, RENDER_COMPARE_AMASK);
   4.301 -   SDLTest_AssertCheck(testsur != NULL, "Verify result from SDL_CreateRGBSurfaceFrom");
   4.302 +   SDLTest_AssertCheck(testSurface != NULL, "Verify result from SDL_CreateRGBSurfaceFrom");
   4.303  
   4.304     /* Compare surface. */
   4.305 -   ret = SDLTest_CompareSurfaces( testsur, s, allowable_error );
   4.306 +   ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, allowable_error );
   4.307     SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   4.308  
   4.309 -   /* Save source image and reference image for analysis */
   4.310 -   _renderCompareCount++;
   4.311 -   if (ret != 0) {
   4.312 -      SDL_snprintf(imageFilename, 127, "compare%04d_SourceImage.bmp", _renderCompareCount);
   4.313 -      SDL_SaveBMP(testsur, imageFilename);
   4.314 -      SDL_snprintf(referenceFilename, 127, "compare%04d_ReferenceImage.bmp", _renderCompareCount);
   4.315 -      SDL_SaveBMP(s, referenceFilename);
   4.316 -      SDLTest_LogError("Surfaces from failed comparison saved as '%s' and '%s'", imageFilename, referenceFilename);
   4.317 +   /* Clean up. */
   4.318 +   if (testSurface != NULL) {
   4.319 +       SDL_FreeSurface(testSurface);
   4.320     }
   4.321 -
   4.322 -   /* Clean up. */
   4.323 -   SDL_FreeSurface(testsur);
   4.324  }
   4.325  
   4.326  /**
     5.1 --- a/test/testautomation_suites.h	Mon Dec 24 14:43:57 2012 -0800
     5.2 +++ b/test/testautomation_suites.h	Wed Dec 26 22:26:44 2012 -0800
     5.3 @@ -17,7 +17,7 @@
     5.4  extern SDLTest_TestSuiteReference rectTestSuite;
     5.5  extern SDLTest_TestSuiteReference renderTestSuite;
     5.6  extern SDLTest_TestSuiteReference rwopsTestSuite;
     5.7 -//extern SDLTest_TestSuiteReference surfaceTestSuite;
     5.8 +extern SDLTest_TestSuiteReference surfaceTestSuite;
     5.9  //extern SDLTest_TestSuiteReference syswmTestSuite;
    5.10  //extern SDLTest_TestSuiteReference videoTestSuite;
    5.11  
    5.12 @@ -31,7 +31,7 @@
    5.13  	&rectTestSuite,
    5.14  	&renderTestSuite,
    5.15  	&rwopsTestSuite,
    5.16 -//	&surfaceTestSuite,
    5.17 +	&surfaceTestSuite,
    5.18  //	&syswmTestSuite,
    5.19  //	&videoTestSuite,
    5.20  	NULL
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/test/testautomation_surface.c	Wed Dec 26 22:26:44 2012 -0800
     6.3 @@ -0,0 +1,519 @@
     6.4 +/**
     6.5 + * Original code: automated SDL surface test written by Edgar Simo "bobbens"
     6.6 + * Adapted/rewritten for test lib by Andreas Schiffler
     6.7 + */
     6.8 +
     6.9 +#include <stdio.h>
    6.10 +#include <sys/stat.h>
    6.11 +
    6.12 +#include "SDL.h"
    6.13 +#include "SDL_test.h"
    6.14 +
    6.15 +/* ================= Test Case Implementation ================== */
    6.16 +
    6.17 +
    6.18 +/* Shared test surface */
    6.19 +
    6.20 +static SDL_Surface *testsurface = NULL;
    6.21 +
    6.22 +/* Fixture */
    6.23 +
    6.24 +void
    6.25 +_surfaceSetUp(void *arg)
    6.26 +{
    6.27 +   testsurface = SDLTest_ImageBlit();
    6.28 +   SDLTest_AssertCheck(testsurface != NULL, "Check that testsurface is not NULL");
    6.29 +}
    6.30 +
    6.31 +void
    6.32 +_surfaceTearDown(void *arg)
    6.33 +{
    6.34 +	if (testsurface != NULL) {
    6.35 +		SDL_FreeSurface(testsurface);
    6.36 +		testsurface = NULL;
    6.37 +	}
    6.38 +}
    6.39 +
    6.40 +/* Helper functions for the test cases */
    6.41 +
    6.42 +#define TEST_SURFACE_WIDTH testsurface->w
    6.43 +#define TEST_SURFACE_HEIGHT testsurface->h
    6.44 +
    6.45 +/**
    6.46 + * Helper that clears the test surface
    6.47 + */
    6.48 +void _clearTestSurface()
    6.49 +{
    6.50 +	int ret;
    6.51 +	Uint32 color;
    6.52 +	
    6.53 +	/* Clear surface. */
    6.54 +	color = SDL_MapRGB( testsurface->format, 0, 0, 0);
    6.55 +	SDLTest_AssertPass("Call to SDL_MapRGB()");
    6.56 +	ret = SDL_FillRect( testsurface, NULL, color);
    6.57 +	SDLTest_AssertPass("Call to SDL_FillRect()");
    6.58 +	SDLTest_AssertCheck(ret == 0, "Verify result from SDL_FillRect, expected: 0, got: %i", ret);
    6.59 +}
    6.60 +
    6.61 +/**
    6.62 + * Helper that blits in a specific blend mode, -1 for basic blitting, -2 for color mod, -3 for alpha mod, -4 for mixed blend modes.
    6.63 + */
    6.64 +void _testBlitBlendMode(int mode)
    6.65 +{
    6.66 +	int ret;
    6.67 +	int i, j, ni, nj;
    6.68 +	SDL_Surface *face;
    6.69 +	SDL_Rect rect;
    6.70 +	Uint32 color;
    6.71 +	int nmode;
    6.72 +	int checkFailCount1;
    6.73 +	int checkFailCount2;
    6.74 +	int checkFailCount3;
    6.75 +	int checkFailCount4;
    6.76 +
    6.77 +	/* Check test surface */
    6.78 +	SDLTest_AssertCheck(testsurface != NULL, "Verify testsurface is not NULL");
    6.79 +	if (testsurface == NULL) return;
    6.80 +	
    6.81 +	/* Create sample surface */
    6.82 +	face = SDLTest_ImageFace();
    6.83 +	SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
    6.84 +	if (face == NULL) return;
    6.85 +
    6.86 +	/* Clear the test surface */
    6.87 +        _clearTestSurface();
    6.88 +        
    6.89 +	/* Target rect size */
    6.90 +	rect.w = face->w;
    6.91 +	rect.h = face->h;
    6.92 +	
    6.93 +	/* Steps to take */
    6.94 +	ni = testsurface->w - face->w;
    6.95 +	nj = testsurface->h - face->h;
    6.96 +
    6.97 +	/* Optionally set blend mode. */
    6.98 +	if (mode >= 0) {
    6.99 +		ret = SDL_SetSurfaceBlendMode( face, (SDL_BlendMode)mode );
   6.100 +		SDLTest_AssertPass("Call to SDL_SetSurfaceBlendMode()");
   6.101 +		SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceBlendMode(..., %i), expected: 0, got: %i", mode, ret);
   6.102 +	}
   6.103 +	
   6.104 +	/* Test blend mode. */
   6.105 +	checkFailCount1 = 0;
   6.106 +	checkFailCount2 = 0;
   6.107 +	checkFailCount3 = 0;
   6.108 +	checkFailCount4 = 0;
   6.109 +	for (j=0; j <= nj; j+=4) {
   6.110 +	  for (i=0; i <= ni; i+=4) {
   6.111 +	  	if (mode == -2) {
   6.112 +			/* Set colour mod. */
   6.113 +			ret = SDL_SetSurfaceColorMod( face, (255/nj)*j, (255/ni)*i, (255/nj)*j );
   6.114 +			if (ret != 0) checkFailCount2++;
   6.115 +		}
   6.116 +	  	else if (mode == -3) {
   6.117 +	  		/* Set alpha mod. */
   6.118 +			ret = SDL_SetSurfaceAlphaMod( face, (255/ni)*i );
   6.119 +			if (ret != 0) checkFailCount3++;
   6.120 +		}
   6.121 +		else if (mode == -4) {
   6.122 +			/* Crazy blending mode magic. */
   6.123 +			nmode = (i/4*j/4) % 4;
   6.124 +			if (nmode==0) nmode = SDL_BLENDMODE_NONE;
   6.125 +			else if (nmode==1) nmode = SDL_BLENDMODE_BLEND;
   6.126 +			else if (nmode==2) nmode = SDL_BLENDMODE_ADD;
   6.127 +			else if (nmode==3) nmode = SDL_BLENDMODE_MOD;
   6.128 +			ret = SDL_SetSurfaceBlendMode( face, nmode );		
   6.129 +			if (ret != 0) checkFailCount4++;
   6.130 +		}
   6.131 +
   6.132 +		 /* Blitting. */
   6.133 +		 rect.x = i;
   6.134 +		 rect.y = j;
   6.135 +		 ret = SDL_BlitSurface( face, NULL, testsurface, &rect );
   6.136 +		 if (ret != 0) checkFailCount1++;
   6.137 +	  }
   6.138 +	}
   6.139 +	SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_BlitSurface, expected: 0, got: %i", checkFailCount1);
   6.140 +	SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetSurfaceColorMod, expected: 0, got: %i", checkFailCount2);
   6.141 +	SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_SetSurfaceAlphaMod, expected: 0, got: %i", checkFailCount3);
   6.142 +	SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_SetSurfaceBlendMode, expected: 0, got: %i", checkFailCount4);
   6.143 +	
   6.144 +	/* Clean up */
   6.145 +	if (face != NULL) {
   6.146 +		SDL_FreeSurface(face);
   6.147 +		face = NULL;
   6.148 +	}
   6.149 +}
   6.150 +
   6.151 +/* Helper to check that a file exists */
   6.152 +void
   6.153 +_AssertFileExist(const char *filename)
   6.154 +{
   6.155 +	struct stat st;
   6.156 +	int ret = stat(filename, &st);
   6.157 +
   6.158 +	SDLTest_AssertCheck(ret == 0, "Verify file '%s' exists", filename);
   6.159 +}
   6.160 +
   6.161 +
   6.162 +/* Test case functions */
   6.163 +
   6.164 +/**
   6.165 + * @brief Tests sprite saving and loading
   6.166 + */
   6.167 +int
   6.168 +surface_testSaveLoadBitmap(void *arg)
   6.169 +{
   6.170 +    int ret;
   6.171 +    const char *sampleFilename = "testSaveLoadBitmap.bmp";
   6.172 +    SDL_Surface *face;
   6.173 +    SDL_Surface *rface;
   6.174 +
   6.175 +    /* Create sample surface */
   6.176 +    face = SDLTest_ImageFace();
   6.177 +    SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
   6.178 +    if (face == NULL) return;
   6.179 +
   6.180 +    /* Delete test file; ignore errors */
   6.181 +    unlink(sampleFilename);
   6.182 +
   6.183 +    /* Save a surface */
   6.184 +    ret = SDL_SaveBMP(face, sampleFilename);
   6.185 +    SDLTest_AssertPass("Call to SDL_SaveBMP()");
   6.186 +    SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SaveBMP, expected: 0, got: %i", ret); 
   6.187 +    _AssertFileExist(sampleFilename);
   6.188 +    	
   6.189 +    /* Load a surface */
   6.190 +    rface = SDL_LoadBMP(sampleFilename);
   6.191 +    SDLTest_AssertPass("Call to SDL_LoadBMP()");
   6.192 +    SDLTest_AssertCheck(rface != NULL, "Verify result from SDL_LoadBMP is not NULL");
   6.193 +    if (rface != NULL) {
   6.194 +	    SDLTest_AssertCheck(face->w == rface->w, "Verify width of loaded surface, expected: %i, got: %i", face->w, rface->w);
   6.195 +	    SDLTest_AssertCheck(face->h == rface->h, "Verify height of loaded surface, expected: %i, got: %i", face->h, rface->h);
   6.196 +    }
   6.197 +
   6.198 +    /* Delete test file; ignore errors */
   6.199 +    unlink(sampleFilename);
   6.200 +
   6.201 +    /* Clean up */
   6.202 +    if (face != NULL) {
   6.203 +	SDL_FreeSurface(face);
   6.204 +	face = NULL;
   6.205 +    }
   6.206 +    if (rface != NULL) {
   6.207 +	SDL_FreeSurface(rface);
   6.208 +	rface = NULL;
   6.209 +    }
   6.210 +    
   6.211 +    return TEST_COMPLETED;
   6.212 +}
   6.213 +
   6.214 +/*!
   6.215 + *  Tests surface conversion.
   6.216 + */
   6.217 +int
   6.218 +surface_testSurfaceConversion(void *arg)
   6.219 +{
   6.220 +	SDL_Surface *rface = NULL, *face = NULL;
   6.221 +	int ret = 0;
   6.222 +
   6.223 +	/* Create sample surface */
   6.224 +	face = SDLTest_ImageFace();
   6.225 +	SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
   6.226 +	if (face == NULL) 
   6.227 +		return TEST_ABORTED;
   6.228 +
   6.229 +	/* Set transparent pixel as the pixel at (0,0) */
   6.230 +	if (face->format->palette) {
   6.231 +	   ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *) face->pixels);
   6.232 +	   SDLTest_AssertPass("Call to SDL_SetColorKey()");
   6.233 +	   SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
   6.234 +	}
   6.235 +
   6.236 +	/* Convert to 32 bit to compare. */
   6.237 +	rface = SDL_ConvertSurface( face, testsurface->format, 0 );
   6.238 +	SDLTest_AssertPass("Call to SDL_ConvertSurface()");
   6.239 +	SDLTest_AssertCheck(rface != NULL, "Verify result from SDL_ConvertSurface is not NULL");
   6.240 +
   6.241 +	/* Compare surface. */
   6.242 +	ret = SDLTest_CompareSurfaces( rface, face, 0 );
   6.243 +	SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   6.244 +	
   6.245 +	/* Clean up. */
   6.246 +	if (face != NULL) {
   6.247 +		SDL_FreeSurface( face );
   6.248 +		face = NULL;
   6.249 +	}
   6.250 +	if (rface != NULL) {
   6.251 +		SDL_FreeSurface( rface );
   6.252 +		rface = NULL;
   6.253 +	}	
   6.254 +
   6.255 +	return TEST_COMPLETED;
   6.256 +}
   6.257 +
   6.258 +
   6.259 +/**
   6.260 + * @brief Tests sprite loading. A failure case.
   6.261 + */
   6.262 +int
   6.263 +surface_testLoadFailure(void *arg)
   6.264 +{
   6.265 +	SDL_Surface *face = SDL_LoadBMP("nonexistant.bmp");
   6.266 +	SDLTest_AssertCheck(face == NULL, "SDL_CreateLoadBmp");
   6.267 +
   6.268 +	return TEST_COMPLETED;
   6.269 +}
   6.270 +
   6.271 +/**
   6.272 + * @brief Tests some blitting routines.
   6.273 + */
   6.274 +int
   6.275 +surface_testBlit(void *arg)
   6.276 +{
   6.277 +   int ret;
   6.278 +   SDL_Surface *referenceSurface;
   6.279 +
   6.280 +   /* Basic blitting */ 
   6.281 +   _testBlitBlendMode(-1);
   6.282 +   
   6.283 +   /* Verify result by comparing surfaces */
   6.284 +   referenceSurface = SDLTest_ImageBlit();
   6.285 +   ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 );
   6.286 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   6.287 +   
   6.288 +   /* Clean up. */
   6.289 +   if (referenceSurface != NULL) {   
   6.290 +   	SDL_FreeSurface( referenceSurface );
   6.291 +   }
   6.292 +
   6.293 +   return TEST_COMPLETED;
   6.294 +}
   6.295 +
   6.296 +/**
   6.297 + * @brief Tests some blitting routines with color mod
   6.298 + */
   6.299 +int
   6.300 +surface_testBlitColorMod(void *arg)
   6.301 +{
   6.302 +   int ret;
   6.303 +   SDL_Surface *referenceSurface;
   6.304 +
   6.305 +   /* Basic blitting with color mod */ 
   6.306 +   _testBlitBlendMode(-2);
   6.307 +   
   6.308 +   /* Verify result by comparing surfaces */
   6.309 +   referenceSurface = SDLTest_ImageBlitColor();
   6.310 +   ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 );
   6.311 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   6.312 +   
   6.313 +   /* Clean up. */
   6.314 +   if (referenceSurface != NULL) {   
   6.315 +   	SDL_FreeSurface( referenceSurface );
   6.316 +   }
   6.317 +
   6.318 +   return TEST_COMPLETED;
   6.319 +}
   6.320 +
   6.321 +/**
   6.322 + * @brief Tests some blitting routines with alpha mod
   6.323 + */
   6.324 +int
   6.325 +surface_testBlitAlphaMod(void *arg)
   6.326 +{
   6.327 +   int ret;
   6.328 +   SDL_Surface *referenceSurface;
   6.329 +
   6.330 +   /* Basic blitting with alpha mod */ 
   6.331 +   _testBlitBlendMode(-3);
   6.332 +   
   6.333 +   /* Verify result by comparing surfaces */
   6.334 +   referenceSurface = SDLTest_ImageBlitAlpha();
   6.335 +   ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 );
   6.336 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   6.337 +   
   6.338 +   /* Clean up. */
   6.339 +   if (referenceSurface != NULL) {   
   6.340 +   	SDL_FreeSurface( referenceSurface );
   6.341 +   }
   6.342 +
   6.343 +   return TEST_COMPLETED;
   6.344 +}
   6.345 +
   6.346 +
   6.347 +/**
   6.348 + * @brief Tests some more blitting routines.
   6.349 + */
   6.350 +int
   6.351 +surface_testBlitBlendNone(void *arg)
   6.352 +{
   6.353 +   int ret;
   6.354 +   SDL_Surface *referenceSurface;
   6.355 +
   6.356 +   /* Basic blitting */ 
   6.357 +   _testBlitBlendMode(SDL_BLENDMODE_NONE);
   6.358 +   
   6.359 +   /* Verify result by comparing surfaces */
   6.360 +   referenceSurface = SDLTest_ImageBlitBlendNone();
   6.361 +   ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 );
   6.362 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   6.363 +   
   6.364 +   /* Clean up. */
   6.365 +   if (referenceSurface != NULL) {   
   6.366 +   	SDL_FreeSurface( referenceSurface );
   6.367 +   }
   6.368 +
   6.369 +   return TEST_COMPLETED;
   6.370 +}
   6.371 +
   6.372 +/**
   6.373 + * @brief Tests some more blitting routines.
   6.374 + */
   6.375 +int
   6.376 +surface_testBlitBlendBlend(void *arg)
   6.377 +{
   6.378 +   int ret;
   6.379 +   SDL_Surface *referenceSurface;
   6.380 +
   6.381 +   /* Blend blitting */ 
   6.382 +   _testBlitBlendMode(SDL_BLENDMODE_BLEND);
   6.383 +   
   6.384 +   /* Verify result by comparing surfaces */
   6.385 +   referenceSurface = SDLTest_ImageBlitBlend();
   6.386 +   ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 );
   6.387 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   6.388 +   
   6.389 +   /* Clean up. */
   6.390 +   if (referenceSurface != NULL) {   
   6.391 +   	SDL_FreeSurface( referenceSurface );
   6.392 +   }
   6.393 +
   6.394 +   return TEST_COMPLETED;
   6.395 +}
   6.396 +
   6.397 +/**
   6.398 + * @brief Tests some more blitting routines.
   6.399 + */
   6.400 +int
   6.401 +surface_testBlitBlendAdd(void *arg)
   6.402 +{
   6.403 +   int ret;
   6.404 +   SDL_Surface *referenceSurface;
   6.405 +
   6.406 +   /* Add blitting */ 
   6.407 +   _testBlitBlendMode(SDL_BLENDMODE_ADD);
   6.408 +   
   6.409 +   /* Verify result by comparing surfaces */
   6.410 +   referenceSurface = SDLTest_ImageBlitBlendAdd();
   6.411 +   ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 );
   6.412 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   6.413 +   
   6.414 +   /* Clean up. */
   6.415 +   if (referenceSurface != NULL) {   
   6.416 +   	SDL_FreeSurface( referenceSurface );
   6.417 +   }
   6.418 +
   6.419 +   return TEST_COMPLETED;
   6.420 +}
   6.421 +
   6.422 +/**
   6.423 + * @brief Tests some more blitting routines.
   6.424 + */
   6.425 +int
   6.426 +surface_testBlitBlendMod(void *arg)
   6.427 +{
   6.428 +   int ret;
   6.429 +   SDL_Surface *referenceSurface;
   6.430 +
   6.431 +   /* Mod blitting */ 
   6.432 +   _testBlitBlendMode(SDL_BLENDMODE_MOD);
   6.433 +   
   6.434 +   /* Verify result by comparing surfaces */
   6.435 +   referenceSurface = SDLTest_ImageBlitBlendMod();
   6.436 +   ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 );
   6.437 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   6.438 +   
   6.439 +   /* Clean up. */
   6.440 +   if (referenceSurface != NULL) {   
   6.441 +   	SDL_FreeSurface( referenceSurface );
   6.442 +   }
   6.443 +
   6.444 +   return TEST_COMPLETED;
   6.445 +}
   6.446 +
   6.447 +/**
   6.448 + * @brief Tests some more blitting routines with loop
   6.449 + */
   6.450 +int
   6.451 +surface_testBlitBlendLoop(void *arg) {
   6.452 +
   6.453 +   int ret;
   6.454 +   SDL_Surface *referenceSurface;
   6.455 +
   6.456 +   /* All blitting */ 
   6.457 +   _testBlitBlendMode(-4);
   6.458 +   
   6.459 +   /* Verify result by comparing surfaces */
   6.460 +   referenceSurface = SDLTest_ImageBlitBlendAll();
   6.461 +   ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 );
   6.462 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   6.463 +   
   6.464 +   /* Clean up. */
   6.465 +   if (referenceSurface != NULL) {   
   6.466 +   	SDL_FreeSurface( referenceSurface );
   6.467 +   }
   6.468 +
   6.469 +   return TEST_COMPLETED;
   6.470 +
   6.471 +}
   6.472 +
   6.473 +/* ================= Test References ================== */
   6.474 +
   6.475 +/* Surface test cases */
   6.476 +static const SDLTest_TestCaseReference surfaceTest1 =
   6.477 +		{ (SDLTest_TestCaseFp)surface_testSaveLoadBitmap, "surface_testSaveLoadBitmap", "Tests sprite saving and loading.", TEST_ENABLED};
   6.478 +
   6.479 +static const SDLTest_TestCaseReference surfaceTest2 =
   6.480 +		{ (SDLTest_TestCaseFp)surface_testBlit, "surface_testBlit", "Tests basic blitting.", TEST_ENABLED};
   6.481 +
   6.482 +static const SDLTest_TestCaseReference surfaceTest3 =
   6.483 +		{ (SDLTest_TestCaseFp)surface_testBlitBlendNone, "surface_testBlitBlendNone", "Tests blitting routines with none blending mode.", TEST_ENABLED};
   6.484 +
   6.485 +static const SDLTest_TestCaseReference surfaceTest4 =
   6.486 +		{ (SDLTest_TestCaseFp)surface_testLoadFailure, "surface_testLoadFailure", "Tests sprite loading. A failure case.", TEST_ENABLED};
   6.487 +
   6.488 +static const SDLTest_TestCaseReference surfaceTest5 =
   6.489 +		{ (SDLTest_TestCaseFp)surface_testSurfaceConversion, "surface_testSurfaceConversion", "Tests surface conversion.", TEST_ENABLED};
   6.490 +
   6.491 +static const SDLTest_TestCaseReference surfaceTest6 =
   6.492 +		{ (SDLTest_TestCaseFp)surface_testBlitColorMod, "surface_testBlitColorMod", "Tests some blitting routines with color mod.", TEST_ENABLED};
   6.493 +
   6.494 +static const SDLTest_TestCaseReference surfaceTest7 =
   6.495 +		{ (SDLTest_TestCaseFp)surface_testBlitAlphaMod, "surface_testBlitAlphaMod", "Tests some blitting routines with alpha mod.", TEST_ENABLED};
   6.496 +
   6.497 +static const SDLTest_TestCaseReference surfaceTest8 =
   6.498 +		{ (SDLTest_TestCaseFp)surface_testBlitBlendLoop, "surface_testBlitBlendLoop", "Test blittin routines with verious blending modes", TEST_ENABLED};
   6.499 +
   6.500 +static const SDLTest_TestCaseReference surfaceTest9 =
   6.501 +		{ (SDLTest_TestCaseFp)surface_testBlitBlendBlend, "surface_testBlitBlendBlend", "Tests blitting routines with blend blending mode.", TEST_ENABLED};
   6.502 +
   6.503 +static const SDLTest_TestCaseReference surfaceTest10 =
   6.504 +		{ (SDLTest_TestCaseFp)surface_testBlitBlendAdd, "surface_testBlitBlendAdd", "Tests blitting routines with add blending mode.", TEST_ENABLED};
   6.505 +
   6.506 +static const SDLTest_TestCaseReference surfaceTest11 =
   6.507 +		{ (SDLTest_TestCaseFp)surface_testBlitBlendMod, "surface_testBlitBlendMod", "Tests blitting routines with mod blending mode.", TEST_ENABLED};
   6.508 +
   6.509 +/* Sequence of Surface test cases */
   6.510 +static const SDLTest_TestCaseReference *surfaceTests[] =  {
   6.511 +	&surfaceTest1, &surfaceTest2, &surfaceTest3, &surfaceTest4, &surfaceTest5,
   6.512 +	&surfaceTest6, &surfaceTest7, &surfaceTest8, &surfaceTest9, &surfaceTest10, &surfaceTest11, NULL
   6.513 +};
   6.514 +
   6.515 +/* Surface test suite (global) */
   6.516 +SDLTest_TestSuiteReference surfaceTestSuite = {
   6.517 +	"Surface",
   6.518 +	_surfaceSetUp,
   6.519 +	surfaceTests,
   6.520 +	_surfaceTearDown
   6.521 +
   6.522 +};