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