test/testautomation_render.c
changeset 9254 6c469ea796e4
parent 7720 f9a649383362
     1.1 --- a/test/testautomation_render.c	Sun Nov 30 22:17:12 2014 +0100
     1.2 +++ b/test/testautomation_render.c	Sun Nov 30 20:55:27 2014 -0800
     1.3 @@ -113,6 +113,9 @@
     1.4     int checkFailCount1;
     1.5     int checkFailCount2;
     1.6  
     1.7 +   /* Clear surface. */
     1.8 +   _clearScreen();
     1.9 +
    1.10     /* Need drawcolor or just skip test. */
    1.11     SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
    1.12  
    1.13 @@ -184,7 +187,10 @@
    1.14  
    1.15     ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
    1.16     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
    1.17 -
    1.18 +   
    1.19 +   /* Make current */
    1.20 +   SDL_RenderPresent(renderer);
    1.21 +   
    1.22     /* See if it's the same. */
    1.23     referenceSurface = SDLTest_ImagePrimitives();
    1.24     _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
    1.25 @@ -214,6 +220,9 @@
    1.26     int checkFailCount2;
    1.27     int checkFailCount3;
    1.28  
    1.29 +   /* Clear surface. */
    1.30 +   _clearScreen();
    1.31 +
    1.32     /* Need drawcolor and blendmode or just skip test. */
    1.33     SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
    1.34     SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
    1.35 @@ -326,6 +335,9 @@
    1.36     SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
    1.37     SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
    1.38  
    1.39 +   /* Make current */
    1.40 +   SDL_RenderPresent(renderer);
    1.41 +
    1.42     /* See if it's the same. */
    1.43     referenceSurface = SDLTest_ImagePrimitivesBlend();
    1.44     _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
    1.45 @@ -358,6 +370,8 @@
    1.46     int i, j, ni, nj;
    1.47     int checkFailCount1;
    1.48  
    1.49 +   /* Clear surface. */
    1.50 +   _clearScreen();
    1.51  
    1.52     /* Need drawcolor or just skip test. */
    1.53     SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor)");
    1.54 @@ -390,6 +404,9 @@
    1.55     }
    1.56     SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
    1.57  
    1.58 +   /* Make current */
    1.59 +   SDL_RenderPresent(renderer);
    1.60 +
    1.61     /* See if it's the same */
    1.62     referenceSurface = SDLTest_ImageBlit();
    1.63     _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
    1.64 @@ -424,6 +441,9 @@
    1.65     int checkFailCount1;
    1.66     int checkFailCount2;
    1.67  
    1.68 +   /* Clear surface. */
    1.69 +   _clearScreen();
    1.70 +
    1.71     /* Create face surface. */
    1.72     tface = _loadTestFace();
    1.73     SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
    1.74 @@ -458,6 +478,9 @@
    1.75     SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
    1.76     SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
    1.77  
    1.78 +   /* Make current */
    1.79 +   SDL_RenderPresent(renderer);
    1.80 +
    1.81     /* See if it's the same. */
    1.82     referenceSurface = SDLTest_ImageBlitColor();
    1.83     _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
    1.84 @@ -492,6 +515,9 @@
    1.85     int checkFailCount1;
    1.86     int checkFailCount2;
    1.87  
    1.88 +   /* Clear surface. */
    1.89 +   _clearScreen();
    1.90 +
    1.91     /* Need alpha or just skip test. */
    1.92     SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
    1.93  
    1.94 @@ -529,6 +555,9 @@
    1.95     SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
    1.96     SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
    1.97  
    1.98 +   /* Make current */
    1.99 +   SDL_RenderPresent(renderer);
   1.100 +
   1.101     /* See if it's the same. */
   1.102     referenceSurface = SDLTest_ImageBlitAlpha();
   1.103     _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   1.104 @@ -644,6 +673,9 @@
   1.105     /* Test None. */
   1.106     _testBlitBlendMode( tface, SDL_BLENDMODE_NONE );
   1.107     referenceSurface = SDLTest_ImageBlitBlendNone();
   1.108 +
   1.109 +   /* Make current and compare */
   1.110 +   SDL_RenderPresent(renderer);
   1.111     _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
   1.112     SDL_FreeSurface(referenceSurface);
   1.113     referenceSurface = NULL;
   1.114 @@ -651,6 +683,9 @@
   1.115     /* Test Blend. */
   1.116     _testBlitBlendMode( tface, SDL_BLENDMODE_BLEND );
   1.117     referenceSurface = SDLTest_ImageBlitBlend();
   1.118 +
   1.119 +   /* Make current and compare */
   1.120 +   SDL_RenderPresent(renderer);
   1.121     _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   1.122     SDL_FreeSurface(referenceSurface);
   1.123     referenceSurface = NULL;
   1.124 @@ -658,6 +693,9 @@
   1.125     /* Test Add. */
   1.126     _testBlitBlendMode( tface, SDL_BLENDMODE_ADD );
   1.127     referenceSurface = SDLTest_ImageBlitBlendAdd();
   1.128 +
   1.129 +   /* Make current and compare */
   1.130 +   SDL_RenderPresent(renderer);
   1.131     _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   1.132     SDL_FreeSurface(referenceSurface);
   1.133     referenceSurface = NULL;
   1.134 @@ -665,6 +703,9 @@
   1.135     /* Test Mod. */
   1.136     _testBlitBlendMode( tface, SDL_BLENDMODE_MOD);
   1.137     referenceSurface = SDLTest_ImageBlitBlendMod();
   1.138 +
   1.139 +   /* Make current and compare */
   1.140 +   SDL_RenderPresent(renderer);
   1.141     _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
   1.142     SDL_FreeSurface(referenceSurface);
   1.143     referenceSurface = NULL;
   1.144 @@ -712,6 +753,9 @@
   1.145     /* Clean up. */
   1.146     SDL_DestroyTexture( tface );
   1.147  
   1.148 +   /* Make current */
   1.149 +   SDL_RenderPresent(renderer);
   1.150 +
   1.151     /* Check to see if final image matches. */
   1.152     referenceSurface = SDLTest_ImageBlitBlendAll();
   1.153     _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
   1.154 @@ -984,7 +1028,8 @@
   1.155   *
   1.156   * \sa
   1.157   * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
   1.158 - * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
   1.159 + * http://wiki.libsdl.org/moin.cgi/SDL_RenderClear
   1.160 + * http://wiki.libsdl.org/moin.cgi/SDL_RenderPresent
   1.161   * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
   1.162   */
   1.163  static int
   1.164 @@ -997,8 +1042,11 @@
   1.165     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
   1.166  
   1.167     /* Clear screen. */
   1.168 -   ret = SDL_RenderFillRect(renderer, NULL );
   1.169 -   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
   1.170 +   ret = SDL_RenderClear(renderer);
   1.171 +   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderClear, expected: 0, got: %i", ret);
   1.172 +
   1.173 +   /* Make current */
   1.174 +   SDL_RenderPresent(renderer);
   1.175  
   1.176     /* Set defaults. */
   1.177     ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );