comparison test/automated/render/render.c @ 3449:7bd010656baf

Fixes for the automated rendering test
author Sam Lantinga <slouken@libsdl.org>
date Wed, 18 Nov 2009 09:07:13 +0000
parents de72b49bb695
children bb35055cb101
comparison
equal deleted inserted replaced
3448:bc27e1fdd3a7 3449:7bd010656baf
65 pix = malloc( 4*80*60 ); 65 pix = malloc( 4*80*60 );
66 if (SDL_ATassert( "malloc", pix!=NULL )) 66 if (SDL_ATassert( "malloc", pix!=NULL ))
67 return 1; 67 return 1;
68 68
69 /* Read pixels. */ 69 /* Read pixels. */
70 SDL_RenderPresent();
71 ret = SDL_RenderReadPixels( NULL, FORMAT, pix, 80*4 ); 70 ret = SDL_RenderReadPixels( NULL, FORMAT, pix, 80*4 );
72 if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) ) 71 if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) )
73 return 1; 72 return 1;
74 73
75 /* Create surface. */ 74 /* Create surface. */
790 /* Test None. */ 789 /* Test None. */
791 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_NONE )) 790 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_NONE ))
792 return -1; 791 return -1;
793 /* See if it's the same. */ 792 /* See if it's the same. */
794 if (render_compare( "Blit blending output not the same (using SDL_BLENDMODE_NONE).", 793 if (render_compare( "Blit blending output not the same (using SDL_BLENDMODE_NONE).",
795 &img_blitAlpha )) 794 &img_blendNone ))
796 return -1; 795 return -1;
797 796
798 /* Test Mask. */ 797 /* Test Mask. */
799 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_MASK )) 798 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_MASK ))
800 return -1; 799 return -1;
962 /* Get video mode. */ 961 /* Get video mode. */
963 driver = SDL_GetVideoDriver(i); 962 driver = SDL_GetVideoDriver(i);
964 if (driver == NULL) 963 if (driver == NULL)
965 goto err; 964 goto err;
966 SDL_ATprintVerbose( 1, " %d) %s\n", i+1, driver ); 965 SDL_ATprintVerbose( 1, " %d) %s\n", i+1, driver );
967 /* Hack to avoid dummy driver. */
968 if (strcmp(driver,"dummy")==0)
969 continue;
970 966
971 /* 967 /*
972 * Initialize testsuite. 968 * Initialize testsuite.
973 */ 969 */
974 snprintf( msg, sizeof(msg) , "Rendering with %s driver", driver ); 970 snprintf( msg, sizeof(msg) , "Rendering with %s driver", driver );
979 */ 975 */
980 SDL_ATbegin( "Initializing video mode" ); 976 SDL_ATbegin( "Initializing video mode" );
981 /* Initialize video mode. */ 977 /* Initialize video mode. */
982 ret = SDL_VideoInit( driver, 0 ); 978 ret = SDL_VideoInit( driver, 0 );
983 if (SDL_ATvassert( ret==0, "SDL_VideoInit( %s, 0 )", driver )) 979 if (SDL_ATvassert( ret==0, "SDL_VideoInit( %s, 0 )", driver ))
984 goto err; 980 goto err_cleanup;
985 /* Check to see if it's the one we want. */ 981 /* Check to see if it's the one we want. */
986 str = SDL_GetCurrentVideoDriver(); 982 str = SDL_GetCurrentVideoDriver();
987 if (SDL_ATassert( "SDL_GetCurrentVideoDriver", strcmp(driver,str)==0)) 983 if (SDL_ATassert( "SDL_GetCurrentVideoDriver", strcmp(driver,str)==0))
988 goto err; 984 goto err_cleanup;
989 /* Create window. */ 985 /* Create window. */
990 wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 986 wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
991 80, 60, SDL_WINDOW_SHOWN ); 987 80, 60, 0 );
992 if (SDL_ATassert( "SDL_CreateWindow", wid!=0 )) 988 if (SDL_ATassert( "SDL_CreateWindow", wid!=0 ))
993 goto err; 989 goto err_cleanup;
994 /* Check title. */ 990 /* Check title. */
995 str = SDL_GetWindowTitle( wid ); 991 str = SDL_GetWindowTitle( wid );
996 if (SDL_ATassert( "SDL_GetWindowTitle", strcmp(msg,str)==0)) 992 if (SDL_ATassert( "SDL_GetWindowTitle", strcmp(msg,str)==0))
997 goto err; 993 goto err_cleanup;
998 /* Get renderers. */ 994 /* Get renderers. */
999 nr = SDL_GetNumRenderDrivers(); 995 nr = SDL_GetNumRenderDrivers();
1000 if (SDL_ATassert("SDL_GetNumRenderDrivers", nr>=0)) 996 if (SDL_ATassert("SDL_GetNumRenderDrivers", nr>=0))
1001 goto err; 997 goto err_cleanup;
1002 SDL_ATprintVerbose( 1, " %d Render Drivers\n", nr ); 998 SDL_ATprintVerbose( 1, " %d Render Drivers\n", nr );
1003 SDL_ATend(); 999 SDL_ATend();
1004 for (j=0; j<nr; j++) { 1000 for (j=0; j<nr; j++) {
1005 1001
1006 /* Get renderer info. */ 1002 /* Get renderer info. */
1007 ret = SDL_GetRenderDriverInfo( j, &renderer ); 1003 ret = SDL_GetRenderDriverInfo( j, &renderer );
1008 if (ret != 0) 1004 if (ret != 0)
1009 goto err; 1005 goto err_cleanup;
1010 /* Set testcase name. */ 1006 /* Set testcase name. */
1011 snprintf( msg, sizeof(msg), "Renderer %s", renderer.name ); 1007 snprintf( msg, sizeof(msg), "Renderer %s", renderer.name );
1012 SDL_ATprintVerbose( 1, " %d) %s\n", j+1, renderer.name ); 1008 SDL_ATprintVerbose( 1, " %d) %s\n", j+1, renderer.name );
1013 SDL_ATbegin( msg ); 1009 SDL_ATbegin( msg );
1014 /* Set renderer. */ 1010 /* Set renderer. */
1015 ret = SDL_CreateRenderer( wid, j, 0 ); 1011 ret = SDL_CreateRenderer( wid, j, 0 );
1016 if (SDL_ATassert( "SDL_CreateRenderer", ret==0 )) 1012 if (SDL_ATassert( "SDL_CreateRenderer", ret==0 ))
1017 goto err; 1013 goto err_cleanup;
1018 1014
1019 /* 1015 /*
1020 * Run tests. 1016 * Run tests.
1021 */ 1017 */
1022 ret = render_runTests(); 1018 ret = render_runTests();
1039 /* Exit SDL. */ 1035 /* Exit SDL. */
1040 SDL_Quit(); 1036 SDL_Quit();
1041 1037
1042 return failed; 1038 return failed;
1043 1039
1040 err_cleanup:
1041 SDL_ATfinish();
1042
1044 err: 1043 err:
1045 return 1; 1044 return 1;
1046 } 1045 }
1047 1046