3881fd3259
This adds experimental 2.0 api replacements for the cogl_rectangle[_*] functions that don't depend on having a current pipeline set on the context via cogl_{set,push}_source() or having a current framebuffer set on the context via cogl_push_framebuffer(). The aim for 2.0 is to switch away from having a statefull context that affects drawing to having framebuffer drawing apis that are explicitly passed a framebuffer and pipeline. To test this change several of the conformance tests were updated to use this api instead of cogl_rectangle and cogl_rectangle_with_texture_coords. Since it's quite laborious going through all of the conformance tests the opportunity was taken to make other clean ups in the conformance tests to replace other uses of 1.x api with experimental 2.0 api so long as that didn't affect what was being tested.
116 lines
3.7 KiB
C
116 lines
3.7 KiB
C
#ifndef _TEST_UTILS_H_
|
|
#define _TEST_UTILS_H_
|
|
|
|
/* We don't really care about functions that are defined without a
|
|
header for the unit tests so we can just disable it here */
|
|
#ifdef __GNUC__
|
|
#pragma GCC diagnostic ignored "-Wmissing-declarations"
|
|
#endif
|
|
|
|
typedef enum _TestFlags
|
|
{
|
|
TEST_KNOWN_FAILURE = 1<<0,
|
|
TEST_REQUIREMENT_GL = 1<<1,
|
|
TEST_REQUIREMENT_NPOT = 1<<2,
|
|
TEST_REQUIREMENT_TEXTURE_3D = 1<<3,
|
|
TEST_REQUIREMENT_POINT_SPRITE = 1<<4
|
|
} TestFlags;
|
|
|
|
extern CoglContext *ctx;
|
|
extern CoglFramebuffer *fb;
|
|
|
|
void
|
|
test_utils_init (TestFlags flags);
|
|
|
|
void
|
|
test_utils_fini (void);
|
|
|
|
/*
|
|
* test_utils_check_pixel:
|
|
* @framebuffer: The #CoglFramebuffer to read from
|
|
* @x: x co-ordinate of the pixel to test
|
|
* @y: y co-ordinate of the pixel to test
|
|
* @pixel: An integer of the form 0xRRGGBBAA representing the expected
|
|
* pixel value
|
|
*
|
|
* This performs reads a pixel on the given cogl @framebuffer and
|
|
* asserts that it matches the given color. The alpha channel of the
|
|
* color is ignored. The pixels are converted to a string and compared
|
|
* with g_assert_cmpstr so that if the comparison fails then the
|
|
* assert will display a meaningful message
|
|
*/
|
|
void
|
|
test_utils_check_pixel (CoglFramebuffer *framebuffer,
|
|
int x, int y, guint32 expected_pixel);
|
|
|
|
/*
|
|
* test_utils_check_pixel:
|
|
* @framebuffer: The #CoglFramebuffer to read from
|
|
* @x: x co-ordinate of the pixel to test
|
|
* @y: y co-ordinate of the pixel to test
|
|
* @pixel: An integer of the form 0xrrggbb representing the expected pixel value
|
|
*
|
|
* This performs reads a pixel on the given cogl @framebuffer and
|
|
* asserts that it matches the given color. The alpha channel of the
|
|
* color is ignored. The pixels are converted to a string and compared
|
|
* with g_assert_cmpstr so that if the comparison fails then the
|
|
* assert will display a meaningful message
|
|
*/
|
|
void
|
|
test_utils_check_pixel_rgb (CoglFramebuffer *framebuffer,
|
|
int x, int y, int r, int g, int b);
|
|
|
|
/*
|
|
* test_utils_check_region:
|
|
* @framebuffer: The #CoglFramebuffer to read from
|
|
* @x: x co-ordinate of the region to test
|
|
* @y: y co-ordinate of the region to test
|
|
* @width: width of the region to test
|
|
* @height: height of the region to test
|
|
* @pixel: An integer of the form 0xrrggbb representing the expected region color
|
|
*
|
|
* Performs a read pixel on the specified region of the given cogl
|
|
* @framebuffer and asserts that it matches the given color. The alpha
|
|
* channel of the color is ignored. The pixels are converted to a
|
|
* string and compared with g_assert_cmpstr so that if the comparison
|
|
* fails then the assert will display a meaningful message
|
|
*/
|
|
void
|
|
test_utils_check_region (CoglFramebuffer *framebuffer,
|
|
int x, int y,
|
|
int width, int height,
|
|
guint32 expected_rgba);
|
|
|
|
/*
|
|
* test_utils_compare_pixel:
|
|
* @screen_pixel: A pixel stored in memory
|
|
* @expected_pixel: The expected RGBA value
|
|
*
|
|
* Compares a pixel from a buffer to an expected value. The pixels are
|
|
* converted to a string and compared with g_assert_cmpstr so that if
|
|
* the comparison fails then the assert will display a meaningful
|
|
* message.
|
|
*/
|
|
void
|
|
test_utils_compare_pixel (const guint8 *screen_pixel, guint32 expected_pixel);
|
|
|
|
/*
|
|
* test_utils_create_color_texture:
|
|
* @context: A #CoglContext
|
|
* @color: A color to put in the texture
|
|
*
|
|
* Creates a 1x1-pixel RGBA texture filled with the given color.
|
|
*/
|
|
CoglTexture *
|
|
test_utils_create_color_texture (CoglContext *context,
|
|
guint32 color);
|
|
|
|
/* cogl_test_verbose:
|
|
*
|
|
* Queries if the user asked for verbose output or not.
|
|
*/
|
|
gboolean
|
|
cogl_test_verbose (void);
|
|
|
|
#endif /* _TEST_UTILS_H_ */
|