diff test/automated/render/render.c @ 3747:f7a3a47e6b50 gsoc2009_unit_tests

Fixed errors detected by valgrind.
author Edgar Simo <bobbens@gmail.com>
date Tue, 04 Aug 2009 16:39:15 +0000
parents 848b5263ab05
children 5b48a529fd8a
line wrap: on
line diff
--- a/test/automated/render/render.c	Tue Aug 04 16:34:04 2009 +0000
+++ b/test/automated/render/render.c	Tue Aug 04 16:39:15 2009 +0000
@@ -570,15 +570,15 @@
    if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
       return -1;
 
-   /* Clean up. */
-   SDL_FreeSurface( face );
-
    /* Constant values. */
    rect.w = face->w;
    rect.h = face->h;
    ni     = SCREEN_W - face->w;
    nj     = SCREEN_H - face->h;
 
+   /* Clean up. */
+   SDL_FreeSurface( face );
+
    /* Loop blit. */
    for (j=0; j <= nj; j+=4) {
       for (i=0; i <= ni; i+=4) {
@@ -631,15 +631,15 @@
    if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
       return -1;
 
-   /* Clean up. */
-   SDL_FreeSurface( face );
-
    /* Constant values. */
    rect.w = face->w;
    rect.h = face->h;
    ni     = SCREEN_W - face->w;
    nj     = SCREEN_H - face->h;
 
+   /* Clean up. */
+   SDL_FreeSurface( face );
+
    /* Test blitting with colour mod. */
    for (j=0; j <= nj; j+=4) {
       for (i=0; i <= ni; i+=4) {
@@ -698,15 +698,15 @@
    if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
       return -1;
 
-   /* Clean up. */
-   SDL_FreeSurface( face );
-
    /* Constant values. */
    rect.w = face->w;
    rect.h = face->h;
    ni     = SCREEN_W - face->w;
    nj     = SCREEN_H - face->h;
 
+   /* Clean up. */
+   SDL_FreeSurface( face );
+
    /* Clear surface. */
    if (render_clearScreen())
       return -1;
@@ -812,6 +812,14 @@
    if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
       return -1;
 
+   /* Steps to take. */
+   ni     = SCREEN_W - FACE_W;
+   nj     = SCREEN_H - FACE_H;
+
+   /* Constant values. */
+   rect.w = face->w;
+   rect.h = face->h;
+
    /* Clean up. */
    SDL_FreeSurface( face );
 
@@ -820,14 +828,6 @@
    if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
       return -1;
 
-   /* Steps to take. */
-   ni     = SCREEN_W - FACE_W;
-   nj     = SCREEN_H - FACE_H;
-
-   /* Constant values. */
-   rect.w = face->w;
-   rect.h = face->h;
-
    /* Test None. */
    if (render_testBlitBlendMode( tface, SDL_BLENDMODE_NONE ))
       return -1;