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:
@ -29,7 +29,7 @@ create_texture_pipeline (TestState *state)
|
||||
8, /* rowstride */
|
||||
tex_data);
|
||||
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
|
||||
cogl_pipeline_set_layer_texture (pipeline, 0, tex);
|
||||
|
||||
@ -49,7 +49,7 @@ simple_fragment_snippet (TestState *state)
|
||||
CoglSnippet *snippet;
|
||||
|
||||
/* Simple fragment snippet */
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
|
||||
cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255);
|
||||
|
||||
@ -59,11 +59,11 @@ simple_fragment_snippet (TestState *state)
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 0, 0, 10, 10);
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10);
|
||||
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
test_utils_check_pixel (fb, 5, 5, 0xffff00ff);
|
||||
test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -73,7 +73,7 @@ simple_vertex_snippet (TestState *state)
|
||||
CoglSnippet *snippet;
|
||||
|
||||
/* Simple vertex snippet */
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
|
||||
cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255);
|
||||
|
||||
@ -83,11 +83,11 @@ simple_vertex_snippet (TestState *state)
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 10, 0, 20, 10);
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 10, 0, 20, 10);
|
||||
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
test_utils_check_pixel (fb, 15, 5, 0xff00ffff);
|
||||
test_utils_check_pixel (test_fb, 15, 5, 0xff00ffff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -99,7 +99,7 @@ shared_uniform (TestState *state)
|
||||
|
||||
/* Snippets sharing a uniform across the vertex and fragment
|
||||
hooks */
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
|
||||
location = cogl_pipeline_get_uniform_location (pipeline, "a_value");
|
||||
cogl_pipeline_set_uniform_1f (pipeline, location, 0.25f);
|
||||
@ -117,13 +117,13 @@ shared_uniform (TestState *state)
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (fb,
|
||||
cogl_framebuffer_draw_rectangle (test_fb,
|
||||
pipeline,
|
||||
20, 0, 30, 10);
|
||||
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
test_utils_check_pixel (fb, 25, 5, 0xff0080ff);
|
||||
test_utils_check_pixel (test_fb, 25, 5, 0xff0080ff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -135,7 +135,7 @@ lots_snippets (TestState *state)
|
||||
int i;
|
||||
|
||||
/* Lots of snippets on one pipeline */
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
|
||||
cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255);
|
||||
|
||||
@ -163,11 +163,11 @@ lots_snippets (TestState *state)
|
||||
g_free (declarations);
|
||||
}
|
||||
|
||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 30, 0, 40, 10);
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 30, 0, 40, 10);
|
||||
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
test_utils_check_pixel (fb, 35, 5, 0x19334cff);
|
||||
test_utils_check_pixel (test_fb, 35, 5, 0x19334cff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -178,7 +178,7 @@ shared_variable_pre_post (TestState *state)
|
||||
|
||||
/* Test that the pre string can declare variables used by the post
|
||||
string */
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
|
||||
cogl_pipeline_set_color4ub (pipeline, 255, 255, 255, 255);
|
||||
|
||||
@ -189,11 +189,11 @@ shared_variable_pre_post (TestState *state)
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 40, 0, 50, 10);
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 40, 0, 50, 10);
|
||||
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
test_utils_check_pixel (fb, 45, 5, 0xff0000ff);
|
||||
test_utils_check_pixel (test_fb, 45, 5, 0xff0000ff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -214,20 +214,20 @@ test_pipeline_caching (TestState *state)
|
||||
" unrelated pipelines */",
|
||||
"cogl_color_out = vec4 (0.0, 1.0, 0.0, 1.0);\n");
|
||||
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 50, 0, 60, 10);
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 50, 0, 60, 10);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 60, 0, 70, 10);
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 60, 0, 70, 10);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
test_utils_check_pixel (fb, 55, 5, 0x00ff00ff);
|
||||
test_utils_check_pixel (fb, 65, 5, 0x00ff00ff);
|
||||
test_utils_check_pixel (test_fb, 55, 5, 0x00ff00ff);
|
||||
test_utils_check_pixel (test_fb, 65, 5, 0x00ff00ff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -247,14 +247,14 @@ test_replace_string (TestState *state)
|
||||
cogl_snippet_set_post (snippet,
|
||||
"cogl_color_out += vec4 (0.5, 0.0, 0.0, 1.0);");
|
||||
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 70, 0, 80, 10);
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 70, 0, 80, 10);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
test_utils_check_pixel (fb, 75, 5, 0x808000ff);
|
||||
test_utils_check_pixel (test_fb, 75, 5, 0x808000ff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -273,7 +273,7 @@ test_texture_lookup_hook (TestState *state)
|
||||
|
||||
pipeline = create_texture_pipeline (state);
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||
pipeline,
|
||||
80, 0, 90, 10,
|
||||
0, 0, 0, 0);
|
||||
@ -281,7 +281,7 @@ test_texture_lookup_hook (TestState *state)
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
test_utils_check_pixel (fb, 85, 5, 0x00ffffff);
|
||||
test_utils_check_pixel (test_fb, 85, 5, 0x00ffffff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -302,12 +302,12 @@ test_multiple_samples (TestState *state)
|
||||
|
||||
pipeline = create_texture_pipeline (state);
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 0, 0, 10, 10);
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
test_utils_check_pixel (fb, 5, 5, 0xffff00ff);
|
||||
test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -322,7 +322,7 @@ test_replace_lookup_hook (TestState *state)
|
||||
|
||||
pipeline = create_texture_pipeline (state);
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||
pipeline,
|
||||
90, 0, 100, 10,
|
||||
0, 0, 0, 0);
|
||||
@ -330,7 +330,7 @@ test_replace_lookup_hook (TestState *state)
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
test_utils_check_pixel (fb, 95, 5, 0x0000ffff);
|
||||
test_utils_check_pixel (test_fb, 95, 5, 0x0000ffff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -355,13 +355,13 @@ test_replace_snippet (TestState *state)
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||
pipeline,
|
||||
100, 0, 110, 10,
|
||||
0, 0, 0, 0);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
test_utils_check_pixel (fb, 105, 5, 0xff0000ff);
|
||||
test_utils_check_pixel (test_fb, 105, 5, 0xff0000ff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -387,13 +387,13 @@ test_replace_fragment_layer (TestState *state)
|
||||
"A = REPLACE(PREVIOUS)",
|
||||
NULL);
|
||||
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||
pipeline,
|
||||
110, 0, 120, 10,
|
||||
0, 0, 0, 0);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
test_utils_check_pixel (fb, 115, 5, 0xff00ffff);
|
||||
test_utils_check_pixel (test_fb, 115, 5, 0xff00ffff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -403,7 +403,7 @@ test_modify_fragment_layer (TestState *state)
|
||||
CoglSnippet *snippet;
|
||||
|
||||
/* Test modifying the fragment layer code */
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
|
||||
cogl_pipeline_set_uniform_1f (pipeline,
|
||||
cogl_pipeline_get_uniform_location (pipeline,
|
||||
@ -416,13 +416,13 @@ test_modify_fragment_layer (TestState *state)
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||
pipeline,
|
||||
120, 0, 130, 10,
|
||||
0, 0, 0, 0);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
test_utils_check_pixel (fb, 125, 5, 0xff80ffff);
|
||||
test_utils_check_pixel (test_fb, 125, 5, 0xff80ffff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -445,13 +445,13 @@ test_modify_vertex_layer (TestState *state)
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||
pipeline,
|
||||
130, 0, 140, 10,
|
||||
0, 0, 0, 0);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
test_utils_check_pixel (fb, 135, 5, 0xffff00ff);
|
||||
test_utils_check_pixel (test_fb, 135, 5, 0xffff00ff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -475,13 +475,13 @@ test_replace_vertex_layer (TestState *state)
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||
pipeline,
|
||||
140, 0, 150, 10,
|
||||
0, 0, 0, 0);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
test_utils_check_pixel (fb, 145, 5, 0x00ff00ff);
|
||||
test_utils_check_pixel (test_fb, 145, 5, 0x00ff00ff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -497,7 +497,7 @@ test_vertex_transform_hook (TestState *state)
|
||||
|
||||
cogl_matrix_init_identity (&identity_matrix);
|
||||
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
|
||||
cogl_pipeline_set_color4ub (pipeline, 255, 0, 255, 255);
|
||||
|
||||
@ -510,7 +510,7 @@ test_vertex_transform_hook (TestState *state)
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
/* Copy the current projection matrix to a uniform */
|
||||
cogl_framebuffer_get_projection_matrix (fb, &matrix);
|
||||
cogl_framebuffer_get_projection_matrix (test_fb, &matrix);
|
||||
location = cogl_pipeline_get_uniform_location (pipeline, "pmat");
|
||||
cogl_pipeline_set_uniform_matrix (pipeline,
|
||||
location,
|
||||
@ -521,15 +521,15 @@ test_vertex_transform_hook (TestState *state)
|
||||
|
||||
/* Replace the real projection matrix with the identity. This should
|
||||
mess up the drawing unless the snippet replacement is working */
|
||||
cogl_framebuffer_set_projection_matrix (fb, &identity_matrix);
|
||||
cogl_framebuffer_set_projection_matrix (test_fb, &identity_matrix);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 150, 0, 160, 10);
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 150, 0, 160, 10);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
/* Restore the projection matrix */
|
||||
cogl_framebuffer_set_projection_matrix (fb, &matrix);
|
||||
cogl_framebuffer_set_projection_matrix (test_fb, &matrix);
|
||||
|
||||
test_utils_check_pixel (fb, 155, 5, 0xff00ffff);
|
||||
test_utils_check_pixel (test_fb, 155, 5, 0xff00ffff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -545,7 +545,7 @@ test_snippet_order (TestState *state)
|
||||
sections in the same order as they were added. Therefore the r
|
||||
component should be taken from the the second snippet and the g
|
||||
component from the first */
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
|
||||
cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255);
|
||||
|
||||
@ -564,10 +564,10 @@ test_snippet_order (TestState *state)
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 160, 0, 170, 10);
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 160, 0, 170, 10);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
test_utils_check_pixel (fb, 165, 5, 0x80ff00ff);
|
||||
test_utils_check_pixel (test_fb, 165, 5, 0x80ff00ff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -588,24 +588,24 @@ test_naming_texture_units (TestState *state)
|
||||
"texture2D (cogl_sampler100, vec2 (0.0, 0.0)) + "
|
||||
"texture2D (cogl_sampler200, vec2 (0.0, 0.0));");
|
||||
|
||||
tex1 = test_utils_create_color_texture (ctx, 0xff0000ff);
|
||||
tex2 = test_utils_create_color_texture (ctx, 0x00ff00ff);
|
||||
tex1 = test_utils_create_color_texture (test_ctx, 0xff0000ff);
|
||||
tex2 = test_utils_create_color_texture (test_ctx, 0x00ff00ff);
|
||||
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
pipeline = cogl_pipeline_new (test_ctx);
|
||||
|
||||
cogl_pipeline_set_layer_texture (pipeline, 100, tex1);
|
||||
cogl_pipeline_set_layer_texture (pipeline, 200, tex2);
|
||||
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 0, 0, 10, 10);
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10);
|
||||
|
||||
cogl_object_unref (pipeline);
|
||||
cogl_object_unref (snippet);
|
||||
cogl_object_unref (tex1);
|
||||
cogl_object_unref (tex2);
|
||||
|
||||
test_utils_check_pixel (fb, 5, 5, 0xffff00ff);
|
||||
test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -680,7 +680,7 @@ run_tests (TestState *state)
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (tests); i++)
|
||||
{
|
||||
cogl_framebuffer_clear4f (fb,
|
||||
cogl_framebuffer_clear4f (test_fb,
|
||||
COGL_BUFFER_BIT_COLOR,
|
||||
0, 0, 0, 1);
|
||||
|
||||
@ -696,10 +696,10 @@ test_snippets (void)
|
||||
{
|
||||
TestState state;
|
||||
|
||||
cogl_framebuffer_orthographic (fb,
|
||||
cogl_framebuffer_orthographic (test_fb,
|
||||
0, 0,
|
||||
cogl_framebuffer_get_width (fb),
|
||||
cogl_framebuffer_get_height (fb),
|
||||
cogl_framebuffer_get_width (test_fb),
|
||||
cogl_framebuffer_get_height (test_fb),
|
||||
-1,
|
||||
100);
|
||||
|
||||
|
Reference in New Issue
Block a user