cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

testautomation_surface.c (20597B)


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