Parcourir la source

Fixed testautomation --filter pixels_allocFreeFormat

Sam Lantinga il y a 1 an
Parent
commit
34860b932b
1 fichiers modifiés avec 9 ajouts et 7 suppressions
  1. 9 7
      test/testautomation_pixels.c

+ 9 - 7
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 */