testautomation: verify that RLE operation output is correct

This commit is contained in:
Sam Lantinga
2025-10-29 09:07:56 -07:00
parent bf0752a8d7
commit 84fac6ca44
3 changed files with 116 additions and 0 deletions

View File

@@ -864,6 +864,7 @@ static int SDLCALL surface_testSurfaceNULLPixels(void *arg)
static int SDLCALL surface_testSurfaceRLEPixels(void *arg)
{
SDL_Surface *face, *a, *b, *tmp;
int ret;
bool result;
face = SDLTest_ImageFace();
@@ -883,6 +884,8 @@ static int SDLCALL surface_testSurfaceRLEPixels(void *arg)
a = SDL_DuplicateSurface(face);
SDLTest_AssertCheck(a != NULL, "Verify result from SDL_DuplicateSurface() with RLE pixels is not NULL");
SDLTest_AssertCheck(SDL_SurfaceHasRLE(a), "Verify result from SDL_DuplicateSurface() with RLE pixels has RLE set");
ret = SDLTest_CompareSurfaces(a, face, 0);
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
/* Verify that blitting from an RLE surface does RLE encode it */
SDLTest_AssertCheck(!SDL_MUSTLOCK(a), "Verify initial RLE surface does not need to be locked");
@@ -891,6 +894,8 @@ static int SDLCALL surface_testSurfaceRLEPixels(void *arg)
SDLTest_AssertCheck(result, "Verify result from SDL_BlitSurface() with RLE surface is true");
SDLTest_AssertCheck(SDL_MUSTLOCK(a), "Verify RLE surface after blit needs to be locked");
SDLTest_AssertCheck(a->pixels == NULL, "Verify RLE surface after blit does not have pixels available");
ret = SDLTest_CompareSurfaces(tmp, face, 0);
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
/* Test scaling with RLE pixels */
b = SDL_ScaleSurface(a, a->w * 2, a->h * 2, SDL_SCALEMODE_NEAREST);
@@ -908,6 +913,8 @@ static int SDLCALL surface_testSurfaceRLEPixels(void *arg)
b = SDL_ConvertSurfaceAndColorspace(a, SDL_PIXELFORMAT_ABGR8888, NULL, SDL_COLORSPACE_UNKNOWN, 0);
SDLTest_AssertCheck(b != NULL, "Verify result from SDL_ConvertSurfaceAndColorspace() with RLE pixels is not NULL");
SDLTest_AssertCheck(SDL_SurfaceHasRLE(b), "Verify result from SDL_ConvertSurfaceAndColorspace() with RLE pixels has RLE set");
ret = SDLTest_CompareSurfacesIgnoreTransparentPixels(b, face, 0);
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
SDL_BlitSurface(a, NULL, tmp, NULL);
SDL_DestroySurface(b);
b = NULL;