Test both MSB and LSB indexed surfaces in testautomation

main
Cameron Cawley 2023-11-17 11:42:14 +00:00 committed by Sam Lantinga
parent 39870031d1
commit fda69e5e79
1 changed files with 7 additions and 7 deletions

View File

@ -632,12 +632,12 @@ static int surface_testOverflow(void *arg)
/* Less than 1 byte per pixel: the pitch can legitimately be less than
* the width, but it must be enough to hold the appropriate number of
* bits per pixel. SDL_PIXELFORMAT_INDEX4LSB* needs 1 byte per 2 pixels. */
* bits per pixel. SDL_PIXELFORMAT_INDEX4* needs 1 byte per 2 pixels. */
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 3, SDL_PIXELFORMAT_INDEX4MSB);
SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_DestroySurface(surface);
@ -646,7 +646,7 @@ static int surface_testOverflow(void *arg)
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 3, SDL_PIXELFORMAT_INDEX4MSB);
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
@ -655,7 +655,7 @@ static int surface_testOverflow(void *arg)
SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 4, SDL_PIXELFORMAT_INDEX4LSB);
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 4, SDL_PIXELFORMAT_INDEX4MSB);
SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_DestroySurface(surface);
@ -665,7 +665,7 @@ static int surface_testOverflow(void *arg)
SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 16, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
surface = SDL_CreateSurfaceFrom(buf, 16, 1, 2, SDL_PIXELFORMAT_INDEX1MSB);
SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_DestroySurface(surface);
@ -674,7 +674,7 @@ static int surface_testOverflow(void *arg)
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 2, SDL_PIXELFORMAT_INDEX1MSB);
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
@ -683,7 +683,7 @@ static int surface_testOverflow(void *arg)
SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 3, SDL_PIXELFORMAT_INDEX1LSB);
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 3, SDL_PIXELFORMAT_INDEX1MSB);
SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_DestroySurface(surface);