test/automated/common/common.c
changeset 3439 0acec8c9f5c9
parent 3259 22ac66da0765
child 3441 5271ce790fed
--- 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;
          }
       }