@@ -989,6 +989,45 @@ static int SDLCALL surface_testBlitInvalid(void *arg)
989
989
return TEST_COMPLETED ;
990
990
}
991
991
992
+ static int SDLCALL surface_testBlitsWithBadCoordinates (void * arg )
993
+ {
994
+ const SDL_Rect rect [8 ] = {
995
+ { SDL_MAX_SINT32 , 0 , 2 , 2 },
996
+ { 0 , SDL_MAX_SINT32 , 2 , 2 },
997
+ { 0 , 0 , SDL_MAX_SINT32 , 2 },
998
+ { 0 , 0 , 2 , SDL_MAX_SINT32 },
999
+ { SDL_MIN_SINT32 , 0 , 2 , 2 },
1000
+ { 0 , SDL_MIN_SINT32 , 2 , 2 },
1001
+ { 0 , 0 , SDL_MIN_SINT32 , 2 },
1002
+ { 0 , 0 , 2 , SDL_MIN_SINT32 }
1003
+ };
1004
+
1005
+ SDL_Surface * s ;
1006
+ bool result ;
1007
+ int i ;
1008
+
1009
+ s = SDL_CreateSurface (1 , 1 , SDL_PIXELFORMAT_RGBA8888 );
1010
+ SDLTest_AssertCheck (s != NULL , "Check surface creation" );
1011
+
1012
+ for (i = 0 ; i < 8 ; i ++ ) {
1013
+ result = SDL_BlitSurface (s , NULL , s , & rect [i ]);
1014
+ SDLTest_AssertCheck (result == true, "SDL_BlitSurface(valid, NULL, valid, &rect), result = %s" , result ? "true" : "false" );
1015
+
1016
+ result = SDL_BlitSurface (s , & rect [i ], s , NULL );
1017
+ SDLTest_AssertCheck (result == true, "SDL_BlitSurface(valid, &rect, valid, NULL), result = %s" , result ? "true" : "false" );
1018
+
1019
+ result = SDL_BlitSurfaceScaled (s , NULL , s , & rect [i ], SDL_SCALEMODE_NEAREST );
1020
+ SDLTest_AssertCheck (result == true, "SDL_BlitSurfaceScaled(valid, NULL, valid, &rect, SDL_SCALEMODE_NEAREST), result = %s" , result ? "true" : "false" );
1021
+
1022
+ result = SDL_BlitSurfaceScaled (s , & rect [i ], s , NULL , SDL_SCALEMODE_NEAREST );
1023
+ SDLTest_AssertCheck (result == true, "SDL_BlitSurfaceScaled(valid, &rect, valid, NULL, SDL_SCALEMODE_NEAREST), result = %s" , result ? "true" : "false" );
1024
+ }
1025
+
1026
+ SDL_DestroySurface (s );
1027
+
1028
+ return TEST_COMPLETED ;
1029
+ }
1030
+
992
1031
static int SDLCALL surface_testOverflow (void * arg )
993
1032
{
994
1033
char buf [1024 ];
@@ -1666,6 +1705,10 @@ static const SDLTest_TestCaseReference surfaceTestBlitInvalid = {
1666
1705
surface_testBlitInvalid , "surface_testBlitInvalid" , "Tests blitting routines with invalid surfaces." , TEST_ENABLED
1667
1706
};
1668
1707
1708
+ static const SDLTest_TestCaseReference surfaceTestBlitsWithBadCoordinates = {
1709
+ surface_testBlitsWithBadCoordinates , "surface_testBlitsWithBadCoordinates" , "Test blitting routines with bad coordinates." , TEST_ENABLED
1710
+ };
1711
+
1669
1712
static const SDLTest_TestCaseReference surfaceTestOverflow = {
1670
1713
surface_testOverflow , "surface_testOverflow" , "Test overflow detection." , TEST_ENABLED
1671
1714
};
@@ -1715,6 +1758,7 @@ static const SDLTest_TestCaseReference *surfaceTests[] = {
1715
1758
& surfaceTestBlitBlendMod ,
1716
1759
& surfaceTestBlitBlendMul ,
1717
1760
& surfaceTestBlitInvalid ,
1761
+ & surfaceTestBlitsWithBadCoordinates ,
1718
1762
& surfaceTestOverflow ,
1719
1763
& surfaceTestFlip ,
1720
1764
& surfaceTestPalette ,
0 commit comments