Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
1. SDL_RenderPresent() call has been added after each test to be sure…
…, that all graphics output is flushed in case if it was asynchronous.

2. After each renderer test window recreation has been added.
  • Loading branch information
llmike committed Nov 20, 2009
1 parent b6a854f commit 6c782d9
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions test/automated/render/render.c
Expand Up @@ -329,6 +329,9 @@ static int render_clearScreen (void)
return -1;
*/

/* Flush all asynchronous operations */
SDL_RenderPresent();

return 0;
}

Expand Down Expand Up @@ -410,6 +413,9 @@ static int render_testPrimitives (void)
if (SDL_ATassert( "SDL_RenderLine", ret == 0))
return -1;

/* Flush all asynchronous operations */
SDL_RenderPresent();

/* See if it's the same. */
if (render_compare( "Primitives output not the same.", &img_primitives ))
return -1;
Expand Down Expand Up @@ -527,6 +533,9 @@ static int render_testPrimitivesBlend (void)
}
}

/* Flush all asynchronous operations */
SDL_RenderPresent();

/* See if it's the same. */
if (render_compare( "Blended primitives output not the same.", &img_blend ))
return -1;
Expand Down Expand Up @@ -579,6 +588,9 @@ static int render_testBlit (void)
/* Clean up. */
SDL_DestroyTexture( tface );

/* Flush all asynchronous operations */
SDL_RenderPresent();

/* See if it's the same. */
if (render_compare( "Blit output not the same.", &img_blit ))
return -1;
Expand Down Expand Up @@ -636,6 +648,9 @@ static int render_testBlitColour (void)
/* Clean up. */
SDL_DestroyTexture( tface );

/* Flush all asynchronous operations */
SDL_RenderPresent();

/* See if it's the same. */
if (render_compare( "Blit output not the same (using SDL_SetTextureColorMod).",
&img_blitColour ))
Expand Down Expand Up @@ -698,6 +713,9 @@ static int render_testBlitAlpha (void)
/* Clean up. */
SDL_DestroyTexture( tface );

/* Flush all asynchronous operations */
SDL_RenderPresent();

/* See if it's the same. */
if (render_compare( "Blit output not the same (using SDL_SetSurfaceAlphaMod).",
&img_blitAlpha ))
Expand Down Expand Up @@ -745,6 +763,9 @@ static int render_testBlitBlendMode( SDL_TextureID tface, int mode )
}
}

/* Flush all asynchronous operations */
SDL_RenderPresent();

return 0;
}

Expand Down Expand Up @@ -862,6 +883,9 @@ static int render_testBlitBlend (void)
/* Clean up. */
SDL_DestroyTexture( tface );

/* Flush all asynchronous operations */
SDL_RenderPresent();

/* Check to see if matches. */
if (render_compare( "Blit blending output not the same (using SDL_BLENDMODE_*).",
&img_blendAll ))
Expand All @@ -879,7 +903,7 @@ static int render_testBlitBlend (void)
int render_runTests (void)
{
int ret;

/* No error. */
ret = 0;

Expand Down Expand Up @@ -911,7 +935,6 @@ int render_runTests (void)
return -1;
ret = render_testBlitBlend();


return ret;
}

Expand Down Expand Up @@ -1004,6 +1027,14 @@ int test_render (void)
SDL_ATend();
for (j=0; j<nr; j++) {

/* We have to recreate window each time, because opengl and opengles renderers */
/* both add SDL_WINDOW_OPENGL flag for window, that was last used */
SDL_DestroyWindow(wid);
wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
80, 60, 0 );
if (SDL_ATassert( "SDL_CreateWindow", wid!=0 ))
goto err_cleanup;

/* Get renderer info. */
ret = SDL_GetRenderDriverInfo( j, &renderer );
if (ret != 0)
Expand All @@ -1021,9 +1052,9 @@ int test_render (void)
* Run tests.
*/
ret = render_runTests();

if (ret)
continue;

SDL_ATend();
}

Expand All @@ -1036,7 +1067,6 @@ int test_render (void)
failed += SDL_ATfinish();
}


/* Exit SDL. */
SDL_Quit();

Expand Down

0 comments on commit 6c782d9

Please sign in to comment.