test/testautomation_render.c
changeset 7191 75360622e65f
parent 7176 66cf9f85494e
child 7719 31b5f9ff36ca
     1.1 --- a/test/testautomation_render.c	Sat May 18 12:48:50 2013 -0700
     1.2 +++ b/test/testautomation_render.c	Sat May 18 14:17:52 2013 -0700
     1.3 @@ -19,8 +19,8 @@
     1.4  #define RENDER_COMPARE_GMASK   0x0000ff00 /**< Green bit mask. */
     1.5  #define RENDER_COMPARE_BMASK   0x000000ff /**< Blue bit mask. */
     1.6  
     1.7 -#define ALLOWABLE_ERROR_OPAQUE	0
     1.8 -#define ALLOWABLE_ERROR_BLENDED	64
     1.9 +#define ALLOWABLE_ERROR_OPAQUE  0
    1.10 +#define ALLOWABLE_ERROR_BLENDED 64
    1.11  
    1.12  /* Test window and renderer */
    1.13  SDL_Window *window = NULL;
    1.14 @@ -50,7 +50,7 @@
    1.15    if (window == NULL) {
    1.16        return;
    1.17    }
    1.18 -  
    1.19 +
    1.20    renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
    1.21    SDLTest_AssertPass("SDL_CreateRenderer()");
    1.22    SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result");
    1.23 @@ -61,17 +61,17 @@
    1.24  }
    1.25  
    1.26  /*
    1.27 - * Destroy renderer for tests  
    1.28 + * Destroy renderer for tests
    1.29   */
    1.30  void CleanupDestroyRenderer(void *arg)
    1.31  {
    1.32 -  if (renderer != NULL) {  
    1.33 +  if (renderer != NULL) {
    1.34       SDL_DestroyRenderer(renderer);
    1.35       renderer = NULL;
    1.36       SDLTest_AssertPass("SDL_DestroyRenderer()");
    1.37    }
    1.38 -  
    1.39 -  if (window != NULL) {  
    1.40 +
    1.41 +  if (window != NULL) {
    1.42       SDL_DestroyWindow(window);
    1.43       window = NULL;
    1.44       SDLTest_AssertPass("SDL_DestroyWindow");
    1.45 @@ -288,7 +288,7 @@
    1.46     SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
    1.47     SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
    1.48     SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
    1.49 -   
    1.50 +
    1.51     checkFailCount1 = 0;
    1.52     checkFailCount2 = 0;
    1.53     checkFailCount3 = 0;
    1.54 @@ -323,7 +323,7 @@
    1.55           ret = SDL_RenderDrawPoint(renderer, i, j );
    1.56           if (ret != 0) checkFailCount3++;
    1.57        }
    1.58 -   }   
    1.59 +   }
    1.60     SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
    1.61     SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
    1.62     SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
    1.63 @@ -533,7 +533,7 @@
    1.64           ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
    1.65           if (ret != 0) checkFailCount2++;
    1.66        }
    1.67 -   }   
    1.68 +   }
    1.69     SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
    1.70     SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
    1.71  
    1.72 @@ -654,12 +654,12 @@
    1.73     /* Test None. */
    1.74     _testBlitBlendMode( tface, SDL_BLENDMODE_NONE );
    1.75     referenceSurface = SDLTest_ImageBlitBlendNone();
    1.76 -   _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE ); 
    1.77 +   _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
    1.78     if (referenceSurface != NULL) {
    1.79        SDL_FreeSurface(referenceSurface);
    1.80        referenceSurface = NULL;
    1.81     }
    1.82 -   
    1.83 +
    1.84     /* Test Blend. */
    1.85     _testBlitBlendMode( tface, SDL_BLENDMODE_BLEND );
    1.86     referenceSurface = SDLTest_ImageBlitBlend();
    1.87 @@ -773,7 +773,7 @@
    1.88     ret = SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a );
    1.89     if (!_isSupported(ret))
    1.90        fail = 1;
    1.91 -      
    1.92 +
    1.93     /* Restore natural. */
    1.94     ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
    1.95     if (!_isSupported(ret))
    1.96 @@ -782,7 +782,7 @@
    1.97     /* Something failed, consider not available. */
    1.98     if (fail)
    1.99        return 0;
   1.100 -      
   1.101 +
   1.102     /* Not set properly, consider failed. */
   1.103     else if ((r != 100) || (g != 100) || (b != 100) || (a != 100))
   1.104        return 0;
   1.105 @@ -862,7 +862,7 @@
   1.106     if (face == NULL) {
   1.107        return NULL;
   1.108     }
   1.109 -   
   1.110 +
   1.111     tface = SDL_CreateTextureFromSurface(renderer, face);
   1.112     if (tface == NULL) {
   1.113         SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
   1.114 @@ -996,7 +996,7 @@
   1.115  
   1.116     /* Clean up. */
   1.117     if (pixels != NULL) {
   1.118 -	   SDL_free(pixels);
   1.119 +       SDL_free(pixels);
   1.120     }
   1.121     if (testSurface != NULL) {
   1.122         SDL_FreeSurface(testSurface);
   1.123 @@ -1038,38 +1038,38 @@
   1.124  
   1.125  /* Render test cases */
   1.126  static const SDLTest_TestCaseReference renderTest1 =
   1.127 -		{ (SDLTest_TestCaseFp)render_testGetNumRenderDrivers, "render_testGetNumRenderDrivers", "Tests call to SDL_GetNumRenderDrivers", TEST_ENABLED };
   1.128 +        { (SDLTest_TestCaseFp)render_testGetNumRenderDrivers, "render_testGetNumRenderDrivers", "Tests call to SDL_GetNumRenderDrivers", TEST_ENABLED };
   1.129  
   1.130  static const SDLTest_TestCaseReference renderTest2 =
   1.131 -		{ (SDLTest_TestCaseFp)render_testPrimitives, "render_testPrimitives", "Tests rendering primitives", TEST_ENABLED };
   1.132 +        { (SDLTest_TestCaseFp)render_testPrimitives, "render_testPrimitives", "Tests rendering primitives", TEST_ENABLED };
   1.133  
   1.134  /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
   1.135  static const SDLTest_TestCaseReference renderTest3 =
   1.136 -		{ (SDLTest_TestCaseFp)render_testPrimitivesBlend, "render_testPrimitivesBlend", "Tests rendering primitives with blending", TEST_DISABLED };
   1.137 +        { (SDLTest_TestCaseFp)render_testPrimitivesBlend, "render_testPrimitivesBlend", "Tests rendering primitives with blending", TEST_DISABLED };
   1.138  
   1.139  static const SDLTest_TestCaseReference renderTest4 =
   1.140 -		{ (SDLTest_TestCaseFp)render_testBlit, "render_testBlit", "Tests blitting", TEST_ENABLED };
   1.141 +        { (SDLTest_TestCaseFp)render_testBlit, "render_testBlit", "Tests blitting", TEST_ENABLED };
   1.142  
   1.143  static const SDLTest_TestCaseReference renderTest5 =
   1.144 -		{ (SDLTest_TestCaseFp)render_testBlitColor, "render_testBlitColor", "Tests blitting with color", TEST_ENABLED };
   1.145 +        { (SDLTest_TestCaseFp)render_testBlitColor, "render_testBlitColor", "Tests blitting with color", TEST_ENABLED };
   1.146  
   1.147  /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
   1.148  static const SDLTest_TestCaseReference renderTest6 =
   1.149 -		{ (SDLTest_TestCaseFp)render_testBlitAlpha, "render_testBlitAlpha", "Tests blitting with alpha", TEST_DISABLED };
   1.150 +        { (SDLTest_TestCaseFp)render_testBlitAlpha, "render_testBlitAlpha", "Tests blitting with alpha", TEST_DISABLED };
   1.151  
   1.152  /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
   1.153  static const SDLTest_TestCaseReference renderTest7 =
   1.154 -		{  (SDLTest_TestCaseFp)render_testBlitBlend, "render_testBlitBlend", "Tests blitting with blending", TEST_DISABLED };
   1.155 +        {  (SDLTest_TestCaseFp)render_testBlitBlend, "render_testBlitBlend", "Tests blitting with blending", TEST_DISABLED };
   1.156  
   1.157  /* Sequence of Render test cases */
   1.158  static const SDLTest_TestCaseReference *renderTests[] =  {
   1.159 -	&renderTest1, &renderTest2, &renderTest3, &renderTest4, &renderTest5, &renderTest6, &renderTest7, NULL
   1.160 +    &renderTest1, &renderTest2, &renderTest3, &renderTest4, &renderTest5, &renderTest6, &renderTest7, NULL
   1.161  };
   1.162  
   1.163  /* Render test suite (global) */
   1.164  SDLTest_TestSuiteReference renderTestSuite = {
   1.165 -	"Render",
   1.166 -	InitCreateRenderer,
   1.167 -	renderTests,
   1.168 -	CleanupDestroyRenderer
   1.169 +    "Render",
   1.170 +    InitCreateRenderer,
   1.171 +    renderTests,
   1.172 +    CleanupDestroyRenderer
   1.173  };