tests/cogl: Migrate sparse pipeline test

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
This commit is contained in:
Jonas Ådahl
2022-08-04 20:08:40 +02:00
committed by Marge Bot
parent 8dc0489b33
commit 400cc89364
5 changed files with 6 additions and 7 deletions

View File

@@ -1,6 +1,5 @@
cogl_test_conformance_sources = [
'test-conform-main.c',
'test-sparse-pipeline.c',
'test-read-texture-formats.c',
'test-write-texture-formats.c',
'test-point-size.c',

View File

@@ -62,8 +62,6 @@ main (int argc, char **argv)
UNPORTED_TEST (test_readpixels);
ADD_TEST (test_layer_remove, 0, 0);
ADD_TEST (test_sparse_pipeline, 0, 0);
ADD_TEST (test_npot_texture, 0, 0);
UNPORTED_TEST (test_multitexture);
UNPORTED_TEST (test_texture_mipmaps);

View File

@@ -6,7 +6,6 @@ void test_path_clip (void);
void test_depth_test (void);
void test_backface_culling (void);
void test_layer_remove (void);
void test_sparse_pipeline (void);
void test_npot_texture (void);
void test_texture_get_set_data (void);
void test_read_texture_formats (void);

View File

@@ -1,63 +0,0 @@
#include <cogl/cogl.h>
#include <string.h>
#include "test-declarations.h"
#include "test-utils.h"
typedef struct _TestState
{
int fb_width;
int fb_height;
} TestState;
static void
test_sparse_layer_combine (TestState *state)
{
CoglPipeline *pipeline;
CoglTexture *tex1, *tex2;
cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
/* This tests that the TEXTURE_* numbers used in the layer combine
string refer to the layer number rather than the unit numbers by
creating a pipeline with very large layer numbers. This should
end up being mapped to much smaller unit numbers */
tex1 = test_utils_create_color_texture (test_ctx, 0xff0000ff);
tex2 = test_utils_create_color_texture (test_ctx, 0x00ff00ff);
pipeline = cogl_pipeline_new (test_ctx);
cogl_pipeline_set_layer_texture (pipeline, 50, tex1);
cogl_pipeline_set_layer_texture (pipeline, 100, tex2);
cogl_pipeline_set_layer_combine (pipeline, 200,
"RGBA = ADD(TEXTURE_50, TEXTURE_100)",
NULL);
cogl_framebuffer_draw_rectangle (test_fb, pipeline, -1, -1, 1, 1);
test_utils_check_pixel (test_fb, 2, 2, 0xffff00ff);
cogl_object_unref (pipeline);
cogl_object_unref (tex1);
cogl_object_unref (tex2);
}
void
test_sparse_pipeline (void)
{
TestState state;
state.fb_width = cogl_framebuffer_get_width (test_fb);
state.fb_height = cogl_framebuffer_get_height (test_fb);
test_sparse_layer_combine (&state);
/* FIXME: This should have a lot more tests, for example testing
whether using an attribute with sparse texture coordinates will
work */
if (cogl_test_verbose ())
g_print ("OK\n");
}