summaryrefslogtreecommitdiff
path: root/cogl/tests
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2019-11-22 12:03:38 +0100
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2019-12-03 19:02:14 +0000
commit5e117b3f5a093fb0445fa25d3fa306714d0a103a (patch)
tree4c8be09eaf6c4a46efb9992b4ea33fc2dc4a9642 /cogl/tests
parent294b4eda4c4f1c433c3315e52e518cef75bf5344 (diff)
downloadmutter-5e117b3f5a093fb0445fa25d3fa306714d0a103a.tar.gz
cogl/tests: Remove testing of legacy API
Some tests just test that deprecated API still work as they should. Those APIs are being removed, so prepare by removing their tests. https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
Diffstat (limited to 'cogl/tests')
-rw-r--r--cogl/tests/conform/test-blend-strings.c54
-rw-r--r--cogl/tests/conform/test-depth-test.c37
-rw-r--r--cogl/tests/conform/test-just-vertex-shader.c73
-rw-r--r--cogl/tests/conform/test-premult.c40
4 files changed, 10 insertions, 194 deletions
diff --git a/cogl/tests/conform/test-blend-strings.c b/cogl/tests/conform/test-blend-strings.c
index 92672736f..e61ee0acf 100644
--- a/cogl/tests/conform/test-blend-strings.c
+++ b/cogl/tests/conform/test-blend-strings.c
@@ -53,7 +53,6 @@ test_blend_paint (TestState *state,
uint8_t Ba = MASK_ALPHA (blend_constant);
CoglColor blend_const_color;
- CoglHandle material;
CoglPipeline *pipeline;
gboolean status;
GError *error = NULL;
@@ -120,59 +119,6 @@ test_blend_paint (TestState *state,
}
test_utils_check_pixel (test_fb, x_off, y_off, expected_result);
-
-
- /*
- * Test with legacy API
- */
-
- /* Clear previous work */
- cogl_set_source_color4ub (0, 0, 0, 0xff);
- cogl_rectangle (x * QUAD_WIDTH,
- y * QUAD_WIDTH,
- x * QUAD_WIDTH + QUAD_WIDTH,
- y * QUAD_WIDTH + QUAD_WIDTH);
-
- /* First write out the destination color without any blending... */
- material = cogl_material_new ();
- cogl_material_set_color4ub (material, Dr, Dg, Db, Da);
- cogl_material_set_blend (material, "RGBA = ADD (SRC_COLOR, 0)", NULL);
- cogl_set_source (material);
- cogl_rectangle (x * QUAD_WIDTH,
- y * QUAD_WIDTH,
- x * QUAD_WIDTH + QUAD_WIDTH,
- y * QUAD_WIDTH + QUAD_WIDTH);
- cogl_object_unref (material);
-
- /*
- * Now blend a rectangle over our well defined destination:
- */
-
- material = cogl_material_new ();
- cogl_material_set_color4ub (material, Sr, Sg, Sb, Sa);
-
- status = cogl_material_set_blend (material, blend_string, &error);
- if (!status)
- {
- /* This is a failure as it must be equivalent to the new API */
- g_warning ("Error setting blend string %s: %s",
- blend_string, error->message);
- g_assert_not_reached ();
- }
-
- cogl_color_init_from_4ub (&blend_const_color, Br, Bg, Bb, Ba);
- cogl_material_set_blend_constant (material, &blend_const_color);
-
- cogl_set_source (material);
- cogl_rectangle (x * QUAD_WIDTH,
- y * QUAD_WIDTH,
- x * QUAD_WIDTH + QUAD_WIDTH,
- y * QUAD_WIDTH + QUAD_WIDTH);
- cogl_object_unref (material);
-
- /* See what we got... */
-
- test_utils_check_pixel (test_fb, x_off, y_off, expected_result);
}
static CoglTexture *
diff --git a/cogl/tests/conform/test-depth-test.c b/cogl/tests/conform/test-depth-test.c
index c0ed79b57..2ac29bbf0 100644
--- a/cogl/tests/conform/test-depth-test.c
+++ b/cogl/tests/conform/test-depth-test.c
@@ -244,43 +244,6 @@ paint (TestState *state)
FALSE, /* legacy mode */
0xff0000ff); /* expected */
}
-
- /* Test that the legacy cogl_set_depth_test_enabled() API still
- * works... */
-
- {
- /* Nearest */
- TestDepthState rect0_state = {
- 0xff0000ff, /* rgba color */
- -10, /* depth */
- FALSE, /* depth test enable */
- COGL_DEPTH_TEST_FUNCTION_LESS,
- TRUE, /* depth write enable */
- TRUE, /* FB depth write enable */
- 0, 1 /* depth range */
- };
- /* Furthest */
- TestDepthState rect1_state = {
- 0x00ff00ff, /* rgba color */
- -70, /* depth */
- FALSE, /* depth test enable */
- COGL_DEPTH_TEST_FUNCTION_LESS,
- TRUE, /* depth write enable */
- TRUE, /* FB depth write enable */
- 0, 1 /* depth range */
- };
-
- cogl_set_depth_test_enabled (TRUE);
- test_depth (state, 0, 2, /* position */
- &rect0_state, &rect1_state, NULL,
- TRUE, /* legacy mode */
- 0xff0000ff); /* expected */
- cogl_set_depth_test_enabled (FALSE);
- test_depth (state, 1, 2, /* position */
- &rect0_state, &rect1_state, NULL,
- TRUE, /* legacy mode */
- 0x00ff00ff); /* expected */
- }
}
void
diff --git a/cogl/tests/conform/test-just-vertex-shader.c b/cogl/tests/conform/test-just-vertex-shader.c
index c11c7e169..d54b20149 100644
--- a/cogl/tests/conform/test-just-vertex-shader.c
+++ b/cogl/tests/conform/test-just-vertex-shader.c
@@ -28,76 +28,6 @@ create_dummy_texture (void)
}
static void
-paint_legacy (TestState *state)
-{
- CoglHandle material = cogl_material_new ();
- CoglTexture *tex;
- CoglColor color;
- GError *error = NULL;
- CoglHandle shader, program;
-
- cogl_color_init_from_4ub (&color, 0, 0, 0, 255);
- cogl_clear (&color, COGL_BUFFER_BIT_COLOR);
-
- /* Set the primary vertex color as red */
- cogl_color_init_from_4ub (&color, 0xff, 0x00, 0x00, 0xff);
- cogl_material_set_color (material, &color);
-
- /* Override the vertex color in the texture environment with a
- constant green color provided by a texture */
- tex = create_dummy_texture ();
- cogl_material_set_layer (material, 0, tex);
- cogl_object_unref (tex);
- if (!cogl_material_set_layer_combine (material, 0,
- "RGBA=REPLACE(TEXTURE)",
- &error))
- {
- g_warning ("Error setting layer combine: %s", error->message);
- g_assert_not_reached ();
- }
-
- /* Set up a dummy vertex shader that does nothing but the usual
- fixed function transform */
- shader = cogl_create_shader (COGL_SHADER_TYPE_VERTEX);
- cogl_shader_source (shader,
- "void\n"
- "main ()\n"
- "{\n"
- " cogl_position_out = "
- "cogl_modelview_projection_matrix * "
- "cogl_position_in;\n"
- " cogl_color_out = cogl_color_in;\n"
- " cogl_tex_coord_out[0] = cogl_tex_coord_in;\n"
- "}\n");
- cogl_shader_compile (shader);
- if (!cogl_shader_is_compiled (shader))
- {
- char *log = cogl_shader_get_info_log (shader);
- g_warning ("Shader compilation failed:\n%s", log);
- g_free (log);
- g_assert_not_reached ();
- }
-
- program = cogl_create_program ();
- cogl_program_attach_shader (program, shader);
- cogl_program_link (program);
-
- cogl_object_unref (shader);
-
- /* Draw something using the material */
- cogl_set_source (material);
- cogl_rectangle (0, 0, 50, 50);
-
- /* Draw it again using the program. It should look exactly the same */
- cogl_program_use (program);
- cogl_rectangle (50, 0, 100, 50);
- cogl_program_use (NULL);
-
- cogl_object_unref (material);
- cogl_object_unref (program);
-}
-
-static void
paint (TestState *state)
{
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
@@ -193,9 +123,6 @@ test_just_vertex_shader (void)
* uses the legacy cogl_rectangle() api. */
cogl_push_framebuffer (test_fb);
- paint_legacy (&state);
- validate_result (test_fb);
-
paint (&state);
validate_result (test_fb);
diff --git a/cogl/tests/conform/test-premult.c b/cogl/tests/conform/test-premult.c
index 384b46416..70a67318a 100644
--- a/cogl/tests/conform/test-premult.c
+++ b/cogl/tests/conform/test-premult.c
@@ -91,23 +91,11 @@ set_region (CoglTexture *tex,
static void
check_texture (CoglPipeline *pipeline,
- CoglHandle material,
int x,
int y,
CoglTexture *tex,
uint32_t expected_result)
{
- /* Legacy */
- cogl_push_framebuffer (test_fb);
- cogl_material_set_layer (material, 0, tex);
- cogl_set_source (material);
- cogl_rectangle (x * QUAD_WIDTH,
- y * QUAD_WIDTH,
- x * QUAD_WIDTH + QUAD_WIDTH,
- y * QUAD_WIDTH + QUAD_WIDTH);
- test_utils_check_pixel (test_fb, x * QUAD_WIDTH + QUAD_WIDTH / 2, y * QUAD_WIDTH + QUAD_WIDTH / 2, expected_result);
- cogl_pop_framebuffer ();
-
/* New API */
cogl_pipeline_set_layer_texture (pipeline, 0, tex);
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
@@ -122,7 +110,6 @@ void
test_premult (void)
{
CoglPipeline *pipeline;
- CoglHandle material;
CoglTexture *tex;
cogl_framebuffer_orthographic (test_fb, 0, 0,
@@ -135,13 +122,6 @@ test_premult (void)
COGL_BUFFER_BIT_COLOR,
1.0f, 1.0f, 1.0f, 1.0f);
- /* Legacy */
- material = cogl_material_new ();
- cogl_material_set_blend (material,
- "RGBA = ADD (SRC_COLOR, 0)", NULL);
- cogl_material_set_layer_combine (material, 0,
- "RGBA = REPLACE (TEXTURE)", NULL);
-
/* New API */
pipeline = cogl_pipeline_new (test_ctx);
cogl_pipeline_set_blend (pipeline,
@@ -157,7 +137,7 @@ test_premult (void)
tex = make_texture (0xff00ff80,
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
TEXTURE_FLAG_SET_UNPREMULTIPLIED);
- check_texture (pipeline, material, 0, 0, /* position */
+ check_texture (pipeline, 0, 0, /* position */
tex,
0xff00ff80); /* expected */
@@ -170,7 +150,7 @@ test_premult (void)
tex = make_texture (0xff00ff80,
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
TEXTURE_FLAG_SET_PREMULTIPLIED);
- check_texture (pipeline, material, 1, 0, /* position */
+ check_texture (pipeline, 1, 0, /* position */
tex,
0x80008080); /* expected */
@@ -184,7 +164,7 @@ test_premult (void)
tex = make_texture (0xff00ff80,
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
0); /* default premultiplied status */
- check_texture (pipeline, material, 2, 0, /* position */
+ check_texture (pipeline, 2, 0, /* position */
tex,
0x80008080); /* expected */
@@ -198,7 +178,7 @@ test_premult (void)
tex = make_texture (0x80008080,
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
TEXTURE_FLAG_SET_PREMULTIPLIED);
- check_texture (pipeline, material, 3, 0, /* position */
+ check_texture (pipeline, 3, 0, /* position */
tex,
0x80008080); /* expected */
@@ -211,7 +191,7 @@ test_premult (void)
tex = make_texture (0x80008080,
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
TEXTURE_FLAG_SET_UNPREMULTIPLIED);
- check_texture (pipeline, material, 4, 0, /* position */
+ check_texture (pipeline, 4, 0, /* position */
tex,
0xff00ff80); /* expected */
@@ -225,7 +205,7 @@ test_premult (void)
tex = make_texture (0x80008080,
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
0); /* default premultiplied status */
- check_texture (pipeline, material, 5, 0, /* position */
+ check_texture (pipeline, 5, 0, /* position */
tex,
0x80008080); /* expected */
@@ -242,7 +222,7 @@ test_premult (void)
if (cogl_test_verbose ())
g_print ("set_region (0xff00ff80, RGBA_8888)\n");
set_region (tex, 0xff00ff80, COGL_PIXEL_FORMAT_RGBA_8888);
- check_texture (pipeline, material, 6, 0, /* position */
+ check_texture (pipeline, 6, 0, /* position */
tex,
0xff00ff80); /* expected */
@@ -258,7 +238,7 @@ test_premult (void)
if (cogl_test_verbose ())
g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
set_region (tex, 0x80008080, COGL_PIXEL_FORMAT_RGBA_8888_PRE);
- check_texture (pipeline, material, 7, 0, /* position */
+ check_texture (pipeline, 7, 0, /* position */
tex,
0xff00ff80); /* expected */
@@ -273,7 +253,7 @@ test_premult (void)
if (cogl_test_verbose ())
g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
set_region (tex, 0x80008080, COGL_PIXEL_FORMAT_RGBA_8888_PRE);
- check_texture (pipeline, material, 8, 0, /* position */
+ check_texture (pipeline, 8, 0, /* position */
tex,
0x80008080); /* expected */
@@ -291,7 +271,7 @@ test_premult (void)
if (cogl_test_verbose ())
g_print ("set_region (0xff00ff80, RGBA_8888)\n");
set_region (tex, 0xff00ff80, COGL_PIXEL_FORMAT_RGBA_8888);
- check_texture (pipeline, material, 9, 0, /* position */
+ check_texture (pipeline, 9, 0, /* position */
tex,
0x80008080); /* expected */