1.1 --- a/test/automated/common/common.c Tue Nov 17 06:50:29 2009 +0000
1.2 +++ b/test/automated/common/common.c Tue Nov 17 06:51:14 2009 +0000
1.3 @@ -73,5 +73,37 @@
1.4
1.5 SDL_UnlockSurface( sur );
1.6
1.7 + if (ret) {
1.8 + SDL_SaveBMP(sur, "fail.bmp");
1.9 +
1.10 + SDL_LockSurface( sur );
1.11 +
1.12 + bpp = sur->format->BytesPerPixel;
1.13 +
1.14 + /* Compare image - should be same format. */
1.15 + if (bpp == 4) {
1.16 + for (j=0; j<sur->h; j++) {
1.17 + for (i=0; i<sur->w; i++) {
1.18 + p = (Uint8 *)sur->pixels + j * sur->pitch + i * bpp;
1.19 + pd = (Uint8 *)img->pixel_data + (j*img->width + i) * img->bytes_per_pixel;
1.20 + Uint8 R, G, B, A;
1.21 +
1.22 + R = pd[0];
1.23 + G = pd[1];
1.24 + B = pd[2];
1.25 + if (img->bytes_per_pixel == 4) {
1.26 + A = pd[3];
1.27 + } else {
1.28 + A = 0;
1.29 + }
1.30 + *(Uint32*)p = (A << 24) | (R << 16) | (G << 8) | B;
1.31 + }
1.32 + }
1.33 + }
1.34 +
1.35 + SDL_UnlockSurface( sur );
1.36 +
1.37 + SDL_SaveBMP(sur, "good.bmp");
1.38 + }
1.39 return ret;
1.40 }
2.1 --- a/test/automated/common/common.h Tue Nov 17 06:50:29 2009 +0000
2.2 +++ b/test/automated/common/common.h Tue Nov 17 06:51:14 2009 +0000
2.3 @@ -11,7 +11,7 @@
2.4 # define COMMON_H
2.5
2.6
2.7 -# define FORMAT SDL_PIXELFORMAT_ARGB8888
2.8 +# define FORMAT SDL_PIXELFORMAT_ARGB8888
2.9 # define AMASK 0xff000000 /**< Alpha bit mask. */
2.10 # define RMASK 0x00ff0000 /**< Red bit mask. */
2.11 # define GMASK 0x0000ff00 /**< Green bit mask. */
3.1 --- a/test/automated/render/render.c Tue Nov 17 06:50:29 2009 +0000
3.2 +++ b/test/automated/render/render.c Tue Nov 17 06:51:14 2009 +0000
3.3 @@ -67,6 +67,7 @@
3.4 return 1;
3.5
3.6 /* Read pixels. */
3.7 + SDL_RenderPresent();
3.8 ret = SDL_RenderReadPixels( NULL, FORMAT, pix, 80*4 );
3.9 if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) )
3.10 return 1;
3.11 @@ -1012,7 +1013,7 @@
3.12 goto err;
3.13 /* Create window. */
3.14 wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
3.15 - 80, 60, 0 );
3.16 + 80, 60, SDL_WINDOW_SHOWN );
3.17 if (SDL_ATassert( "SDL_CreateWindow", wid!=0 ))
3.18 goto err;
3.19 /* Check title. */