Fixed testautomation --filter pixels_allocFreeFormat

This commit is contained in:
Sam Lantinga 2023-08-25 08:06:08 -07:00
parent 6f8a6a31ca
commit 34860b932b

View file

@ -122,7 +122,7 @@ static int pixels_allocFreeFormat(void *arg)
/* Blank/unknown format */ /* Blank/unknown format */
format = 0; format = 0;
SDLTest_Log("RGB Format: %s (%" SDL_PRIu32 ")", unknownFormat, format); SDLTest_Log("Pixel Format: %s (%" SDL_PRIu32 ")", unknownFormat, format);
/* Allocate format */ /* Allocate format */
result = SDL_CreatePixelFormat(format); result = SDL_CreatePixelFormat(format);
@ -143,7 +143,7 @@ static int pixels_allocFreeFormat(void *arg)
/* RGB formats */ /* RGB formats */
for (i = 0; i < g_numAllFormats; i++) { for (i = 0; i < g_numAllFormats; i++) {
format = g_AllFormats[i]; format = g_AllFormats[i];
SDLTest_Log("RGB Format: %s (%" SDL_PRIu32 ")", g_AllFormatsVerbose[i], format); SDLTest_Log("Pixel Format: %s (%" SDL_PRIu32 ")", g_AllFormatsVerbose[i], format);
/* Allocate format */ /* Allocate format */
result = SDL_CreatePixelFormat(format); result = SDL_CreatePixelFormat(format);
@ -151,12 +151,14 @@ static int pixels_allocFreeFormat(void *arg)
SDLTest_AssertCheck(result != NULL, "Verify result is not NULL"); SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
if (result != NULL) { if (result != NULL) {
SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %" SDL_PRIu32 ", got %" SDL_PRIu32, format, result->format); SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %" SDL_PRIu32 ", got %" SDL_PRIu32, format, result->format);
if (!SDL_ISPIXELFORMAT_FOURCC(format)) {
SDLTest_AssertCheck(result->BitsPerPixel > 0, "Verify value of result.BitsPerPixel; expected: >0, got %u", result->BitsPerPixel); SDLTest_AssertCheck(result->BitsPerPixel > 0, "Verify value of result.BitsPerPixel; expected: >0, got %u", result->BitsPerPixel);
SDLTest_AssertCheck(result->BytesPerPixel > 0, "Verify value of result.BytesPerPixel; expected: >0, got %u", result->BytesPerPixel); SDLTest_AssertCheck(result->BytesPerPixel > 0, "Verify value of result.BytesPerPixel; expected: >0, got %u", result->BytesPerPixel);
if (result->palette != NULL && !SDL_ISPIXELFORMAT_FOURCC(result->format)) { if (!SDL_ISPIXELFORMAT_INDEXED(format)) {
masks = result->Rmask | result->Gmask | result->Bmask | result->Amask; masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
SDLTest_AssertCheck(masks > 0, "Verify value of result.[RGBA]mask combined; expected: >0, got %" SDL_PRIu32, masks); SDLTest_AssertCheck(masks > 0, "Verify value of result.[RGBA]mask combined; expected: >0, got %" SDL_PRIu32, masks);
} }
}
/* Deallocate again */ /* Deallocate again */
SDL_DestroyPixelFormat(result); SDL_DestroyPixelFormat(result);