Breaking tests in surface to several smaller tests.
authorMarkus Kauppila
Tue, 12 Jul 2011 16:47:50 +0300
changeset 57563581346510f3
parent 5755 35d4ae5dea90
child 5757 a97102f40230
Breaking tests in surface to several smaller tests.
test/test-automation/testdummy/testdummy.c
test/test-automation/testsurface/testsurface.c
     1.1 --- a/test/test-automation/testdummy/testdummy.c	Mon Jul 11 21:09:28 2011 +0300
     1.2 +++ b/test/test-automation/testdummy/testdummy.c	Tue Jul 12 16:47:50 2011 +0300
     1.3 @@ -88,7 +88,7 @@
     1.4  void
     1.5  dummycase1(void *arg)
     1.6  {
     1.7 -	AssertEquals(5, 5, "Assert message");
     1.8 +	//AssertEquals(5, 5, "Assert message");
     1.9  }
    1.10  
    1.11  void
     2.1 --- a/test/test-automation/testsurface/testsurface.c	Mon Jul 11 21:09:28 2011 +0300
     2.2 +++ b/test/test-automation/testsurface/testsurface.c	Tue Jul 12 16:47:50 2011 +0300
     2.3 @@ -8,6 +8,8 @@
     2.4  
     2.5  #include "../SDL_test.h"
     2.6  
     2.7 +#include <sys/stat.h>
     2.8 +
     2.9  /* Test case references */
    2.10  static const TestCaseReference test1 =
    2.11  		(TestCaseReference){ "surface_testLoad", "Tests sprite loading.", TEST_ENABLED, 0, 0};
    2.12 @@ -16,15 +18,36 @@
    2.13  		(TestCaseReference){ "surface_testBlit", "Tests some blitting routines.", TEST_ENABLED, 0, 0};
    2.14  
    2.15  static const TestCaseReference test3 =
    2.16 -		(TestCaseReference){ "surface_testBlitBlend", "Tests some more blitting routines.", TEST_ENABLED, 0, 0};
    2.17 +		(TestCaseReference){ "surface_testBlitBlendNone", "Tests some more blitting routines.", TEST_ENABLED, 0, 0};
    2.18  
    2.19  static const TestCaseReference test4 =
    2.20  		(TestCaseReference){ "surface_testLoadFailure", "Tests sprite loading. A failure case.", TEST_ENABLED, 0, 0};
    2.21  
    2.22 +static const TestCaseReference test5 =
    2.23 +		(TestCaseReference){ "surface_testConversion", "Tests sprite conversion.", TEST_ENABLED, 0, 0};
    2.24 +
    2.25 +static const TestCaseReference test6 =
    2.26 +		(TestCaseReference){ "surface_testBlitColorMod", "Tests some blitting routines with color mod.", TEST_ENABLED, 0, 0};
    2.27 +
    2.28 +static const TestCaseReference test7 =
    2.29 +		(TestCaseReference){ "surface_testBlitAlphaMod", "Tests some blitting routines with alpha mod.", TEST_ENABLED, 0, 0};
    2.30 +
    2.31 +static const TestCaseReference test8 =
    2.32 +		(TestCaseReference){ "surface_testBlitBlendLoop", "Test blittin routines with blending", TEST_ENABLED, 0, 0};
    2.33 +
    2.34 +static const TestCaseReference test9 =
    2.35 +		(TestCaseReference){ "surface_testBlitBlendBlend", "Tests some more blitting routines.", TEST_ENABLED, 0, 0};
    2.36 +
    2.37 +static const TestCaseReference test10 =
    2.38 +		(TestCaseReference){ "surface_testBlitBlendAdd", "Tests some more blitting routines.", TEST_ENABLED, 0, 0};
    2.39 +
    2.40 +static const TestCaseReference test11 =
    2.41 +		(TestCaseReference){ "surface_testBlitBlendMod", "Tests some more blitting routines.", TEST_ENABLED, 0, 0};
    2.42  
    2.43  /* Test suite */
    2.44  extern const TestCaseReference *testSuite[] =  {
    2.45 -	&test1, &test2, &test3, &test4, NULL
    2.46 +	&test1, &test2, &test3, &test4, &test5,
    2.47 +	&test6, &test7, &test8, &test9, &test10, &test11, NULL
    2.48  };
    2.49  
    2.50  
    2.51 @@ -91,6 +114,34 @@
    2.52  	return testsur;
    2.53  }
    2.54  
    2.55 +/*!
    2.56 + * Create test surface from in-memory image
    2.57 + */
    2.58 +SDL_Surface *
    2.59 +_createTestSurfaceFromMemory()
    2.60 +{
    2.61 +	SDL_Surface *face = NULL;
    2.62 +
    2.63 +	/* Create face surface. */
    2.64 +	face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
    2.65 +		  img_face.width, img_face.height, 32, img_face.width*4,
    2.66 +	#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
    2.67 +		  0xff000000, /* Red bit mask. */
    2.68 +		  0x00ff0000, /* Green bit mask. */
    2.69 +		  0x0000ff00, /* Blue bit mask. */
    2.70 +		  0x000000ff /* Alpha bit mask. */
    2.71 +	#else
    2.72 +		  0x000000ff, /* Red bit mask. */
    2.73 +		  0x0000ff00, /* Green bit mask. */
    2.74 +		  0x00ff0000, /* Blue bit mask. */
    2.75 +		  0xff000000 /* Alpha bit mask. */
    2.76 +	#endif
    2.77 +		  );
    2.78 +	AssertTrue(face != NULL, "SDL_CreateRGBSurfaceFrom");
    2.79 +
    2.80 +	return face;
    2.81 +}
    2.82 +
    2.83  /**
    2.84   * @brief Tests a blend mode.
    2.85   */
    2.86 @@ -132,9 +183,18 @@
    2.87  	}
    2.88  }
    2.89  
    2.90 +int
    2.91 +_AssertFileExist(const char *filename)
    2.92 +{
    2.93 +	struct stat st;
    2.94 +	int ret = stat(filename, &st);
    2.95 +
    2.96 +	AssertTrue(ret == 0, "Does file %s exist", filename);
    2.97 +}
    2.98 +
    2.99  /* Test case functions */
   2.100  /**
   2.101 - * @brief Tests sprite loading.
   2.102 + * @brief Tests sprite loading
   2.103   */
   2.104  void surface_testLoad(void *arg)
   2.105  {
   2.106 @@ -142,36 +202,54 @@
   2.107      SDL_Surface *face, *rface;
   2.108  
   2.109      /* Clear surface. */
   2.110 +    /*
   2.111      ret = SDL_FillRect( testsur, NULL,
   2.112           SDL_MapRGB( testsur->format, 0, 0, 0 ) );
   2.113  	AssertTrue(ret == 0,  "SDL_FillRect");
   2.114 +	*/
   2.115  
   2.116     /* Create the blit surface. */
   2.117 -#ifdef __APPLE__
   2.118 -	face = SDL_LoadBMP("icon.bmp");
   2.119 -#else
   2.120 -	face = SDL_LoadBMP("../icon.bmp");
   2.121 -#endif
   2.122 +	const char *filename = "icon.bmp";
   2.123 +	_AssertFileExist(filename);
   2.124  
   2.125 +	face = SDL_LoadBMP(filename);
   2.126  	AssertTrue(face != NULL, "SDL_CreateLoadBmp");
   2.127  
   2.128 -   /* Set transparent pixel as the pixel at (0,0) */
   2.129 -   if (face->format->palette) {
   2.130 -      ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *) face->pixels);
   2.131 -      AssertTrue(ret == 0, "SDL_SetColorKey");
   2.132 -   }
   2.133 +	AssertTrue(face->w == 32, "testing icon width");
   2.134 +	AssertTrue(face->h == 32, "testing icon height");
   2.135 +}
   2.136 +
   2.137 +/*!
   2.138 + *  Tests sprite conversion.
   2.139 + */
   2.140 +void surface_testConversion(void *arg)
   2.141 +{
   2.142 +	SDL_Surface *rface = NULL, *face = NULL;
   2.143 +	int ret = 0;
   2.144 +
   2.145 +	const char *filename = "icon.bmp";
   2.146 +	_AssertFileExist(filename);
   2.147  
   2.148 -   /* Convert to 32 bit to compare. */
   2.149 -   rface = SDL_ConvertSurface( face, testsur->format, 0 );
   2.150 -   AssertTrue(rface != NULL, "SDL_ConvertSurface");
   2.151 +	face = SDL_LoadBMP(filename);
   2.152 +	AssertTrue(face != NULL, "SDL_CreateLoadBmp");
   2.153  
   2.154 -   /* See if it's the same. */
   2.155 -   AssertTrue(surface_compare( rface, &img_face, 0 ) == 0,
   2.156 +	/* Set transparent pixel as the pixel at (0,0) */
   2.157 +	if (face->format->palette) {
   2.158 +	  ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *) face->pixels);
   2.159 +	  AssertTrue(ret == 0, "SDL_SetColorKey");
   2.160 +	}
   2.161 +
   2.162 +	/* Convert to 32 bit to compare. */
   2.163 +	rface = SDL_ConvertSurface( face, testsur->format, 0 );
   2.164 +	AssertTrue(rface != NULL, "SDL_ConvertSurface");
   2.165 +
   2.166 +	/* See if it's the same. */
   2.167 +	AssertTrue(surface_compare( rface, &img_face, 0 ) == 0,
   2.168  		   "Comparing primitives output.");
   2.169  
   2.170 -   /* Clean up. */
   2.171 -   SDL_FreeSurface( rface );
   2.172 -   SDL_FreeSurface( face );
   2.173 +	/* Clean up. */
   2.174 +	SDL_FreeSurface( rface );
   2.175 +	SDL_FreeSurface( face );
   2.176  }
   2.177  
   2.178  
   2.179 @@ -184,7 +262,6 @@
   2.180  	AssertTrue(face == NULL, "SDL_CreateLoadBmp");
   2.181  }
   2.182  
   2.183 -
   2.184  /**
   2.185   * @brief Tests some blitting routines.
   2.186   */
   2.187 @@ -196,27 +273,13 @@
   2.188     int i, j, ni, nj;
   2.189  
   2.190     /* Clear surface. */
   2.191 +
   2.192     ret = SDL_FillRect( testsur, NULL,
   2.193           SDL_MapRGB( testsur->format, 0, 0, 0 ) );
   2.194  
   2.195     AssertTrue(ret == 0, "SDL_FillRect");
   2.196  
   2.197 -   /* Create face surface. */
   2.198 -   face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
   2.199 -         img_face.width, img_face.height, 32, img_face.width*4,
   2.200 -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
   2.201 -         0xff000000, /* Red bit mask. */
   2.202 -         0x00ff0000, /* Green bit mask. */
   2.203 -         0x0000ff00, /* Blue bit mask. */
   2.204 -         0x000000ff /* Alpha bit mask. */
   2.205 -#else
   2.206 -         0x000000ff, /* Red bit mask. */
   2.207 -         0x0000ff00, /* Green bit mask. */
   2.208 -         0x00ff0000, /* Blue bit mask. */
   2.209 -         0xff000000 /* Alpha bit mask. */
   2.210 -#endif
   2.211 -         );
   2.212 -   AssertTrue(face != NULL, "SDL_CreateRGBSurfaceFrom");
   2.213 +   face = _createTestSurfaceFromMemory();
   2.214  
   2.215     /* Constant values. */
   2.216     rect.w = face->w;
   2.217 @@ -241,31 +304,89 @@
   2.218     AssertTrue(surface_compare( testsur, &img_blit, 0 ) == 0,
   2.219  		   "Comparing blitting output (normal blit).");
   2.220  
   2.221 +   /* Clean up. */
   2.222 +   SDL_FreeSurface( face );
   2.223 +}
   2.224 +
   2.225 +/**
   2.226 + * @brief Tests some blitting routines with color mod
   2.227 + */
   2.228 +void surface_testBlitColorMod(void *arg)
   2.229 +{
   2.230 +   int ret;
   2.231 +   SDL_Rect rect;
   2.232 +   SDL_Surface *face;
   2.233 +   int i, j, ni, nj;
   2.234 +
   2.235     /* Clear surface. */
   2.236 +
   2.237     ret = SDL_FillRect( testsur, NULL,
   2.238           SDL_MapRGB( testsur->format, 0, 0, 0 ) );
   2.239 +
   2.240     AssertTrue(ret == 0, "SDL_FillRect");
   2.241  
   2.242 -   /* Test blitting with colour mod. */
   2.243 -   for (j=0; j <= nj; j+=4) {
   2.244 -      for (i=0; i <= ni; i+=4) {
   2.245 -         /* Set colour mod. */
   2.246 -         ret = SDL_SetSurfaceColorMod( face, (255/nj)*j, (255/ni)*i, (255/nj)*j );
   2.247 -         AssertTrue(ret == 0, "SDL_SetSurfaceColorMod");
   2.248 +   face = _createTestSurfaceFromMemory();
   2.249 +
   2.250 +   /* Constant values. */
   2.251 +   rect.w = face->w;
   2.252 +   rect.h = face->h;
   2.253 +   ni     = testsur->w - face->w;
   2.254 +   nj     = testsur->h - face->h;
   2.255 +
   2.256 +   /* Clear surface. */
   2.257 +    ret = SDL_FillRect( testsur, NULL,
   2.258 +          SDL_MapRGB( testsur->format, 0, 0, 0 ) );
   2.259 +    AssertTrue(ret == 0, "SDL_FillRect");
   2.260 +
   2.261 +    /* Test blitting with colour mod. */
   2.262 +    for (j=0; j <= nj; j+=4) {
   2.263 +       for (i=0; i <= ni; i+=4) {
   2.264 +          /* Set colour mod. */
   2.265 +          ret = SDL_SetSurfaceColorMod( face, (255/nj)*j, (255/ni)*i, (255/nj)*j );
   2.266 +          AssertTrue(ret == 0, "SDL_SetSurfaceColorMod");
   2.267 +
   2.268 +          /* Blitting. */
   2.269 +          rect.x = i;
   2.270 +          rect.y = j;
   2.271 +          // TODO Add pixel level validation, SDL_BlitSurface might be no-op
   2.272 +          ret = SDL_BlitSurface( face, NULL, testsur, &rect );
   2.273 +
   2.274 +          AssertTrue(ret == 0, "SDL_BlitSurface");
   2.275 +       }
   2.276 +    }
   2.277  
   2.278 -         /* Blitting. */
   2.279 -         rect.x = i;
   2.280 -         rect.y = j;
   2.281 -         // TODO Add pixel level validation, SDL_BlitSurface might be no-op
   2.282 -         ret = SDL_BlitSurface( face, NULL, testsur, &rect );
   2.283 +    /* See if it's the same. */
   2.284 +    AssertTrue(surface_compare( testsur, &img_blitColour, 0 ) == 0,
   2.285 + 		   "Comparing blitting output (using SDL_SetSurfaceColorMod).");
   2.286 +
   2.287 +   /* Clean up. */
   2.288 +   SDL_FreeSurface( face );
   2.289 +}
   2.290  
   2.291 -         AssertTrue(ret == 0, "SDL_BlitSurface");
   2.292 -      }
   2.293 -   }
   2.294 +/**
   2.295 + * @brief Tests some blitting routines with alpha mod
   2.296 + */
   2.297 +void surface_testBlitAlphaMod(void *arg)
   2.298 +{
   2.299 +   int ret;
   2.300 +   SDL_Rect rect;
   2.301 +   SDL_Surface *face;
   2.302 +   int i, j, ni, nj;
   2.303 +
   2.304 +   /* Clear surface. */
   2.305  
   2.306 -   /* See if it's the same. */
   2.307 -   AssertTrue(surface_compare( testsur, &img_blitColour, 0 ) == 0,
   2.308 -		   "Comparing blitting output (using SDL_SetSurfaceColorMod).");
   2.309 +   ret = SDL_FillRect( testsur, NULL,
   2.310 +         SDL_MapRGB( testsur->format, 0, 0, 0 ) );
   2.311 +
   2.312 +   AssertTrue(ret == 0, "SDL_FillRect");
   2.313 +
   2.314 +   face = _createTestSurfaceFromMemory();
   2.315 +
   2.316 +   /* Constant values. */
   2.317 +   rect.w = face->w;
   2.318 +   rect.h = face->h;
   2.319 +   ni     = testsur->w - face->w;
   2.320 +   nj     = testsur->h - face->h;
   2.321  
   2.322     /* Clear surface. */
   2.323     ret = SDL_FillRect( testsur, NULL,
   2.324 @@ -300,10 +421,11 @@
   2.325     SDL_FreeSurface( face );
   2.326  }
   2.327  
   2.328 +
   2.329  /**
   2.330   * @brief Tests some more blitting routines.
   2.331   */
   2.332 -void surface_testBlitBlend(void *arg)
   2.333 +void surface_testBlitBlendNone(void *arg)
   2.334  {
   2.335     int ret;
   2.336     SDL_Rect rect;
   2.337 @@ -314,25 +436,63 @@
   2.338     /* Clear surface. */
   2.339     ret = SDL_FillRect( testsur, NULL,
   2.340           SDL_MapRGB( testsur->format, 0, 0, 0 ) );
   2.341 -
   2.342     AssertTrue(ret == 0, "SDL_FillRect");
   2.343  
   2.344 -   /* Create the blit surface. */
   2.345 -   face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
   2.346 -         img_face.width, img_face.height, 32, img_face.width*4,
   2.347 -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
   2.348 -         0xff000000, /* Red bit mask. */
   2.349 -         0x00ff0000, /* Green bit mask. */
   2.350 -         0x0000ff00, /* Blue bit mask. */
   2.351 -         0x000000ff /* Alpha bit mask. */
   2.352 -#else
   2.353 -         0x000000ff, /* Red bit mask. */
   2.354 -         0x0000ff00, /* Green bit mask. */
   2.355 -         0x00ff0000, /* Blue bit mask. */
   2.356 -         0xff000000 /* Alpha bit mask. */
   2.357 -#endif
   2.358 -         );
   2.359 -   AssertTrue(face != NULL, "SDL_CreateRGBSurfaceFrom");
   2.360 +   face = _createTestSurfaceFromMemory();
   2.361 +
   2.362 +   /* Set alpha mod. */
   2.363 +   // TODO alpha value could be generated by fuzzer
   2.364 +   ret = SDL_SetSurfaceAlphaMod( face, 100 );
   2.365 +   AssertTrue(ret == 0, "SDL_SetSurfaceAlphaMod");
   2.366 +
   2.367 +   /* Steps to take. */
   2.368 +   ni     = testsur->w - face->w;
   2.369 +   nj     = testsur->h - face->h;
   2.370 +
   2.371 +   AssertTrue(ni != 0, "ni != 0");
   2.372 +   AssertTrue(nj != 0, "nj != 0");
   2.373 +
   2.374 +   /* Constant values. */
   2.375 +   rect.w = face->w;
   2.376 +   rect.h = face->h;
   2.377 +   /* Test None. */
   2.378 +  _testBlitBlendMode( testsur, face, SDL_BLENDMODE_NONE );
   2.379 +   AssertTrue(surface_compare( testsur, &img_blendNone, 0 ) == 0,
   2.380 +   		   "Comparing blitting blending output (using SDL_BLENDMODE_NONE).");
   2.381 +
   2.382 +   /* Test Blend. */
   2.383 +   _testBlitBlendMode( testsur, face, SDL_BLENDMODE_BLEND );
   2.384 +   AssertTrue(surface_compare( testsur, &img_blendBlend, 0 ) == 0,
   2.385 +   		   "Comparing blitting blending output (using SDL_BLENDMODE_BLEND).");
   2.386 +
   2.387 +   /* Test Add. */
   2.388 +   _testBlitBlendMode( testsur, face, SDL_BLENDMODE_ADD );
   2.389 +   AssertTrue(surface_compare( testsur, &img_blendAdd, 0 ) == 0,
   2.390 +   		      "Comparing blitting blending output (using SDL_BLENDMODE_ADD).");
   2.391 +
   2.392 +   /* Test Mod. */
   2.393 +   _testBlitBlendMode( testsur, face, SDL_BLENDMODE_MOD );
   2.394 +   AssertTrue(surface_compare( testsur, &img_blendMod, 0 ) == 0,
   2.395 +   		      "Comparing blitting blending output not the same (using SDL_BLENDMODE_MOD).");
   2.396 +}
   2.397 +
   2.398 +/**
   2.399 + * @brief Tests some more blitting routines.
   2.400 + */
   2.401 +void surface_testBlitBlendBlend(void *arg)
   2.402 +{
   2.403 +   int ret;
   2.404 +   SDL_Rect rect;
   2.405 +   SDL_Surface *face;
   2.406 +   int i, j, ni, nj;
   2.407 +   int mode;
   2.408 +
   2.409 +   /* Clear surface. */
   2.410 +   ret = SDL_FillRect( testsur, NULL,
   2.411 +         SDL_MapRGB( testsur->format, 0, 0, 0 ) );
   2.412 +   AssertTrue(ret == 0, "SDL_FillRect");
   2.413 +
   2.414 +   face = _createTestSurfaceFromMemory();
   2.415  
   2.416     /* Set alpha mod. */
   2.417     // TODO alpha value could be generated by fuzzer
   2.418 @@ -350,26 +510,125 @@
   2.419     rect.w = face->w;
   2.420     rect.h = face->h;
   2.421  
   2.422 -   /* Test None. */
   2.423 -  _testBlitBlendMode( testsur, face, SDL_BLENDMODE_NONE );
   2.424 -
   2.425 -   AssertTrue(surface_compare( testsur, &img_blendNone, 0 ) == 0,
   2.426 -   		   "Comparing blitting blending output (using SDL_BLENDMODE_NONE).");
   2.427 -
   2.428     /* Test Blend. */
   2.429     _testBlitBlendMode( testsur, face, SDL_BLENDMODE_BLEND );
   2.430     AssertTrue(surface_compare( testsur, &img_blendBlend, 0 ) == 0,
   2.431     		   "Comparing blitting blending output (using SDL_BLENDMODE_BLEND).");
   2.432 +}
   2.433 +
   2.434 +/**
   2.435 + * @brief Tests some more blitting routines.
   2.436 + */
   2.437 +void surface_testBlitBlendAdd(void *arg)
   2.438 +{
   2.439 +   int ret;
   2.440 +   SDL_Rect rect;
   2.441 +   SDL_Surface *face;
   2.442 +   int i, j, ni, nj;
   2.443 +   int mode;
   2.444 +
   2.445 +   /* Clear surface. */
   2.446 +   ret = SDL_FillRect( testsur, NULL,
   2.447 +         SDL_MapRGB( testsur->format, 0, 0, 0 ) );
   2.448 +   AssertTrue(ret == 0, "SDL_FillRect");
   2.449 +
   2.450 +   face = _createTestSurfaceFromMemory();
   2.451 +
   2.452 +   /* Set alpha mod. */
   2.453 +   // TODO alpha value could be generated by fuzzer
   2.454 +   ret = SDL_SetSurfaceAlphaMod( face, 100 );
   2.455 +   AssertTrue(ret == 0, "SDL_SetSurfaceAlphaMod");
   2.456 +
   2.457 +   /* Steps to take. */
   2.458 +   ni     = testsur->w - face->w;
   2.459 +   nj     = testsur->h - face->h;
   2.460 +
   2.461 +   AssertTrue(ni != 0, "ni != 0");
   2.462 +   AssertTrue(nj != 0, "nj != 0");
   2.463 +
   2.464 +   /* Constant values. */
   2.465 +   rect.w = face->w;
   2.466 +   rect.h = face->h;
   2.467  
   2.468     /* Test Add. */
   2.469     _testBlitBlendMode( testsur, face, SDL_BLENDMODE_ADD );
   2.470     AssertTrue(surface_compare( testsur, &img_blendAdd, 0 ) == 0,
   2.471     		      "Comparing blitting blending output (using SDL_BLENDMODE_ADD).");
   2.472 +}
   2.473 +
   2.474 +/**
   2.475 + * @brief Tests some more blitting routines.
   2.476 + */
   2.477 +void surface_testBlitBlendMod(void *arg)
   2.478 +{
   2.479 +   int ret;
   2.480 +   SDL_Rect rect;
   2.481 +   SDL_Surface *face;
   2.482 +   int i, j, ni, nj;
   2.483 +   int mode;
   2.484 +
   2.485 +   /* Clear surface. */
   2.486 +   ret = SDL_FillRect( testsur, NULL,
   2.487 +         SDL_MapRGB( testsur->format, 0, 0, 0 ) );
   2.488 +   AssertTrue(ret == 0, "SDL_FillRect");
   2.489 +
   2.490 +   face = _createTestSurfaceFromMemory();
   2.491 +
   2.492 +   /* Set alpha mod. */
   2.493 +   // TODO alpha value could be generated by fuzzer
   2.494 +   ret = SDL_SetSurfaceAlphaMod( face, 100 );
   2.495 +   AssertTrue(ret == 0, "SDL_SetSurfaceAlphaMod");
   2.496 +
   2.497 +   /* Steps to take. */
   2.498 +   ni     = testsur->w - face->w;
   2.499 +   nj     = testsur->h - face->h;
   2.500 +
   2.501 +   AssertTrue(ni != 0, "ni != 0");
   2.502 +   AssertTrue(nj != 0, "nj != 0");
   2.503 +
   2.504 +   /* Constant values. */
   2.505 +   rect.w = face->w;
   2.506 +   rect.h = face->h;
   2.507 +   /* Test None. */
   2.508  
   2.509     /* Test Mod. */
   2.510     _testBlitBlendMode( testsur, face, SDL_BLENDMODE_MOD );
   2.511     AssertTrue(surface_compare( testsur, &img_blendMod, 0 ) == 0,
   2.512 -   		      "Comparing blitting blending output not the same (using SDL_BLENDMODE_MOD).");
   2.513 +   		      "Comparing blitting blending output (using SDL_BLENDMODE_MOD).");
   2.514 +}
   2.515 +
   2.516 +/**
   2.517 + * @brief Tests some more blitting routines with loop
   2.518 + */
   2.519 +void surface_testBlitBlendLoop(void *arg) {
   2.520 +	int ret;
   2.521 +	SDL_Rect rect;
   2.522 +	SDL_Surface *face;
   2.523 +	int i, j, ni, nj;
   2.524 +	int mode;
   2.525 +
   2.526 +	/* Clear surface. */
   2.527 +	ret = SDL_FillRect( testsur, NULL,
   2.528 +		 SDL_MapRGB( testsur->format, 0, 0, 0 ) );
   2.529 +	AssertTrue(ret == 0, "SDL_FillRect");
   2.530 +
   2.531 +	face = _createTestSurfaceFromMemory();
   2.532 +
   2.533 +	/* Set alpha mod. */
   2.534 +	// TODO alpha value could be generated by fuzzer
   2.535 +	ret = SDL_SetSurfaceAlphaMod( face, 100 );
   2.536 +	AssertTrue(ret == 0, "SDL_SetSurfaceAlphaMod");
   2.537 +
   2.538 +	/* Steps to take. */
   2.539 +	ni     = testsur->w - face->w;
   2.540 +	nj     = testsur->h - face->h;
   2.541 +
   2.542 +	AssertTrue(ni != 0, "ni != 0");
   2.543 +	AssertTrue(nj != 0, "nj != 0");
   2.544 +
   2.545 +	/* Constant values. */
   2.546 +	rect.w = face->w;
   2.547 +	rect.h = face->h;
   2.548  
   2.549     /* Clear surface. */
   2.550     ret = SDL_FillRect( testsur, NULL,