diff test/automated/common/common.c @ 3439:0acec8c9f5c9

Fixed some bugs in the automated test suite, revealed by working SDL_RenderReadPixels()
author Sam Lantinga <slouken@libsdl.org>
date Tue, 17 Nov 2009 05:17:11 +0000
parents 22ac66da0765
children 5271ce790fed
line wrap: on
line diff
--- a/test/automated/common/common.c	Tue Nov 17 04:53:15 2009 +0000
+++ b/test/automated/common/common.c	Tue Nov 17 05:17:11 2009 +0000
@@ -46,9 +46,26 @@
                break;
 
             case 4:
-               ret += !( (p[0] == pd[0]) &&
-                         (p[1] == pd[1]) &&
-                         (p[2] == pd[2]) );
+               {
+                  int fail;
+                  Uint8 R, G, B, A;
+
+                  SDL_GetRGBA(*(Uint32*)p, sur->format, &R, &G, &B, &A);
+
+                  if (img->bytes_per_pixel == 3) {
+                     fail = !( (R == pd[0]) &&
+                               (G == pd[1]) &&
+                               (B == pd[2]) );
+                  } else {
+                     fail = !( (R == pd[0]) &&
+                               (G == pd[1]) &&
+                               (B == pd[2]) &&
+                               (A == pd[3]) );
+                  }
+                  if (fail) {
+                     ++ret;
+                  }
+               }
                break;
          }
       }