Home | History | Annotate | Download | only in test
      1 /**
      2  * Original code: automated SDL surface test written by Edgar Simo "bobbens"
      3  * Adapted/rewritten for test lib by Andreas Schiffler
      4  */
      5 
      6 /* Supress C4996 VS compiler warnings for unlink() */
      7 #define _CRT_SECURE_NO_DEPRECATE
      8 #define _CRT_NONSTDC_NO_DEPRECATE
      9 
     10 #include <stdio.h>
     11 #include <sys/stat.h>
     12 
     13 #include "SDL.h"
     14 #include "SDL_test.h"
     15 
     16 /* ================= Test Case Implementation ================== */
     17 
     18 /* Shared test surface */
     19 
     20 static SDL_Surface *referenceSurface = NULL;
     21 static SDL_Surface *testSurface = NULL;
     22 
     23 /* Helper functions for the test cases */
     24 
     25 #define TEST_SURFACE_WIDTH testSurface->w
     26 #define TEST_SURFACE_HEIGHT testSurface->h
     27 
     28 /* Fixture */
     29 
     30 /* Create a 32-bit writable surface for blitting tests */
     31 void
     32 _surfaceSetUp(void *arg)
     33 {
     34     int result;
     35     SDL_BlendMode blendMode = SDL_BLENDMODE_NONE;
     36     SDL_BlendMode currentBlendMode;
     37     Uint32 rmask, gmask, bmask, amask;
     38 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
     39     rmask = 0xff000000;
     40     gmask = 0x00ff0000;
     41     bmask = 0x0000ff00;
     42     amask = 0x000000ff;
     43 #else
     44     rmask = 0x000000ff;
     45     gmask = 0x0000ff00;
     46     bmask = 0x00ff0000;
     47     amask = 0xff000000;
     48 #endif
     49 
     50     referenceSurface = SDLTest_ImageBlit(); /* For size info */
     51     testSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, referenceSurface->w, referenceSurface->h, 32, rmask, gmask, bmask, amask);
     52     SDLTest_AssertCheck(testSurface != NULL, "Check that testSurface is not NULL");
     53     if (testSurface != NULL) {
     54       /* Disable blend mode for target surface */
     55       result = SDL_SetSurfaceBlendMode(testSurface, blendMode);
     56       SDLTest_AssertCheck(result == 0, "Validate result from SDL_SetSurfaceBlendMode, expected: 0, got: %i", result);
     57       result = SDL_GetSurfaceBlendMode(testSurface, &currentBlendMode);
     58       SDLTest_AssertCheck(result == 0, "Validate result from SDL_GetSurfaceBlendMode, expected: 0, got: %i", result);
     59       SDLTest_AssertCheck(currentBlendMode == blendMode, "Validate blendMode, expected: %i, got: %i", blendMode, currentBlendMode);
     60     }
     61 }
     62 
     63 void
     64 _surfaceTearDown(void *arg)
     65 {
     66     SDL_FreeSurface(referenceSurface);
     67     referenceSurface = NULL;
     68     SDL_FreeSurface(testSurface);
     69     testSurface = NULL;
     70 }
     71 
     72 /**
     73  * Helper that clears the test surface
     74  */
     75 void _clearTestSurface()
     76 {
     77     int ret;
     78     Uint32 color;
     79 
     80     /* Clear surface. */
     81     color = SDL_MapRGBA( testSurface->format, 0, 0, 0, 0);
     82     SDLTest_AssertPass("Call to SDL_MapRGBA()");
     83     ret = SDL_FillRect( testSurface, NULL, color);
     84     SDLTest_AssertPass("Call to SDL_FillRect()");
     85     SDLTest_AssertCheck(ret == 0, "Verify result from SDL_FillRect, expected: 0, got: %i", ret);
     86 }
     87 
     88 /**
     89  * 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.
     90  */
     91 void _testBlitBlendMode(int mode)
     92 {
     93     int ret;
     94     int i, j, ni, nj;
     95     SDL_Surface *face;
     96     SDL_Rect rect;
     97     int nmode;
     98     SDL_BlendMode bmode;
     99     int checkFailCount1;
    100     int checkFailCount2;
    101     int checkFailCount3;
    102     int checkFailCount4;
    103 
    104     /* Check test surface */
    105     SDLTest_AssertCheck(testSurface != NULL, "Verify testSurface is not NULL");
    106     if (testSurface == NULL) return;
    107 
    108     /* Create sample surface */
    109     face = SDLTest_ImageFace();
    110     SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
    111     if (face == NULL) return;
    112 
    113         /* Reset alpha modulation */
    114     ret = SDL_SetSurfaceAlphaMod(face, 255);
    115     SDLTest_AssertPass("Call to SDL_SetSurfaceAlphaMod()");
    116     SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceAlphaMod(), expected: 0, got: %i", ret);
    117 
    118         /* Reset color modulation */
    119     ret = SDL_SetSurfaceColorMod(face, 255, 255, 255);
    120     SDLTest_AssertPass("Call to SDL_SetSurfaceColorMod()");
    121     SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceColorMod(), expected: 0, got: %i", ret);
    122 
    123         /* Reset color key */
    124     ret = SDL_SetColorKey(face, SDL_FALSE, 0);
    125     SDLTest_AssertPass("Call to SDL_SetColorKey()");
    126     SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey(), expected: 0, got: %i", ret);
    127 
    128     /* Clear the test surface */
    129         _clearTestSurface();
    130 
    131     /* Target rect size */
    132     rect.w = face->w;
    133     rect.h = face->h;
    134 
    135     /* Steps to take */
    136     ni = testSurface->w - face->w;
    137     nj = testSurface->h - face->h;
    138 
    139     /* Optionally set blend mode. */
    140     if (mode >= 0) {
    141         ret = SDL_SetSurfaceBlendMode( face, (SDL_BlendMode)mode );
    142         SDLTest_AssertPass("Call to SDL_SetSurfaceBlendMode()");
    143         SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceBlendMode(..., %i), expected: 0, got: %i", mode, ret);
    144     }
    145 
    146     /* Test blend mode. */
    147     checkFailCount1 = 0;
    148     checkFailCount2 = 0;
    149     checkFailCount3 = 0;
    150     checkFailCount4 = 0;
    151     for (j=0; j <= nj; j+=4) {
    152       for (i=0; i <= ni; i+=4) {
    153         if (mode == -2) {
    154             /* Set color mod. */
    155             ret = SDL_SetSurfaceColorMod( face, (255/nj)*j, (255/ni)*i, (255/nj)*j );
    156             if (ret != 0) checkFailCount2++;
    157         }
    158         else if (mode == -3) {
    159             /* Set alpha mod. */
    160             ret = SDL_SetSurfaceAlphaMod( face, (255/ni)*i );
    161             if (ret != 0) checkFailCount3++;
    162         }
    163         else if (mode == -4) {
    164             /* Crazy blending mode magic. */
    165             nmode = (i/4*j/4) % 4;
    166             if (nmode==0) {
    167                 bmode = SDL_BLENDMODE_NONE;
    168             } else if (nmode==1) {
    169                 bmode = SDL_BLENDMODE_BLEND;
    170             } else if (nmode==2) {
    171                 bmode = SDL_BLENDMODE_ADD;
    172             } else if (nmode==3) {
    173                 bmode = SDL_BLENDMODE_MOD;
    174             }
    175             ret = SDL_SetSurfaceBlendMode( face, bmode );
    176             if (ret != 0) checkFailCount4++;
    177         }
    178 
    179          /* Blitting. */
    180          rect.x = i;
    181          rect.y = j;
    182          ret = SDL_BlitSurface( face, NULL, testSurface, &rect );
    183          if (ret != 0) checkFailCount1++;
    184       }
    185     }
    186     SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_BlitSurface, expected: 0, got: %i", checkFailCount1);
    187     SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetSurfaceColorMod, expected: 0, got: %i", checkFailCount2);
    188     SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_SetSurfaceAlphaMod, expected: 0, got: %i", checkFailCount3);
    189     SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_SetSurfaceBlendMode, expected: 0, got: %i", checkFailCount4);
    190 
    191     /* Clean up */
    192     SDL_FreeSurface(face);
    193     face = NULL;
    194 }
    195 
    196 /* Helper to check that a file exists */
    197 void
    198 _AssertFileExist(const char *filename)
    199 {
    200     struct stat st;
    201     int ret = stat(filename, &st);
    202 
    203     SDLTest_AssertCheck(ret == 0, "Verify file '%s' exists", filename);
    204 }
    205 
    206 
    207 /* Test case functions */
    208 
    209 /**
    210  * @brief Tests sprite saving and loading
    211  */
    212 int
    213 surface_testSaveLoadBitmap(void *arg)
    214 {
    215     int ret;
    216     const char *sampleFilename = "testSaveLoadBitmap.bmp";
    217     SDL_Surface *face;
    218     SDL_Surface *rface;
    219 
    220     /* Create sample surface */
    221     face = SDLTest_ImageFace();
    222     SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
    223     if (face == NULL) return TEST_ABORTED;
    224 
    225     /* Delete test file; ignore errors */
    226     unlink(sampleFilename);
    227 
    228     /* Save a surface */
    229     ret = SDL_SaveBMP(face, sampleFilename);
    230     SDLTest_AssertPass("Call to SDL_SaveBMP()");
    231     SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SaveBMP, expected: 0, got: %i", ret);
    232     _AssertFileExist(sampleFilename);
    233 
    234     /* Load a surface */
    235     rface = SDL_LoadBMP(sampleFilename);
    236     SDLTest_AssertPass("Call to SDL_LoadBMP()");
    237     SDLTest_AssertCheck(rface != NULL, "Verify result from SDL_LoadBMP is not NULL");
    238     if (rface != NULL) {
    239         SDLTest_AssertCheck(face->w == rface->w, "Verify width of loaded surface, expected: %i, got: %i", face->w, rface->w);
    240         SDLTest_AssertCheck(face->h == rface->h, "Verify height of loaded surface, expected: %i, got: %i", face->h, rface->h);
    241     }
    242 
    243     /* Delete test file; ignore errors */
    244     unlink(sampleFilename);
    245 
    246     /* Clean up */
    247     SDL_FreeSurface(face);
    248     face = NULL;
    249     SDL_FreeSurface(rface);
    250     rface = NULL;
    251 
    252     return TEST_COMPLETED;
    253 }
    254 
    255 /* !
    256  *  Tests surface conversion.
    257  */
    258 int
    259 surface_testSurfaceConversion(void *arg)
    260 {
    261     SDL_Surface *rface = NULL, *face = NULL;
    262     int ret = 0;
    263 
    264     /* Create sample surface */
    265     face = SDLTest_ImageFace();
    266     SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
    267     if (face == NULL)
    268         return TEST_ABORTED;
    269 
    270     /* Set transparent pixel as the pixel at (0,0) */
    271     if (face->format->palette) {
    272        ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *) face->pixels);
    273        SDLTest_AssertPass("Call to SDL_SetColorKey()");
    274        SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
    275     }
    276 
    277     /* Convert to 32 bit to compare. */
    278     rface = SDL_ConvertSurface( face, testSurface->format, 0 );
    279     SDLTest_AssertPass("Call to SDL_ConvertSurface()");
    280     SDLTest_AssertCheck(rface != NULL, "Verify result from SDL_ConvertSurface is not NULL");
    281 
    282     /* Compare surface. */
    283     ret = SDLTest_CompareSurfaces( rface, face, 0 );
    284     SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    285 
    286     /* Clean up. */
    287     SDL_FreeSurface(face);
    288     face = NULL;
    289     SDL_FreeSurface(rface);
    290     rface = NULL;
    291 
    292     return TEST_COMPLETED;
    293 }
    294 
    295 
    296 /* !
    297  *  Tests surface conversion across all pixel formats.
    298  */
    299 int
    300 surface_testCompleteSurfaceConversion(void *arg)
    301 {
    302     Uint32 pixel_formats[] = {
    303         SDL_PIXELFORMAT_INDEX8,
    304         SDL_PIXELFORMAT_RGB332,
    305         SDL_PIXELFORMAT_RGB444,
    306         SDL_PIXELFORMAT_RGB555,
    307         SDL_PIXELFORMAT_BGR555,
    308         SDL_PIXELFORMAT_ARGB4444,
    309         SDL_PIXELFORMAT_RGBA4444,
    310         SDL_PIXELFORMAT_ABGR4444,
    311         SDL_PIXELFORMAT_BGRA4444,
    312         SDL_PIXELFORMAT_ARGB1555,
    313         SDL_PIXELFORMAT_RGBA5551,
    314         SDL_PIXELFORMAT_ABGR1555,
    315         SDL_PIXELFORMAT_BGRA5551,
    316         SDL_PIXELFORMAT_RGB565,
    317         SDL_PIXELFORMAT_BGR565,
    318         SDL_PIXELFORMAT_RGB24,
    319         SDL_PIXELFORMAT_BGR24,
    320         SDL_PIXELFORMAT_RGB888,
    321         SDL_PIXELFORMAT_RGBX8888,
    322         SDL_PIXELFORMAT_BGR888,
    323         SDL_PIXELFORMAT_BGRX8888,
    324         SDL_PIXELFORMAT_ARGB8888,
    325         SDL_PIXELFORMAT_RGBA8888,
    326         SDL_PIXELFORMAT_ABGR8888,
    327         SDL_PIXELFORMAT_BGRA8888,
    328         SDL_PIXELFORMAT_ARGB2101010,
    329     };
    330     SDL_Surface *face = NULL, *cvt1, *cvt2, *final;
    331     SDL_PixelFormat *fmt1, *fmt2;
    332     int i, j, ret = 0;
    333 
    334     /* Create sample surface */
    335     face = SDLTest_ImageFace();
    336     SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
    337     if (face == NULL)
    338         return TEST_ABORTED;
    339 
    340     /* Set transparent pixel as the pixel at (0,0) */
    341     if (face->format->palette) {
    342        ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *) face->pixels);
    343        SDLTest_AssertPass("Call to SDL_SetColorKey()");
    344        SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
    345     }
    346 
    347     for ( i = 0; i < SDL_arraysize(pixel_formats); ++i ) {
    348         for ( j = 0; j < SDL_arraysize(pixel_formats); ++j ) {
    349             fmt1 = SDL_AllocFormat(pixel_formats[i]);
    350             SDL_assert(fmt1 != NULL);
    351             cvt1 = SDL_ConvertSurface(face, fmt1, 0);
    352             SDL_assert(cvt1 != NULL);
    353 
    354             fmt2 = SDL_AllocFormat(pixel_formats[j]);
    355             SDL_assert(fmt1 != NULL);
    356             cvt2 = SDL_ConvertSurface(cvt1, fmt2, 0);
    357             SDL_assert(cvt2 != NULL);
    358 
    359             if ( fmt1->BytesPerPixel == face->format->BytesPerPixel &&
    360                  fmt2->BytesPerPixel == face->format->BytesPerPixel &&
    361                  (fmt1->Amask != 0) == (face->format->Amask != 0) &&
    362                  (fmt2->Amask != 0) == (face->format->Amask != 0) ) {
    363                 final = SDL_ConvertSurface( cvt2, face->format, 0 );
    364                 SDL_assert(final != NULL);
    365 
    366                 /* Compare surface. */
    367                 ret = SDLTest_CompareSurfaces( face, final, 0 );
    368                 SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    369                 SDL_FreeSurface(final);
    370             }
    371 
    372             SDL_FreeSurface(cvt1);
    373             SDL_FreeFormat(fmt1);
    374             SDL_FreeSurface(cvt2);
    375             SDL_FreeFormat(fmt2);
    376         }
    377     }
    378 
    379     /* Clean up. */
    380     SDL_FreeSurface( face );
    381 
    382     return TEST_COMPLETED;
    383 }
    384 
    385 
    386 /**
    387  * @brief Tests sprite loading. A failure case.
    388  */
    389 int
    390 surface_testLoadFailure(void *arg)
    391 {
    392     SDL_Surface *face = SDL_LoadBMP("nonexistant.bmp");
    393     SDLTest_AssertCheck(face == NULL, "SDL_CreateLoadBmp");
    394 
    395     return TEST_COMPLETED;
    396 }
    397 
    398 /**
    399  * @brief Tests some blitting routines.
    400  */
    401 int
    402 surface_testBlit(void *arg)
    403 {
    404    int ret;
    405    SDL_Surface *compareSurface;
    406 
    407    /* Basic blitting */
    408    _testBlitBlendMode(-1);
    409 
    410    /* Verify result by comparing surfaces */
    411    compareSurface = SDLTest_ImageBlit();
    412    ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
    413    SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    414 
    415    /* Clean up. */
    416    SDL_FreeSurface(compareSurface);
    417 
    418    return TEST_COMPLETED;
    419 }
    420 
    421 /**
    422  * @brief Tests some blitting routines with color mod
    423  */
    424 int
    425 surface_testBlitColorMod(void *arg)
    426 {
    427    int ret;
    428    SDL_Surface *compareSurface;
    429 
    430    /* Basic blitting with color mod */
    431    _testBlitBlendMode(-2);
    432 
    433    /* Verify result by comparing surfaces */
    434    compareSurface = SDLTest_ImageBlitColor();
    435    ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
    436    SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    437 
    438    /* Clean up. */
    439    SDL_FreeSurface(compareSurface);
    440 
    441    return TEST_COMPLETED;
    442 }
    443 
    444 /**
    445  * @brief Tests some blitting routines with alpha mod
    446  */
    447 int
    448 surface_testBlitAlphaMod(void *arg)
    449 {
    450    int ret;
    451    SDL_Surface *compareSurface;
    452 
    453    /* Basic blitting with alpha mod */
    454    _testBlitBlendMode(-3);
    455 
    456    /* Verify result by comparing surfaces */
    457    compareSurface = SDLTest_ImageBlitAlpha();
    458    ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
    459    SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    460 
    461    /* Clean up. */
    462    SDL_FreeSurface(compareSurface);
    463 
    464    return TEST_COMPLETED;
    465 }
    466 
    467 
    468 /**
    469  * @brief Tests some more blitting routines.
    470  */
    471 int
    472 surface_testBlitBlendNone(void *arg)
    473 {
    474    int ret;
    475    SDL_Surface *compareSurface;
    476 
    477    /* Basic blitting */
    478    _testBlitBlendMode(SDL_BLENDMODE_NONE);
    479 
    480    /* Verify result by comparing surfaces */
    481    compareSurface = SDLTest_ImageBlitBlendNone();
    482    ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
    483    SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    484 
    485    /* Clean up. */
    486    SDL_FreeSurface(compareSurface);
    487 
    488    return TEST_COMPLETED;
    489 }
    490 
    491 /**
    492  * @brief Tests some more blitting routines.
    493  */
    494 int
    495 surface_testBlitBlendBlend(void *arg)
    496 {
    497    int ret;
    498    SDL_Surface *compareSurface;
    499 
    500    /* Blend blitting */
    501    _testBlitBlendMode(SDL_BLENDMODE_BLEND);
    502 
    503    /* Verify result by comparing surfaces */
    504    compareSurface = SDLTest_ImageBlitBlend();
    505    ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
    506    SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    507 
    508    /* Clean up. */
    509    SDL_FreeSurface(compareSurface);
    510 
    511    return TEST_COMPLETED;
    512 }
    513 
    514 /**
    515  * @brief Tests some more blitting routines.
    516  */
    517 int
    518 surface_testBlitBlendAdd(void *arg)
    519 {
    520    int ret;
    521    SDL_Surface *compareSurface;
    522 
    523    /* Add blitting */
    524    _testBlitBlendMode(SDL_BLENDMODE_ADD);
    525 
    526    /* Verify result by comparing surfaces */
    527    compareSurface = SDLTest_ImageBlitBlendAdd();
    528    ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
    529    SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    530 
    531    /* Clean up. */
    532    SDL_FreeSurface(compareSurface);
    533 
    534    return TEST_COMPLETED;
    535 }
    536 
    537 /**
    538  * @brief Tests some more blitting routines.
    539  */
    540 int
    541 surface_testBlitBlendMod(void *arg)
    542 {
    543    int ret;
    544    SDL_Surface *compareSurface;
    545 
    546    /* Mod blitting */
    547    _testBlitBlendMode(SDL_BLENDMODE_MOD);
    548 
    549    /* Verify result by comparing surfaces */
    550    compareSurface = SDLTest_ImageBlitBlendMod();
    551    ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
    552    SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    553 
    554    /* Clean up. */
    555    SDL_FreeSurface(compareSurface);
    556 
    557    return TEST_COMPLETED;
    558 }
    559 
    560 /**
    561  * @brief Tests some more blitting routines with loop
    562  */
    563 int
    564 surface_testBlitBlendLoop(void *arg) {
    565 
    566    int ret;
    567    SDL_Surface *compareSurface;
    568 
    569    /* All blitting modes */
    570    _testBlitBlendMode(-4);
    571 
    572    /* Verify result by comparing surfaces */
    573    compareSurface = SDLTest_ImageBlitBlendAll();
    574    ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
    575    SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    576 
    577    /* Clean up. */
    578    SDL_FreeSurface(compareSurface);
    579 
    580    return TEST_COMPLETED;
    581 
    582 }
    583 
    584 /* ================= Test References ================== */
    585 
    586 /* Surface test cases */
    587 static const SDLTest_TestCaseReference surfaceTest1 =
    588         { (SDLTest_TestCaseFp)surface_testSaveLoadBitmap, "surface_testSaveLoadBitmap", "Tests sprite saving and loading.", TEST_ENABLED};
    589 
    590 static const SDLTest_TestCaseReference surfaceTest2 =
    591         { (SDLTest_TestCaseFp)surface_testBlit, "surface_testBlit", "Tests basic blitting.", TEST_ENABLED};
    592 
    593 static const SDLTest_TestCaseReference surfaceTest3 =
    594         { (SDLTest_TestCaseFp)surface_testBlitBlendNone, "surface_testBlitBlendNone", "Tests blitting routines with none blending mode.", TEST_ENABLED};
    595 
    596 static const SDLTest_TestCaseReference surfaceTest4 =
    597         { (SDLTest_TestCaseFp)surface_testLoadFailure, "surface_testLoadFailure", "Tests sprite loading. A failure case.", TEST_ENABLED};
    598 
    599 static const SDLTest_TestCaseReference surfaceTest5 =
    600         { (SDLTest_TestCaseFp)surface_testSurfaceConversion, "surface_testSurfaceConversion", "Tests surface conversion.", TEST_ENABLED};
    601 
    602 static const SDLTest_TestCaseReference surfaceTest6 =
    603         { (SDLTest_TestCaseFp)surface_testCompleteSurfaceConversion, "surface_testCompleteSurfaceConversion", "Tests surface conversion across all pixel formats", TEST_ENABLED};
    604 
    605 static const SDLTest_TestCaseReference surfaceTest7 =
    606         { (SDLTest_TestCaseFp)surface_testBlitColorMod, "surface_testBlitColorMod", "Tests some blitting routines with color mod.", TEST_ENABLED};
    607 
    608 static const SDLTest_TestCaseReference surfaceTest8 =
    609         { (SDLTest_TestCaseFp)surface_testBlitAlphaMod, "surface_testBlitAlphaMod", "Tests some blitting routines with alpha mod.", TEST_ENABLED};
    610 
    611 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
    612 static const SDLTest_TestCaseReference surfaceTest9 =
    613         { (SDLTest_TestCaseFp)surface_testBlitBlendLoop, "surface_testBlitBlendLoop", "Test blittin routines with verious blending modes", TEST_DISABLED};
    614 
    615 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
    616 static const SDLTest_TestCaseReference surfaceTest10 =
    617         { (SDLTest_TestCaseFp)surface_testBlitBlendBlend, "surface_testBlitBlendBlend", "Tests blitting routines with blend blending mode.", TEST_DISABLED};
    618 
    619 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
    620 static const SDLTest_TestCaseReference surfaceTest11 =
    621         { (SDLTest_TestCaseFp)surface_testBlitBlendAdd, "surface_testBlitBlendAdd", "Tests blitting routines with add blending mode.", TEST_DISABLED};
    622 
    623 static const SDLTest_TestCaseReference surfaceTest12 =
    624         { (SDLTest_TestCaseFp)surface_testBlitBlendMod, "surface_testBlitBlendMod", "Tests blitting routines with mod blending mode.", TEST_ENABLED};
    625 
    626 /* Sequence of Surface test cases */
    627 static const SDLTest_TestCaseReference *surfaceTests[] =  {
    628     &surfaceTest1, &surfaceTest2, &surfaceTest3, &surfaceTest4, &surfaceTest5,
    629     &surfaceTest6, &surfaceTest7, &surfaceTest8, &surfaceTest9, &surfaceTest10,
    630     &surfaceTest11, &surfaceTest12, NULL
    631 };
    632 
    633 /* Surface test suite (global) */
    634 SDLTest_TestSuiteReference surfaceTestSuite = {
    635     "Surface",
    636     _surfaceSetUp,
    637     surfaceTests,
    638     _surfaceTearDown
    639 
    640 };
    641