tests: update inline with master

This renames the global ctx and fb variables to test_ctx and test_fb
respectively in line with the names use on the master branch. This is to
make it easier to cherry pick patches from master.
This commit is contained in:
Robert Bragg
2013-01-18 17:57:06 +00:00
parent 31d105abd8
commit fa62fe2a4f
30 changed files with 423 additions and 423 deletions

View File

@ -9,8 +9,8 @@
static CoglBool cogl_test_is_verbose;
CoglContext *ctx;
CoglFramebuffer *fb;
CoglContext *test_ctx;
CoglFramebuffer *test_fb;
void
test_utils_init (TestFlags flags)
@ -45,11 +45,11 @@ test_utils_init (TestFlags flags)
g_setenv ("COGL_X11_SYNC", "1", 0);
ctx = cogl_context_new (NULL, &error);
if (!ctx)
test_ctx = cogl_context_new (NULL, &error);
if (!test_ctx)
g_critical ("Failed to create a CoglContext: %s", error->message);
display = cogl_context_get_display (ctx);
display = cogl_context_get_display (test_ctx);
renderer = cogl_display_get_renderer (display);
if (flags & TEST_REQUIREMENT_GL &&
@ -60,31 +60,31 @@ test_utils_init (TestFlags flags)
}
if (flags & TEST_REQUIREMENT_NPOT &&
!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT))
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT))
{
missing_requirement = TRUE;
}
if (flags & TEST_REQUIREMENT_TEXTURE_3D &&
!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D))
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_3D))
{
missing_requirement = TRUE;
}
if (flags & TEST_REQUIREMENT_POINT_SPRITE &&
!cogl_has_feature (ctx, COGL_FEATURE_ID_POINT_SPRITE))
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_POINT_SPRITE))
{
missing_requirement = TRUE;
}
if (flags & TEST_REQUIREMENT_GLES2_CONTEXT &&
!cogl_has_feature (ctx, COGL_FEATURE_ID_GLES2_CONTEXT))
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_GLES2_CONTEXT))
{
missing_requirement = TRUE;
}
if (flags & TEST_REQUIREMENT_MAP_WRITE &&
!cogl_has_feature (ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE))
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE))
{
missing_requirement = TRUE;
}
@ -96,13 +96,13 @@ test_utils_init (TestFlags flags)
if (getenv ("COGL_TEST_ONSCREEN"))
{
onscreen = cogl_onscreen_new (ctx, 640, 480);
fb = COGL_FRAMEBUFFER (onscreen);
onscreen = cogl_onscreen_new (test_ctx, 640, 480);
test_fb = COGL_FRAMEBUFFER (onscreen);
}
else
{
CoglOffscreen *offscreen;
CoglTexture2D *tex = cogl_texture_2d_new_with_size (ctx,
CoglTexture2D *tex = cogl_texture_2d_new_with_size (test_ctx,
FB_WIDTH, FB_HEIGHT,
COGL_PIXEL_FORMAT_ANY,
&error);
@ -110,16 +110,16 @@ test_utils_init (TestFlags flags)
g_critical ("Failed to allocate texture: %s", error->message);
offscreen = cogl_offscreen_new_to_texture (COGL_TEXTURE (tex));
fb = COGL_FRAMEBUFFER (offscreen);
test_fb = COGL_FRAMEBUFFER (offscreen);
}
if (!cogl_framebuffer_allocate (fb, &error))
if (!cogl_framebuffer_allocate (test_fb, &error))
g_critical ("Failed to allocate framebuffer: %s", error->message);
if (onscreen)
cogl_onscreen_show (onscreen);
cogl_framebuffer_clear4f (fb,
cogl_framebuffer_clear4f (test_fb,
COGL_BUFFER_BIT_COLOR |
COGL_BUFFER_BIT_DEPTH |
COGL_BUFFER_BIT_STENCIL,
@ -132,11 +132,11 @@ test_utils_init (TestFlags flags)
void
test_utils_fini (void)
{
if (fb)
cogl_object_unref (fb);
if (test_fb)
cogl_object_unref (test_fb);
if (ctx)
cogl_object_unref (ctx);
if (test_ctx)
cogl_object_unref (test_ctx);
}
static CoglBool
@ -167,12 +167,12 @@ test_utils_compare_pixel (const uint8_t *screen_pixel, uint32_t expected_pixel)
}
void
test_utils_check_pixel (CoglFramebuffer *fb,
test_utils_check_pixel (CoglFramebuffer *test_fb,
int x, int y, uint32_t expected_pixel)
{
uint8_t pixel[4];
cogl_framebuffer_read_pixels (fb,
cogl_framebuffer_read_pixels (test_fb,
x, y, 1, 1,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
pixel);
@ -181,14 +181,14 @@ test_utils_check_pixel (CoglFramebuffer *fb,
}
void
test_utils_check_pixel_rgb (CoglFramebuffer *fb,
test_utils_check_pixel_rgb (CoglFramebuffer *test_fb,
int x, int y, int r, int g, int b)
{
test_utils_check_pixel (fb, x, y, (r << 24) | (g << 16) | (b << 8));
test_utils_check_pixel (test_fb, x, y, (r << 24) | (g << 16) | (b << 8));
}
void
test_utils_check_region (CoglFramebuffer *fb,
test_utils_check_region (CoglFramebuffer *test_fb,
int x, int y,
int width, int height,
uint32_t expected_rgba)
@ -196,7 +196,7 @@ test_utils_check_region (CoglFramebuffer *fb,
uint8_t *pixels, *p;
pixels = p = g_malloc (width * height * 4);
cogl_framebuffer_read_pixels (fb,
cogl_framebuffer_read_pixels (test_fb,
x,
y,
width,