test/testautomation_render.c
author Sam Lantinga <slouken@libsdl.org>
Thu, 12 Oct 2017 14:25:07 -0700
changeset 11615 f5b657276413
parent 9254 6c469ea796e4
permissions -rw-r--r--
Fixed bug 3877 - missing SDLCALL in SDLTest_ExampleHitTestCallback

Ozkan Sezer

Following trivial patch adds missing SDLCALL to SDLTest_ExampleHitTestCallback()
     1 /**
     2  * Original code: automated SDL platform test written by Edgar Simo "bobbens"
     3  * Extended and extensively updated by aschiffler at ferzkopp dot net
     4  */
     5 
     6 #include <stdio.h>
     7 
     8 #include "SDL.h"
     9 #include "SDL_test.h"
    10 
    11 /* ================= Test Case Implementation ================== */
    12 
    13 #define TESTRENDER_SCREEN_W     80
    14 #define TESTRENDER_SCREEN_H     60
    15 
    16 #define RENDER_COMPARE_FORMAT  SDL_PIXELFORMAT_ARGB8888
    17 #define RENDER_COMPARE_AMASK   0xff000000 /**< Alpha bit mask. */
    18 #define RENDER_COMPARE_RMASK   0x00ff0000 /**< Red bit mask. */
    19 #define RENDER_COMPARE_GMASK   0x0000ff00 /**< Green bit mask. */
    20 #define RENDER_COMPARE_BMASK   0x000000ff /**< Blue bit mask. */
    21 
    22 #define ALLOWABLE_ERROR_OPAQUE  0
    23 #define ALLOWABLE_ERROR_BLENDED 64
    24 
    25 /* Test window and renderer */
    26 SDL_Window *window = NULL;
    27 SDL_Renderer *renderer = NULL;
    28 
    29 /* Prototypes for helper functions */
    30 
    31 static int _clearScreen (void);
    32 static void _compare(SDL_Surface *reference, int allowable_error);
    33 static int _hasTexAlpha(void);
    34 static int _hasTexColor(void);
    35 static SDL_Texture *_loadTestFace(void);
    36 static int _hasBlendModes(void);
    37 static int _hasDrawColor(void);
    38 static int _isSupported(int code);
    39 
    40 /**
    41  * Create software renderer for tests
    42  */
    43 void InitCreateRenderer(void *arg)
    44 {
    45   int posX = 100, posY = 100, width = 320, height = 240;
    46   renderer = NULL;
    47   window = SDL_CreateWindow("render_testCreateRenderer", posX, posY, width, height, 0);
    48   SDLTest_AssertPass("SDL_CreateWindow()");
    49   SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result");
    50   if (window == NULL) {
    51       return;
    52   }
    53 
    54   renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
    55   SDLTest_AssertPass("SDL_CreateRenderer()");
    56   SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result");
    57   if (renderer == NULL) {
    58       SDL_DestroyWindow(window);
    59       return;
    60   }
    61 }
    62 
    63 /*
    64  * Destroy renderer for tests
    65  */
    66 void CleanupDestroyRenderer(void *arg)
    67 {
    68   if (renderer != NULL) {
    69      SDL_DestroyRenderer(renderer);
    70      renderer = NULL;
    71      SDLTest_AssertPass("SDL_DestroyRenderer()");
    72   }
    73 
    74   if (window != NULL) {
    75      SDL_DestroyWindow(window);
    76      window = NULL;
    77      SDLTest_AssertPass("SDL_DestroyWindow");
    78   }
    79 }
    80 
    81 
    82 /**
    83  * @brief Tests call to SDL_GetNumRenderDrivers
    84  *
    85  * \sa
    86  * http://wiki.libsdl.org/moin.cgi/SDL_GetNumRenderDrivers
    87  */
    88 int
    89 render_testGetNumRenderDrivers(void *arg)
    90 {
    91   int n;
    92   n = SDL_GetNumRenderDrivers();
    93   SDLTest_AssertCheck(n >= 1, "Number of renderers >= 1, reported as %i", n);
    94   return TEST_COMPLETED;
    95 }
    96 
    97 
    98 /**
    99  * @brief Tests the SDL primitives for rendering.
   100  *
   101  * \sa
   102  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
   103  * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
   104  * http://wiki.libsdl.org/moin.cgi/SDL_RenderDrawLine
   105  *
   106  */
   107 int render_testPrimitives (void *arg)
   108 {
   109    int ret;
   110    int x, y;
   111    SDL_Rect rect;
   112    SDL_Surface *referenceSurface = NULL;
   113    int checkFailCount1;
   114    int checkFailCount2;
   115 
   116    /* Clear surface. */
   117    _clearScreen();
   118 
   119    /* Need drawcolor or just skip test. */
   120    SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
   121 
   122    /* Draw a rectangle. */
   123    rect.x = 40;
   124    rect.y = 0;
   125    rect.w = 40;
   126    rect.h = 80;
   127 
   128    ret = SDL_SetRenderDrawColor(renderer, 13, 73, 200, SDL_ALPHA_OPAQUE );
   129    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
   130 
   131    ret = SDL_RenderFillRect(renderer, &rect );
   132    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
   133 
   134    /* Draw a rectangle. */
   135    rect.x = 10;
   136    rect.y = 10;
   137    rect.w = 60;
   138    rect.h = 40;
   139    ret = SDL_SetRenderDrawColor(renderer, 200, 0, 100, SDL_ALPHA_OPAQUE );
   140    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
   141 
   142    ret = SDL_RenderFillRect(renderer, &rect );
   143    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
   144 
   145    /* Draw some points like so:
   146     * X.X.X.X..
   147     * .X.X.X.X.
   148     * X.X.X.X.. */
   149    checkFailCount1 = 0;
   150    checkFailCount2 = 0;
   151    for (y=0; y<3; y++) {
   152       for (x = y % 2; x<TESTRENDER_SCREEN_W; x+=2) {
   153          ret = SDL_SetRenderDrawColor(renderer, x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE );
   154          if (ret != 0) checkFailCount1++;
   155 
   156          ret = SDL_RenderDrawPoint(renderer, x, y );
   157          if (ret != 0) checkFailCount2++;
   158       }
   159    }
   160    SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
   161    SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount2);
   162 
   163    /* Draw some lines. */
   164    ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE );
   165    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor");
   166 
   167    ret = SDL_RenderDrawLine(renderer, 0, 30, TESTRENDER_SCREEN_W, 30 );
   168    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
   169 
   170    ret = SDL_SetRenderDrawColor(renderer, 55, 55, 5, SDL_ALPHA_OPAQUE );
   171    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
   172 
   173    ret = SDL_RenderDrawLine(renderer, 40, 30, 40, 60 );
   174    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
   175 
   176    ret = SDL_SetRenderDrawColor(renderer, 5, 105, 105, SDL_ALPHA_OPAQUE );
   177    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
   178 
   179    ret = SDL_RenderDrawLine(renderer, 0, 0, 29, 29 );
   180    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
   181 
   182    ret = SDL_RenderDrawLine(renderer, 29, 30, 0, 59 );
   183    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
   184 
   185    ret = SDL_RenderDrawLine(renderer, 79, 0, 50, 29 );
   186    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
   187 
   188    ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
   189    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
   190    
   191    /* Make current */
   192    SDL_RenderPresent(renderer);
   193    
   194    /* See if it's the same. */
   195    referenceSurface = SDLTest_ImagePrimitives();
   196    _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
   197 
   198    /* Clean up. */
   199    SDL_FreeSurface(referenceSurface);
   200    referenceSurface = NULL;
   201 
   202    return TEST_COMPLETED;
   203 }
   204 
   205 /**
   206  * @brief Tests the SDL primitives with alpha for rendering.
   207  *
   208  * \sa
   209  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
   210  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
   211  * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
   212  */
   213 int render_testPrimitivesBlend (void *arg)
   214 {
   215    int ret;
   216    int i, j;
   217    SDL_Rect rect;
   218    SDL_Surface *referenceSurface = NULL;
   219    int checkFailCount1;
   220    int checkFailCount2;
   221    int checkFailCount3;
   222 
   223    /* Clear surface. */
   224    _clearScreen();
   225 
   226    /* Need drawcolor and blendmode or just skip test. */
   227    SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
   228    SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
   229 
   230    /* Create some rectangles for each blend mode. */
   231    ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0 );
   232    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
   233 
   234    ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
   235    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
   236 
   237    ret = SDL_RenderFillRect(renderer, NULL );
   238    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
   239 
   240    rect.x = 10;
   241    rect.y = 25;
   242    rect.w = 40;
   243    rect.h = 25;
   244    ret = SDL_SetRenderDrawColor(renderer, 240, 10, 10, 75 );
   245    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
   246 
   247    ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
   248    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
   249 
   250    ret = SDL_RenderFillRect(renderer, &rect );
   251    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
   252 
   253    rect.x = 30;
   254    rect.y = 40;
   255    rect.w = 45;
   256    rect.h = 15;
   257    ret = SDL_SetRenderDrawColor(renderer, 10, 240, 10, 100 );
   258    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
   259 
   260    ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
   261    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
   262 
   263    ret = SDL_RenderFillRect(renderer, &rect );
   264    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
   265 
   266    rect.x = 25;
   267    rect.y = 25;
   268    rect.w = 25;
   269    rect.h = 25;
   270    ret = SDL_SetRenderDrawColor(renderer, 10, 10, 240, 125 );
   271    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
   272 
   273    ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
   274    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
   275 
   276    ret = SDL_RenderFillRect(renderer, &rect );
   277    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
   278 
   279 
   280    /* Draw blended lines, lines for everyone. */
   281    checkFailCount1 = 0;
   282    checkFailCount2 = 0;
   283    checkFailCount3 = 0;
   284    for (i=0; i<TESTRENDER_SCREEN_W; i+=2)  {
   285       ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
   286       if (ret != 0) checkFailCount1++;
   287 
   288       ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
   289             (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
   290       if (ret != 0) checkFailCount2++;
   291 
   292       ret = SDL_RenderDrawLine(renderer, 0, 0, i, 59 );
   293       if (ret != 0) checkFailCount3++;
   294    }
   295    SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
   296    SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
   297    SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
   298 
   299    checkFailCount1 = 0;
   300    checkFailCount2 = 0;
   301    checkFailCount3 = 0;
   302    for (i=0; i<TESTRENDER_SCREEN_H; i+=2)  {
   303       ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
   304       if (ret != 0) checkFailCount1++;
   305 
   306       ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
   307             (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
   308       if (ret != 0) checkFailCount2++;
   309 
   310       ret = SDL_RenderDrawLine(renderer, 0, 0, 79, i );
   311       if (ret != 0) checkFailCount3++;
   312    }
   313    SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
   314    SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
   315    SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
   316 
   317    /* Draw points. */
   318    checkFailCount1 = 0;
   319    checkFailCount2 = 0;
   320    checkFailCount3 = 0;
   321    for (j=0; j<TESTRENDER_SCREEN_H; j+=3) {
   322       for (i=0; i<TESTRENDER_SCREEN_W; i+=3) {
   323          ret = SDL_SetRenderDrawColor(renderer, j*4, i*3, j*4, i*3 );
   324          if (ret != 0) checkFailCount1++;
   325 
   326          ret = SDL_SetRenderDrawBlendMode(renderer, ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
   327                ((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
   328          if (ret != 0) checkFailCount2++;
   329 
   330          ret = SDL_RenderDrawPoint(renderer, i, j );
   331          if (ret != 0) checkFailCount3++;
   332       }
   333    }
   334    SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
   335    SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
   336    SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
   337 
   338    /* Make current */
   339    SDL_RenderPresent(renderer);
   340 
   341    /* See if it's the same. */
   342    referenceSurface = SDLTest_ImagePrimitivesBlend();
   343    _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   344 
   345    /* Clean up. */
   346    SDL_FreeSurface(referenceSurface);
   347    referenceSurface = NULL;
   348 
   349    return TEST_COMPLETED;
   350 }
   351 
   352 
   353 
   354 /**
   355  * @brief Tests some blitting routines.
   356  *
   357  * \sa
   358  * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
   359  * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
   360  */
   361 int
   362 render_testBlit(void *arg)
   363 {
   364    int ret;
   365    SDL_Rect rect;
   366    SDL_Texture *tface;
   367    SDL_Surface *referenceSurface = NULL;
   368    Uint32 tformat;
   369    int taccess, tw, th;
   370    int i, j, ni, nj;
   371    int checkFailCount1;
   372 
   373    /* Clear surface. */
   374    _clearScreen();
   375 
   376    /* Need drawcolor or just skip test. */
   377    SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor)");
   378 
   379    /* Create face surface. */
   380    tface = _loadTestFace();
   381    SDLTest_AssertCheck(tface != NULL,  "Verify _loadTestFace() result");
   382    if (tface == NULL) {
   383        return TEST_ABORTED;
   384    }
   385 
   386    /* Constant values. */
   387    ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
   388    SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
   389    rect.w = tw;
   390    rect.h = th;
   391    ni     = TESTRENDER_SCREEN_W - tw;
   392    nj     = TESTRENDER_SCREEN_H - th;
   393 
   394    /* Loop blit. */
   395    checkFailCount1 = 0;
   396    for (j=0; j <= nj; j+=4) {
   397       for (i=0; i <= ni; i+=4) {
   398          /* Blitting. */
   399          rect.x = i;
   400          rect.y = j;
   401          ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
   402          if (ret != 0) checkFailCount1++;
   403       }
   404    }
   405    SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
   406 
   407    /* Make current */
   408    SDL_RenderPresent(renderer);
   409 
   410    /* See if it's the same */
   411    referenceSurface = SDLTest_ImageBlit();
   412    _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
   413 
   414    /* Clean up. */
   415    SDL_DestroyTexture( tface );
   416    SDL_FreeSurface(referenceSurface);
   417    referenceSurface = NULL;
   418 
   419    return TEST_COMPLETED;
   420 }
   421 
   422 
   423 /**
   424  * @brief Blits doing color tests.
   425  *
   426  * \sa
   427  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
   428  * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
   429  * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
   430  */
   431 int
   432 render_testBlitColor (void *arg)
   433 {
   434    int ret;
   435    SDL_Rect rect;
   436    SDL_Texture *tface;
   437    SDL_Surface *referenceSurface = NULL;
   438    Uint32 tformat;
   439    int taccess, tw, th;
   440    int i, j, ni, nj;
   441    int checkFailCount1;
   442    int checkFailCount2;
   443 
   444    /* Clear surface. */
   445    _clearScreen();
   446 
   447    /* Create face surface. */
   448    tface = _loadTestFace();
   449    SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
   450    if (tface == NULL) {
   451        return TEST_ABORTED;
   452    }
   453 
   454    /* Constant values. */
   455    ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
   456    SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
   457    rect.w = tw;
   458    rect.h = th;
   459    ni     = TESTRENDER_SCREEN_W - tw;
   460    nj     = TESTRENDER_SCREEN_H - th;
   461 
   462    /* Test blitting with color mod. */
   463    checkFailCount1 = 0;
   464    checkFailCount2 = 0;
   465    for (j=0; j <= nj; j+=4) {
   466       for (i=0; i <= ni; i+=4) {
   467          /* Set color mod. */
   468          ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
   469          if (ret != 0) checkFailCount1++;
   470 
   471          /* Blitting. */
   472          rect.x = i;
   473          rect.y = j;
   474          ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
   475          if (ret != 0) checkFailCount2++;
   476       }
   477    }
   478    SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
   479    SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
   480 
   481    /* Make current */
   482    SDL_RenderPresent(renderer);
   483 
   484    /* See if it's the same. */
   485    referenceSurface = SDLTest_ImageBlitColor();
   486    _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
   487 
   488    /* Clean up. */
   489    SDL_DestroyTexture( tface );
   490    SDL_FreeSurface(referenceSurface);
   491    referenceSurface = NULL;
   492 
   493    return TEST_COMPLETED;
   494 }
   495 
   496 
   497 /**
   498  * @brief Tests blitting with alpha.
   499  *
   500  * \sa
   501  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
   502  * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
   503  * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
   504  */
   505 int
   506 render_testBlitAlpha (void *arg)
   507 {
   508    int ret;
   509    SDL_Rect rect;
   510    SDL_Texture *tface;
   511    SDL_Surface *referenceSurface = NULL;
   512    Uint32 tformat;
   513    int taccess, tw, th;
   514    int i, j, ni, nj;
   515    int checkFailCount1;
   516    int checkFailCount2;
   517 
   518    /* Clear surface. */
   519    _clearScreen();
   520 
   521    /* Need alpha or just skip test. */
   522    SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
   523 
   524    /* Create face surface. */
   525    tface = _loadTestFace();
   526    SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
   527    if (tface == NULL) {
   528        return TEST_ABORTED;
   529    }
   530 
   531    /* Constant values. */
   532    ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
   533    SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
   534    rect.w = tw;
   535    rect.h = th;
   536    ni     = TESTRENDER_SCREEN_W - tw;
   537    nj     = TESTRENDER_SCREEN_H - th;
   538 
   539    /* Test blitting with alpha mod. */
   540    checkFailCount1 = 0;
   541    checkFailCount2 = 0;
   542    for (j=0; j <= nj; j+=4) {
   543       for (i=0; i <= ni; i+=4) {
   544          /* Set alpha mod. */
   545          ret = SDL_SetTextureAlphaMod( tface, (255/ni)*i );
   546          if (ret != 0) checkFailCount1++;
   547 
   548          /* Blitting. */
   549          rect.x = i;
   550          rect.y = j;
   551          ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
   552          if (ret != 0) checkFailCount2++;
   553       }
   554    }
   555    SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
   556    SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
   557 
   558    /* Make current */
   559    SDL_RenderPresent(renderer);
   560 
   561    /* See if it's the same. */
   562    referenceSurface = SDLTest_ImageBlitAlpha();
   563    _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   564 
   565    /* Clean up. */
   566    SDL_DestroyTexture( tface );
   567    SDL_FreeSurface(referenceSurface);
   568    referenceSurface = NULL;
   569 
   570    return TEST_COMPLETED;
   571 }
   572 
   573 /* Helper functions */
   574 
   575 /**
   576  * @brief Tests a blend mode.
   577  *
   578  * \sa
   579  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
   580  * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
   581  */
   582 static void
   583 _testBlitBlendMode( SDL_Texture * tface, int mode )
   584 {
   585    int ret;
   586    Uint32 tformat;
   587    int taccess, tw, th;
   588    int i, j, ni, nj;
   589    SDL_Rect rect;
   590    int checkFailCount1;
   591    int checkFailCount2;
   592 
   593    /* Clear surface. */
   594    _clearScreen();
   595 
   596    /* Constant values. */
   597    ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
   598    SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
   599    rect.w = tw;
   600    rect.h = th;
   601    ni     = TESTRENDER_SCREEN_W - tw;
   602    nj     = TESTRENDER_SCREEN_H - th;
   603 
   604    /* Test blend mode. */
   605    checkFailCount1 = 0;
   606    checkFailCount2 = 0;
   607    for (j=0; j <= nj; j+=4) {
   608       for (i=0; i <= ni; i+=4) {
   609          /* Set blend mode. */
   610          ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
   611          if (ret != 0) checkFailCount1++;
   612 
   613          /* Blitting. */
   614          rect.x = i;
   615          rect.y = j;
   616          ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
   617          if (ret != 0) checkFailCount2++;
   618       }
   619    }
   620    SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount1);
   621    SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
   622 }
   623 
   624 
   625 /**
   626  * @brief Tests some more blitting routines.
   627  *
   628  * \sa
   629  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
   630  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
   631  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
   632  * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
   633  */
   634 int
   635 render_testBlitBlend (void *arg)
   636 {
   637    int ret;
   638    SDL_Rect rect;
   639    SDL_Texture *tface;
   640    SDL_Surface *referenceSurface = NULL;
   641    Uint32 tformat;
   642    int taccess, tw, th;
   643    int i, j, ni, nj;
   644    int mode;
   645    int checkFailCount1;
   646    int checkFailCount2;
   647    int checkFailCount3;
   648    int checkFailCount4;
   649 
   650    SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
   651    SDLTest_AssertCheck(_hasTexColor(), "_hasTexColor");
   652    SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
   653 
   654    /* Create face surface. */
   655    tface = _loadTestFace();
   656    SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
   657    if (tface == NULL) {
   658        return TEST_ABORTED;
   659    }
   660 
   661    /* Constant values. */
   662    ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
   663    SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
   664    rect.w = tw;
   665    rect.h = th;
   666    ni = TESTRENDER_SCREEN_W - tw;
   667    nj = TESTRENDER_SCREEN_H - th;
   668 
   669    /* Set alpha mod. */
   670    ret = SDL_SetTextureAlphaMod( tface, 100 );
   671    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetTextureAlphaMod, expected: 0, got: %i", ret);
   672 
   673    /* Test None. */
   674    _testBlitBlendMode( tface, SDL_BLENDMODE_NONE );
   675    referenceSurface = SDLTest_ImageBlitBlendNone();
   676 
   677    /* Make current and compare */
   678    SDL_RenderPresent(renderer);
   679    _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
   680    SDL_FreeSurface(referenceSurface);
   681    referenceSurface = NULL;
   682 
   683    /* Test Blend. */
   684    _testBlitBlendMode( tface, SDL_BLENDMODE_BLEND );
   685    referenceSurface = SDLTest_ImageBlitBlend();
   686 
   687    /* Make current and compare */
   688    SDL_RenderPresent(renderer);
   689    _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   690    SDL_FreeSurface(referenceSurface);
   691    referenceSurface = NULL;
   692 
   693    /* Test Add. */
   694    _testBlitBlendMode( tface, SDL_BLENDMODE_ADD );
   695    referenceSurface = SDLTest_ImageBlitBlendAdd();
   696 
   697    /* Make current and compare */
   698    SDL_RenderPresent(renderer);
   699    _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   700    SDL_FreeSurface(referenceSurface);
   701    referenceSurface = NULL;
   702 
   703    /* Test Mod. */
   704    _testBlitBlendMode( tface, SDL_BLENDMODE_MOD);
   705    referenceSurface = SDLTest_ImageBlitBlendMod();
   706 
   707    /* Make current and compare */
   708    SDL_RenderPresent(renderer);
   709    _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   710    SDL_FreeSurface(referenceSurface);
   711    referenceSurface = NULL;
   712 
   713    /* Clear surface. */
   714    _clearScreen();
   715 
   716    /* Loop blit. */
   717    checkFailCount1 = 0;
   718    checkFailCount2 = 0;
   719    checkFailCount3 = 0;
   720    checkFailCount4 = 0;
   721    for (j=0; j <= nj; j+=4) {
   722       for (i=0; i <= ni; i+=4) {
   723 
   724          /* Set color mod. */
   725          ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
   726          if (ret != 0) checkFailCount1++;
   727 
   728          /* Set alpha mod. */
   729          ret = SDL_SetTextureAlphaMod( tface, (100/ni)*i );
   730          if (ret != 0) checkFailCount2++;
   731 
   732          /* Crazy blending mode magic. */
   733          mode = (i/4*j/4) % 4;
   734          if (mode==0) mode = SDL_BLENDMODE_NONE;
   735          else if (mode==1) mode = SDL_BLENDMODE_BLEND;
   736          else if (mode==2) mode = SDL_BLENDMODE_ADD;
   737          else if (mode==3) mode = SDL_BLENDMODE_MOD;
   738          ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
   739          if (ret != 0) checkFailCount3++;
   740 
   741          /* Blitting. */
   742          rect.x = i;
   743          rect.y = j;
   744          ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
   745          if (ret != 0) checkFailCount4++;
   746       }
   747    }
   748    SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
   749    SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount2);
   750    SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount3);
   751    SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount4);
   752 
   753    /* Clean up. */
   754    SDL_DestroyTexture( tface );
   755 
   756    /* Make current */
   757    SDL_RenderPresent(renderer);
   758 
   759    /* Check to see if final image matches. */
   760    referenceSurface = SDLTest_ImageBlitBlendAll();
   761    _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
   762    SDL_FreeSurface(referenceSurface);
   763    referenceSurface = NULL;
   764 
   765    return TEST_COMPLETED;
   766 }
   767 
   768 
   769 /**
   770  * @brief Checks to see if functionality is supported. Helper function.
   771  */
   772 static int
   773 _isSupported( int code )
   774 {
   775    return (code == 0);
   776 }
   777 
   778 /**
   779  * @brief Test to see if we can vary the draw color. Helper function.
   780  *
   781  * \sa
   782  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
   783  * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawColor
   784  */
   785 static int
   786 _hasDrawColor (void)
   787 {
   788    int ret, fail;
   789    Uint8 r, g, b, a;
   790 
   791    fail = 0;
   792 
   793    /* Set color. */
   794    ret = SDL_SetRenderDrawColor(renderer, 100, 100, 100, 100 );
   795    if (!_isSupported(ret))
   796       fail = 1;
   797    ret = SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a );
   798    if (!_isSupported(ret))
   799       fail = 1;
   800 
   801    /* Restore natural. */
   802    ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
   803    if (!_isSupported(ret))
   804       fail = 1;
   805 
   806    /* Something failed, consider not available. */
   807    if (fail)
   808       return 0;
   809 
   810    /* Not set properly, consider failed. */
   811    else if ((r != 100) || (g != 100) || (b != 100) || (a != 100))
   812       return 0;
   813    return 1;
   814 }
   815 
   816 /**
   817  * @brief Test to see if we can vary the blend mode. Helper function.
   818  *
   819  * \sa
   820  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
   821  * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawBlendMode
   822  */
   823 static int
   824 _hasBlendModes (void)
   825 {
   826    int fail;
   827    int ret;
   828    SDL_BlendMode mode;
   829 
   830    fail = 0;
   831 
   832    ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
   833    if (!_isSupported(ret))
   834       fail = 1;
   835    ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
   836    if (!_isSupported(ret))
   837       fail = 1;
   838    ret = (mode != SDL_BLENDMODE_BLEND);
   839    if (!_isSupported(ret))
   840       fail = 1;
   841    ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
   842    if (!_isSupported(ret))
   843       fail = 1;
   844    ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
   845    if (!_isSupported(ret))
   846       fail = 1;
   847    ret = (mode != SDL_BLENDMODE_ADD);
   848    if (!_isSupported(ret))
   849       fail = 1;
   850    ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_MOD );
   851    if (!_isSupported(ret))
   852       fail = 1;
   853    ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
   854    if (!_isSupported(ret))
   855       fail = 1;
   856    ret = (mode != SDL_BLENDMODE_MOD);
   857    if (!_isSupported(ret))
   858       fail = 1;
   859    ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
   860    if (!_isSupported(ret))
   861       fail = 1;
   862    ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
   863    if (!_isSupported(ret))
   864       fail = 1;
   865    ret = (mode != SDL_BLENDMODE_NONE);
   866    if (!_isSupported(ret))
   867       fail = 1;
   868 
   869    return !fail;
   870 }
   871 
   872 
   873 /**
   874  * @brief Loads the test image 'Face' as texture. Helper function.
   875  *
   876  * \sa
   877  * http://wiki.libsdl.org/moin.cgi/SDL_CreateTextureFromSurface
   878  */
   879 static SDL_Texture *
   880 _loadTestFace(void)
   881 {
   882    SDL_Surface *face;
   883    SDL_Texture *tface;
   884 
   885    face = SDLTest_ImageFace();
   886    if (face == NULL) {
   887       return NULL;
   888    }
   889 
   890    tface = SDL_CreateTextureFromSurface(renderer, face);
   891    if (tface == NULL) {
   892        SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
   893    }
   894 
   895    SDL_FreeSurface(face);
   896 
   897    return tface;
   898 }
   899 
   900 
   901 /**
   902  * @brief Test to see if can set texture color mode. Helper function.
   903  *
   904  * \sa
   905  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
   906  * http://wiki.libsdl.org/moin.cgi/SDL_GetTextureColorMod
   907  * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
   908  */
   909 static int
   910 _hasTexColor (void)
   911 {
   912    int fail;
   913    int ret;
   914    SDL_Texture *tface;
   915    Uint8 r, g, b;
   916 
   917    /* Get test face. */
   918    tface = _loadTestFace();
   919    if (tface == NULL)
   920       return 0;
   921 
   922    /* See if supported. */
   923    fail = 0;
   924    ret = SDL_SetTextureColorMod( tface, 100, 100, 100 );
   925    if (!_isSupported(ret))
   926       fail = 1;
   927    ret = SDL_GetTextureColorMod( tface, &r, &g, &b );
   928    if (!_isSupported(ret))
   929       fail = 1;
   930 
   931    /* Clean up. */
   932    SDL_DestroyTexture( tface );
   933 
   934    if (fail)
   935       return 0;
   936    else if ((r != 100) || (g != 100) || (b != 100))
   937       return 0;
   938    return 1;
   939 }
   940 
   941 /**
   942  * @brief Test to see if we can vary the alpha of the texture. Helper function.
   943  *
   944  * \sa
   945  *  http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
   946  *  http://wiki.libsdl.org/moin.cgi/SDL_GetTextureAlphaMod
   947  *  http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
   948  */
   949 static int
   950 _hasTexAlpha(void)
   951 {
   952    int fail;
   953    int ret;
   954    SDL_Texture *tface;
   955    Uint8 a;
   956 
   957    /* Get test face. */
   958    tface = _loadTestFace();
   959    if (tface == NULL)
   960       return 0;
   961 
   962    /* See if supported. */
   963    fail = 0;
   964    ret = SDL_SetTextureAlphaMod( tface, 100 );
   965    if (!_isSupported(ret))
   966       fail = 1;
   967    ret = SDL_GetTextureAlphaMod( tface, &a );
   968    if (!_isSupported(ret))
   969       fail = 1;
   970 
   971    /* Clean up. */
   972    SDL_DestroyTexture( tface );
   973 
   974    if (fail)
   975       return 0;
   976    else if (a != 100)
   977       return 0;
   978    return 1;
   979 }
   980 
   981 /**
   982  * @brief Compares screen pixels with image pixels. Helper function.
   983  *
   984  * @param s Image to compare against.
   985  *
   986  * \sa
   987  * http://wiki.libsdl.org/moin.cgi/SDL_RenderReadPixels
   988  * http://wiki.libsdl.org/moin.cgi/SDL_CreateRGBSurfaceFrom
   989  * http://wiki.libsdl.org/moin.cgi/SDL_FreeSurface
   990  */
   991 static void
   992 _compare(SDL_Surface *referenceSurface, int allowable_error)
   993 {
   994    int result;
   995    SDL_Rect rect;
   996    Uint8 *pixels;
   997    SDL_Surface *testSurface;
   998 
   999    /* Read pixels. */
  1000    pixels = (Uint8 *)SDL_malloc(4*TESTRENDER_SCREEN_W*TESTRENDER_SCREEN_H);
  1001    SDLTest_AssertCheck(pixels != NULL, "Validate allocated temp pixel buffer");
  1002    if (pixels == NULL) return;
  1003 
  1004    /* Explicitly specify the rect in case the window isn't the expected size... */
  1005    rect.x = 0;
  1006    rect.y = 0;
  1007    rect.w = TESTRENDER_SCREEN_W;
  1008    rect.h = TESTRENDER_SCREEN_H;
  1009    result = SDL_RenderReadPixels(renderer, &rect, RENDER_COMPARE_FORMAT, pixels, 80*4 );
  1010    SDLTest_AssertCheck(result == 0, "Validate result from SDL_RenderReadPixels, expected: 0, got: %i", result);
  1011 
  1012    /* Create surface. */
  1013    testSurface = SDL_CreateRGBSurfaceFrom(pixels, TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, 32, TESTRENDER_SCREEN_W*4,
  1014                                        RENDER_COMPARE_RMASK, RENDER_COMPARE_GMASK, RENDER_COMPARE_BMASK, RENDER_COMPARE_AMASK);
  1015    SDLTest_AssertCheck(testSurface != NULL, "Verify result from SDL_CreateRGBSurfaceFrom is not NULL");
  1016 
  1017    /* Compare surface. */
  1018    result = SDLTest_CompareSurfaces( testSurface, referenceSurface, allowable_error );
  1019    SDLTest_AssertCheck(result == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", result);
  1020 
  1021    /* Clean up. */
  1022    SDL_free(pixels);
  1023    SDL_FreeSurface(testSurface);
  1024 }
  1025 
  1026 /**
  1027  * @brief Clears the screen. Helper function.
  1028  *
  1029  * \sa
  1030  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
  1031  * http://wiki.libsdl.org/moin.cgi/SDL_RenderClear
  1032  * http://wiki.libsdl.org/moin.cgi/SDL_RenderPresent
  1033  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
  1034  */
  1035 static int
  1036 _clearScreen(void)
  1037 {
  1038    int ret;
  1039 
  1040    /* Set color. */
  1041    ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
  1042    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  1043 
  1044    /* Clear screen. */
  1045    ret = SDL_RenderClear(renderer);
  1046    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderClear, expected: 0, got: %i", ret);
  1047 
  1048    /* Make current */
  1049    SDL_RenderPresent(renderer);
  1050 
  1051    /* Set defaults. */
  1052    ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
  1053    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
  1054 
  1055    ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE );
  1056    SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  1057 
  1058    return 0;
  1059 }
  1060 
  1061 /* ================= Test References ================== */
  1062 
  1063 /* Render test cases */
  1064 static const SDLTest_TestCaseReference renderTest1 =
  1065         { (SDLTest_TestCaseFp)render_testGetNumRenderDrivers, "render_testGetNumRenderDrivers", "Tests call to SDL_GetNumRenderDrivers", TEST_ENABLED };
  1066 
  1067 static const SDLTest_TestCaseReference renderTest2 =
  1068         { (SDLTest_TestCaseFp)render_testPrimitives, "render_testPrimitives", "Tests rendering primitives", TEST_ENABLED };
  1069 
  1070 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  1071 static const SDLTest_TestCaseReference renderTest3 =
  1072         { (SDLTest_TestCaseFp)render_testPrimitivesBlend, "render_testPrimitivesBlend", "Tests rendering primitives with blending", TEST_DISABLED };
  1073 
  1074 static const SDLTest_TestCaseReference renderTest4 =
  1075         { (SDLTest_TestCaseFp)render_testBlit, "render_testBlit", "Tests blitting", TEST_ENABLED };
  1076 
  1077 static const SDLTest_TestCaseReference renderTest5 =
  1078         { (SDLTest_TestCaseFp)render_testBlitColor, "render_testBlitColor", "Tests blitting with color", TEST_ENABLED };
  1079 
  1080 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  1081 static const SDLTest_TestCaseReference renderTest6 =
  1082         { (SDLTest_TestCaseFp)render_testBlitAlpha, "render_testBlitAlpha", "Tests blitting with alpha", TEST_DISABLED };
  1083 
  1084 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  1085 static const SDLTest_TestCaseReference renderTest7 =
  1086         {  (SDLTest_TestCaseFp)render_testBlitBlend, "render_testBlitBlend", "Tests blitting with blending", TEST_DISABLED };
  1087 
  1088 /* Sequence of Render test cases */
  1089 static const SDLTest_TestCaseReference *renderTests[] =  {
  1090     &renderTest1, &renderTest2, &renderTest3, &renderTest4, &renderTest5, &renderTest6, &renderTest7, NULL
  1091 };
  1092 
  1093 /* Render test suite (global) */
  1094 SDLTest_TestSuiteReference renderTestSuite = {
  1095     "Render",
  1096     InitCreateRenderer,
  1097     renderTests,
  1098     CleanupDestroyRenderer
  1099 };