From 34860b932bd016ea886d82e10239d45d672879c0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 25 Aug 2023 08:06:08 -0700 Subject: [PATCH] Fixed testautomation --filter pixels_allocFreeFormat --- test/testautomation_pixels.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/testautomation_pixels.c b/test/testautomation_pixels.c index 0af215d1e1..9980b561b2 100644 --- a/test/testautomation_pixels.c +++ b/test/testautomation_pixels.c @@ -122,7 +122,7 @@ static int pixels_allocFreeFormat(void *arg) /* Blank/unknown format */ format = 0; - SDLTest_Log("RGB Format: %s (%" SDL_PRIu32 ")", unknownFormat, format); + SDLTest_Log("Pixel Format: %s (%" SDL_PRIu32 ")", unknownFormat, format); /* Allocate format */ result = SDL_CreatePixelFormat(format); @@ -143,7 +143,7 @@ static int pixels_allocFreeFormat(void *arg) /* RGB formats */ for (i = 0; i < g_numAllFormats; 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 */ result = SDL_CreatePixelFormat(format); @@ -151,11 +151,13 @@ static int pixels_allocFreeFormat(void *arg) SDLTest_AssertCheck(result != NULL, "Verify result is not 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->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); - if (result->palette != NULL && !SDL_ISPIXELFORMAT_FOURCC(result->format)) { - 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); + if (!SDL_ISPIXELFORMAT_FOURCC(format)) { + 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); + if (!SDL_ISPIXELFORMAT_INDEXED(format)) { + 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); + } } /* Deallocate again */