annotate test/automated/common/common.h @ 4872:231f8a1c5edd

Whoops, return "" even if the window is invalid.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 29 Aug 2010 16:28:04 -0700
parents 2c07bb579922
children
rev   line source
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /**
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 * Automated SDL test common framework.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 *
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 * Written by Edgar Simo "bobbens"
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 *
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 * Released under Public Domain.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 #ifndef COMMON_H
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 # define COMMON_H
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13
3441
5271ce790fed Debug info to help track down render test failures
Sam Lantinga <slouken@libsdl.org>
parents: 3439
diff changeset
14 # define FORMAT SDL_PIXELFORMAT_ARGB8888
3439
0acec8c9f5c9 Fixed some bugs in the automated test suite, revealed by working SDL_RenderReadPixels()
Sam Lantinga <slouken@libsdl.org>
parents: 3435
diff changeset
15 # define AMASK 0xff000000 /**< Alpha bit mask. */
0acec8c9f5c9 Fixed some bugs in the automated test suite, revealed by working SDL_RenderReadPixels()
Sam Lantinga <slouken@libsdl.org>
parents: 3435
diff changeset
16 # define RMASK 0x00ff0000 /**< Red bit mask. */
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 # define GMASK 0x0000ff00 /**< Green bit mask. */
3439
0acec8c9f5c9 Fixed some bugs in the automated test suite, revealed by working SDL_RenderReadPixels()
Sam Lantinga <slouken@libsdl.org>
parents: 3435
diff changeset
18 # define BMASK 0x000000ff /**< Blue bit mask. */
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 typedef struct SurfaceImage_s {
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 int width;
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 int height;
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 const unsigned char pixel_data[];
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 } SurfaceImage_t;
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
3477
2c07bb579922 We want to be strict on software renderer tests and opaque tests, but give a decent margin for blending inaccuracy for the blended tests.
Sam Lantinga <slouken@libsdl.org>
parents: 3441
diff changeset
28 #define ALLOWABLE_ERROR_OPAQUE 0
2c07bb579922 We want to be strict on software renderer tests and opaque tests, but give a decent margin for blending inaccuracy for the blended tests.
Sam Lantinga <slouken@libsdl.org>
parents: 3441
diff changeset
29 #define ALLOWABLE_ERROR_BLENDED 64
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 /**
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 * @brief Compares a surface and a surface image for equality.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 *
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 * @param sur Surface to compare.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 * @param img Image to compare against.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 * @return 0 if they are the same, -1 on error and positive if different.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 */
3477
2c07bb579922 We want to be strict on software renderer tests and opaque tests, but give a decent margin for blending inaccuracy for the blended tests.
Sam Lantinga <slouken@libsdl.org>
parents: 3441
diff changeset
38 int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img, int allowable_error );
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 #endif /* COMMON_H */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42