comparison test/automated/render/render.c @ 3464:09136f534198

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.
author Mike Gorchak <lestat@i.com.ua>
date Fri, 20 Nov 2009 07:11:29 +0000
parents bb35055cb101
children a288892cd24c
comparison
equal deleted inserted replaced
3463:06c66b8d5033 3464:09136f534198
327 /* 327 /*
328 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) 328 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
329 return -1; 329 return -1;
330 */ 330 */
331 331
332 /* Flush all asynchronous operations */
333 SDL_RenderPresent();
334
332 return 0; 335 return 0;
333 } 336 }
334 337
335 338
336 /** 339 /**
407 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) 410 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
408 return -1; 411 return -1;
409 ret = SDL_RenderLine( 0, 60, 80, 0 ); 412 ret = SDL_RenderLine( 0, 60, 80, 0 );
410 if (SDL_ATassert( "SDL_RenderLine", ret == 0)) 413 if (SDL_ATassert( "SDL_RenderLine", ret == 0))
411 return -1; 414 return -1;
415
416 /* Flush all asynchronous operations */
417 SDL_RenderPresent();
412 418
413 /* See if it's the same. */ 419 /* See if it's the same. */
414 if (render_compare( "Primitives output not the same.", &img_primitives )) 420 if (render_compare( "Primitives output not the same.", &img_primitives ))
415 return -1; 421 return -1;
416 422
525 if (SDL_ATassert( "SDL_RenderPoint", ret == 0)) 531 if (SDL_ATassert( "SDL_RenderPoint", ret == 0))
526 return -1; 532 return -1;
527 } 533 }
528 } 534 }
529 535
536 /* Flush all asynchronous operations */
537 SDL_RenderPresent();
538
530 /* See if it's the same. */ 539 /* See if it's the same. */
531 if (render_compare( "Blended primitives output not the same.", &img_blend )) 540 if (render_compare( "Blended primitives output not the same.", &img_blend ))
532 return -1; 541 return -1;
533 542
534 return 0; 543 return 0;
577 } 586 }
578 587
579 /* Clean up. */ 588 /* Clean up. */
580 SDL_DestroyTexture( tface ); 589 SDL_DestroyTexture( tface );
581 590
591 /* Flush all asynchronous operations */
592 SDL_RenderPresent();
593
582 /* See if it's the same. */ 594 /* See if it's the same. */
583 if (render_compare( "Blit output not the same.", &img_blit )) 595 if (render_compare( "Blit output not the same.", &img_blit ))
584 return -1; 596 return -1;
585 597
586 return 0; 598 return 0;
634 } 646 }
635 647
636 /* Clean up. */ 648 /* Clean up. */
637 SDL_DestroyTexture( tface ); 649 SDL_DestroyTexture( tface );
638 650
651 /* Flush all asynchronous operations */
652 SDL_RenderPresent();
653
639 /* See if it's the same. */ 654 /* See if it's the same. */
640 if (render_compare( "Blit output not the same (using SDL_SetTextureColorMod).", 655 if (render_compare( "Blit output not the same (using SDL_SetTextureColorMod).",
641 &img_blitColour )) 656 &img_blitColour ))
642 return -1; 657 return -1;
643 658
696 } 711 }
697 712
698 /* Clean up. */ 713 /* Clean up. */
699 SDL_DestroyTexture( tface ); 714 SDL_DestroyTexture( tface );
700 715
716 /* Flush all asynchronous operations */
717 SDL_RenderPresent();
718
701 /* See if it's the same. */ 719 /* See if it's the same. */
702 if (render_compare( "Blit output not the same (using SDL_SetSurfaceAlphaMod).", 720 if (render_compare( "Blit output not the same (using SDL_SetSurfaceAlphaMod).",
703 &img_blitAlpha )) 721 &img_blitAlpha ))
704 return -1; 722 return -1;
705 723
742 ret = SDL_RenderCopy( tface, NULL, &rect ); 760 ret = SDL_RenderCopy( tface, NULL, &rect );
743 if (SDL_ATassert( "SDL_RenderCopy", ret == 0)) 761 if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
744 return -1; 762 return -1;
745 } 763 }
746 } 764 }
765
766 /* Flush all asynchronous operations */
767 SDL_RenderPresent();
747 768
748 return 0; 769 return 0;
749 } 770 }
750 771
751 772
860 } 881 }
861 882
862 /* Clean up. */ 883 /* Clean up. */
863 SDL_DestroyTexture( tface ); 884 SDL_DestroyTexture( tface );
864 885
886 /* Flush all asynchronous operations */
887 SDL_RenderPresent();
888
865 /* Check to see if matches. */ 889 /* Check to see if matches. */
866 if (render_compare( "Blit blending output not the same (using SDL_BLENDMODE_*).", 890 if (render_compare( "Blit blending output not the same (using SDL_BLENDMODE_*).",
867 &img_blendAll )) 891 &img_blendAll ))
868 return -1; 892 return -1;
869 893
877 * @return 0 on success. 901 * @return 0 on success.
878 */ 902 */
879 int render_runTests (void) 903 int render_runTests (void)
880 { 904 {
881 int ret; 905 int ret;
882 906
883 /* No error. */ 907 /* No error. */
884 ret = 0; 908 ret = 0;
885 909
886 /* Test functionality first. */ 910 /* Test functionality first. */
887 if (render_hasDrawColor()) 911 if (render_hasDrawColor())
908 return -1; 932 return -1;
909 ret = render_testBlitAlpha(); 933 ret = render_testBlitAlpha();
910 if (ret) 934 if (ret)
911 return -1; 935 return -1;
912 ret = render_testBlitBlend(); 936 ret = render_testBlitBlend();
913
914 937
915 return ret; 938 return ret;
916 } 939 }
917 940
918 941
1002 goto err_cleanup; 1025 goto err_cleanup;
1003 SDL_ATprintVerbose( 1, " %d Render Drivers\n", nr ); 1026 SDL_ATprintVerbose( 1, " %d Render Drivers\n", nr );
1004 SDL_ATend(); 1027 SDL_ATend();
1005 for (j=0; j<nr; j++) { 1028 for (j=0; j<nr; j++) {
1006 1029
1030 /* We have to recreate window each time, because opengl and opengles renderers */
1031 /* both add SDL_WINDOW_OPENGL flag for window, that was last used */
1032 SDL_DestroyWindow(wid);
1033 wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
1034 80, 60, 0 );
1035 if (SDL_ATassert( "SDL_CreateWindow", wid!=0 ))
1036 goto err_cleanup;
1037
1007 /* Get renderer info. */ 1038 /* Get renderer info. */
1008 ret = SDL_GetRenderDriverInfo( j, &renderer ); 1039 ret = SDL_GetRenderDriverInfo( j, &renderer );
1009 if (ret != 0) 1040 if (ret != 0)
1010 goto err_cleanup; 1041 goto err_cleanup;
1011 /* Set testcase name. */ 1042 /* Set testcase name. */
1019 1050
1020 /* 1051 /*
1021 * Run tests. 1052 * Run tests.
1022 */ 1053 */
1023 ret = render_runTests(); 1054 ret = render_runTests();
1055
1024 if (ret) 1056 if (ret)
1025 continue; 1057 continue;
1026
1027 SDL_ATend(); 1058 SDL_ATend();
1028 } 1059 }
1029 1060
1030 /* Exit the current renderer. */ 1061 /* Exit the current renderer. */
1031 SDL_VideoQuit(); 1062 SDL_VideoQuit();
1034 * Finish testsuite. 1065 * Finish testsuite.
1035 */ 1066 */
1036 failed += SDL_ATfinish(); 1067 failed += SDL_ATfinish();
1037 } 1068 }
1038 1069
1039
1040 /* Exit SDL. */ 1070 /* Exit SDL. */
1041 SDL_Quit(); 1071 SDL_Quit();
1042 1072
1043 return failed; 1073 return failed;
1044 1074