diff --git a/cogl/tests/conform/meson.build b/cogl/tests/conform/meson.build index 78a3fc6a8..e4558be50 100644 --- a/cogl/tests/conform/meson.build +++ b/cogl/tests/conform/meson.build @@ -1,6 +1,5 @@ cogl_test_conformance_sources = [ 'test-conform-main.c', - 'test-framebuffer-get-bits.c', 'test-primitive-and-journal.c', 'test-copy-replace-texture.c', 'test-pipeline-cache-unrefs-texture.c', diff --git a/cogl/tests/conform/test-conform-main.c b/cogl/tests/conform/test-conform-main.c index b2f06ff2f..a048dbb09 100644 --- a/cogl/tests/conform/test-conform-main.c +++ b/cogl/tests/conform/test-conform-main.c @@ -70,10 +70,6 @@ main (int argc, char **argv) UNPORTED_TEST (test_vertex_buffer_interleved); UNPORTED_TEST (test_vertex_buffer_mutability); - ADD_TEST (test_framebuffer_get_bits, - TEST_REQUIREMENT_GL, - 0); - ADD_TEST (test_primitive_and_journal, 0, 0); ADD_TEST (test_copy_replace_texture, 0, 0); diff --git a/cogl/tests/conform/test-declarations.h b/cogl/tests/conform/test-declarations.h index 9d138f6fe..c4018ce52 100644 --- a/cogl/tests/conform/test-declarations.h +++ b/cogl/tests/conform/test-declarations.h @@ -5,7 +5,6 @@ void test_path (void); void test_path_clip (void); void test_depth_test (void); void test_backface_culling (void); -void test_framebuffer_get_bits (void); void test_primitive_and_journal (void); void test_copy_replace_texture (void); void test_pipeline_cache_unrefs_texture (void); diff --git a/cogl/tests/conform/test-framebuffer-get-bits.c b/cogl/tests/conform/test-framebuffer-get-bits.c deleted file mode 100644 index 208b711e8..000000000 --- a/cogl/tests/conform/test-framebuffer-get-bits.c +++ /dev/null @@ -1,41 +0,0 @@ -#include - -#include "test-declarations.h" -#include "test-utils.h" - -void -test_framebuffer_get_bits (void) -{ - CoglTexture2D *tex_a = - cogl_texture_2d_new_with_size (test_ctx, - 16, 16); /* width/height */ - CoglOffscreen *offscreen_a = - cogl_offscreen_new_with_texture (tex_a); - CoglFramebuffer *fb_a = COGL_FRAMEBUFFER (offscreen_a); - CoglTexture2D *tex_rgba = - cogl_texture_2d_new_with_size (test_ctx, - 16, 16); /* width/height */ - CoglOffscreen *offscreen_rgba = - cogl_offscreen_new_with_texture (tex_rgba); - CoglFramebuffer *fb_rgba = COGL_FRAMEBUFFER (offscreen_rgba); - - cogl_texture_set_components (tex_a, - COGL_TEXTURE_COMPONENTS_A); - cogl_framebuffer_allocate (fb_a, NULL); - cogl_framebuffer_allocate (fb_rgba, NULL); - - g_assert_cmpint (cogl_framebuffer_get_red_bits (fb_a), ==, 0); - g_assert_cmpint (cogl_framebuffer_get_green_bits (fb_a), ==, 0); - g_assert_cmpint (cogl_framebuffer_get_blue_bits (fb_a), ==, 0); - g_assert_cmpint (cogl_framebuffer_get_alpha_bits (fb_a), >=, 1); - - g_assert_cmpint (cogl_framebuffer_get_red_bits (fb_rgba), >=, 1); - g_assert_cmpint (cogl_framebuffer_get_green_bits (fb_rgba), >=, 1); - g_assert_cmpint (cogl_framebuffer_get_blue_bits (fb_rgba), >=, 1); - g_assert_cmpint (cogl_framebuffer_get_alpha_bits (fb_rgba), >=, 1); - - g_object_unref (fb_rgba); - cogl_object_unref (tex_rgba); - g_object_unref (fb_a); - cogl_object_unref (tex_a); -} diff --git a/src/tests/cogl/conform/meson.build b/src/tests/cogl/conform/meson.build index 301ad8e12..c7603e7e9 100644 --- a/src/tests/cogl/conform/meson.build +++ b/src/tests/cogl/conform/meson.build @@ -31,6 +31,7 @@ cogl_tests = [ [ 'test-npot-texture', [] ], [ 'test-alpha-textures', [] ], [ 'test-texture-get-set-data', [] ], + [ 'test-framebuffer-get-bits', [] ], ] cogl_test_conformance_includes = [ diff --git a/src/tests/cogl/conform/test-framebuffer-get-bits.c b/src/tests/cogl/conform/test-framebuffer-get-bits.c new file mode 100644 index 000000000..461d39500 --- /dev/null +++ b/src/tests/cogl/conform/test-framebuffer-get-bits.c @@ -0,0 +1,55 @@ +#include + +#include "tests/cogl-test-utils.h" + +static void +test_framebuffer_get_bits (void) +{ + CoglRenderer *renderer; + CoglTexture2D *tex_a; + CoglOffscreen *offscreen_a; + CoglFramebuffer *fb_a; + CoglTexture2D *tex_rgba; + CoglOffscreen *offscreen_rgba; + CoglFramebuffer *fb_rgba; + + renderer = cogl_context_get_renderer (test_ctx); + + if (cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL && + cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL3) + { + g_test_skip ("Test requires OpenGL"); + return; + } + + tex_a = cogl_texture_2d_new_with_size (test_ctx, 16, 16); + offscreen_a = cogl_offscreen_new_with_texture (tex_a); + fb_a = COGL_FRAMEBUFFER (offscreen_a); + tex_rgba = cogl_texture_2d_new_with_size (test_ctx, 16, 16); + offscreen_rgba = cogl_offscreen_new_with_texture (tex_rgba); + fb_rgba = COGL_FRAMEBUFFER (offscreen_rgba); + + cogl_texture_set_components (tex_a, + COGL_TEXTURE_COMPONENTS_A); + cogl_framebuffer_allocate (fb_a, NULL); + cogl_framebuffer_allocate (fb_rgba, NULL); + + g_assert_cmpint (cogl_framebuffer_get_red_bits (fb_a), ==, 0); + g_assert_cmpint (cogl_framebuffer_get_green_bits (fb_a), ==, 0); + g_assert_cmpint (cogl_framebuffer_get_blue_bits (fb_a), ==, 0); + g_assert_cmpint (cogl_framebuffer_get_alpha_bits (fb_a), >=, 1); + + g_assert_cmpint (cogl_framebuffer_get_red_bits (fb_rgba), >=, 1); + g_assert_cmpint (cogl_framebuffer_get_green_bits (fb_rgba), >=, 1); + g_assert_cmpint (cogl_framebuffer_get_blue_bits (fb_rgba), >=, 1); + g_assert_cmpint (cogl_framebuffer_get_alpha_bits (fb_rgba), >=, 1); + + g_object_unref (fb_rgba); + cogl_object_unref (tex_rgba); + g_object_unref (fb_a); + cogl_object_unref (tex_a); +} + +COGL_TEST_SUITE ( + g_test_add_func ("/framebuffer/get-bits", test_framebuffer_get_bits); +)