Mercurial > sdl-ios-xcode
comparison test/automated/surface/surface.c @ 3477:2c07bb579922
We want to be strict on software renderer tests and opaque tests, but give a decent margin for blending inaccuracy for the blended tests.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 21 Nov 2009 07:59:19 +0000 |
parents | da53c4046c65 |
children | c32c53fca10d |
comparison
equal
deleted
inserted
replaced
3476:ab99313951cd | 3477:2c07bb579922 |
---|---|
67 if (SDL_ATassert( "SDL_ConvertSurface", rface != NULL)) | 67 if (SDL_ATassert( "SDL_ConvertSurface", rface != NULL)) |
68 return; | 68 return; |
69 | 69 |
70 /* See if it's the same. */ | 70 /* See if it's the same. */ |
71 if (SDL_ATassert( "Primitives output not the same.", | 71 if (SDL_ATassert( "Primitives output not the same.", |
72 surface_compare( rface, &img_face)==0 )) | 72 surface_compare( rface, &img_face, 0 )==0 )) |
73 return; | 73 return; |
74 | 74 |
75 /* Clean up. */ | 75 /* Clean up. */ |
76 SDL_FreeSurface( rface ); | 76 SDL_FreeSurface( rface ); |
77 SDL_FreeSurface( face ); | 77 SDL_FreeSurface( face ); |
157 if (SDL_ATassert( "SDL_DrawLine", ret == 0)) | 157 if (SDL_ATassert( "SDL_DrawLine", ret == 0)) |
158 return; | 158 return; |
159 | 159 |
160 /* See if it's the same. */ | 160 /* See if it's the same. */ |
161 if (SDL_ATassert( "Primitives output not the same.", | 161 if (SDL_ATassert( "Primitives output not the same.", |
162 surface_compare( testsur, &img_primitives )==0 )) | 162 surface_compare( testsur, &img_primitives, 0 )==0 )) |
163 return; | 163 return; |
164 | 164 |
165 SDL_ATend(); | 165 SDL_ATend(); |
166 } | 166 } |
167 | 167 |
239 } | 239 } |
240 } | 240 } |
241 | 241 |
242 /* See if it's the same. */ | 242 /* See if it's the same. */ |
243 if (SDL_ATassert( "Primitives output not the same.", | 243 if (SDL_ATassert( "Primitives output not the same.", |
244 surface_compare( testsur, &img_blend )==0 )) | 244 surface_compare( testsur, &img_blend, 0 )==0 )) |
245 return; | 245 return; |
246 | 246 |
247 SDL_ATend(); | 247 SDL_ATend(); |
248 } | 248 } |
249 | 249 |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
305 /* See if it's the same. */ | 305 /* See if it's the same. */ |
306 if (SDL_ATassert( "Blitting output not the same (normal blit).", | 306 if (SDL_ATassert( "Blitting output not the same (normal blit).", |
307 surface_compare( testsur, &img_blit )==0 )) | 307 surface_compare( testsur, &img_blit, 0 )==0 )) |
308 return; | 308 return; |
309 | 309 |
310 /* Clear surface. */ | 310 /* Clear surface. */ |
311 ret = SDL_FillRect( testsur, NULL, | 311 ret = SDL_FillRect( testsur, NULL, |
312 SDL_MapRGB( testsur->format, 0, 0, 0 ) ); | 312 SDL_MapRGB( testsur->format, 0, 0, 0 ) ); |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 /* See if it's the same. */ | 333 /* See if it's the same. */ |
334 if (SDL_ATassert( "Blitting output not the same (using SDL_SetSurfaceColorMod).", | 334 if (SDL_ATassert( "Blitting output not the same (using SDL_SetSurfaceColorMod).", |
335 surface_compare( testsur, &img_blitColour )==0 )) | 335 surface_compare( testsur, &img_blitColour, 0 )==0 )) |
336 return; | 336 return; |
337 | 337 |
338 /* Clear surface. */ | 338 /* Clear surface. */ |
339 ret = SDL_FillRect( testsur, NULL, | 339 ret = SDL_FillRect( testsur, NULL, |
340 SDL_MapRGB( testsur->format, 0, 0, 0 ) ); | 340 SDL_MapRGB( testsur->format, 0, 0, 0 ) ); |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 /* See if it's the same. */ | 366 /* See if it's the same. */ |
367 if (SDL_ATassert( "Blitting output not the same (using SDL_SetSurfaceAlphaMod).", | 367 if (SDL_ATassert( "Blitting output not the same (using SDL_SetSurfaceAlphaMod).", |
368 surface_compare( testsur, &img_blitAlpha )==0 )) | 368 surface_compare( testsur, &img_blitAlpha, 0 )==0 )) |
369 return; | 369 return; |
370 | 370 |
371 /* Clean up. */ | 371 /* Clean up. */ |
372 SDL_FreeSurface( face ); | 372 SDL_FreeSurface( face ); |
373 | 373 |
471 | 471 |
472 /* Test None. */ | 472 /* Test None. */ |
473 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_NONE )) | 473 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_NONE )) |
474 return; | 474 return; |
475 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_NONE).", | 475 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_NONE).", |
476 surface_compare( testsur, &img_blendNone )==0 )) | 476 surface_compare( testsur, &img_blendNone, 0 )==0 )) |
477 return; | 477 return; |
478 | 478 |
479 /* Test Mask. */ | 479 /* Test Mask. */ |
480 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_MASK )) | 480 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_MASK )) |
481 return; | 481 return; |
482 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_MASK).", | 482 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_MASK).", |
483 surface_compare( testsur, &img_blendMask )==0 )) | 483 surface_compare( testsur, &img_blendMask, 0 )==0 )) |
484 return; | 484 return; |
485 | 485 |
486 /* Test Blend. */ | 486 /* Test Blend. */ |
487 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_BLEND )) | 487 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_BLEND )) |
488 return; | 488 return; |
489 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_BLEND).", | 489 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_BLEND).", |
490 surface_compare( testsur, &img_blendBlend )==0 )) | 490 surface_compare( testsur, &img_blendBlend, 0 )==0 )) |
491 return; | 491 return; |
492 | 492 |
493 /* Test Add. */ | 493 /* Test Add. */ |
494 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_ADD )) | 494 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_ADD )) |
495 return; | 495 return; |
496 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_ADD).", | 496 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_ADD).", |
497 surface_compare( testsur, &img_blendAdd )==0 )) | 497 surface_compare( testsur, &img_blendAdd, 0 )==0 )) |
498 return; | 498 return; |
499 | 499 |
500 /* Test Mod. */ | 500 /* Test Mod. */ |
501 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_MOD )) | 501 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_MOD )) |
502 return; | 502 return; |
503 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_MOD).", | 503 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_MOD).", |
504 surface_compare( testsur, &img_blendMod )==0 )) | 504 surface_compare( testsur, &img_blendMod, 0 )==0 )) |
505 return; | 505 return; |
506 | 506 |
507 /* Clear surface. */ | 507 /* Clear surface. */ |
508 ret = SDL_FillRect( testsur, NULL, | 508 ret = SDL_FillRect( testsur, NULL, |
509 SDL_MapRGB( testsur->format, 0, 0, 0 ) ); | 509 SDL_MapRGB( testsur->format, 0, 0, 0 ) ); |
543 } | 543 } |
544 } | 544 } |
545 | 545 |
546 /* Check to see if matches. */ | 546 /* Check to see if matches. */ |
547 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLEND_*).", | 547 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLEND_*).", |
548 surface_compare( testsur, &img_blendAll )==0 )) | 548 surface_compare( testsur, &img_blendAll, 0 )==0 )) |
549 return; | 549 return; |
550 | 550 |
551 /* Clean up. */ | 551 /* Clean up. */ |
552 SDL_FreeSurface( face ); | 552 SDL_FreeSurface( face ); |
553 | 553 |