2012-12-13 10:27:52 -05:00
|
|
|
#include <cogl/cogl.h>
|
|
|
|
|
2019-01-20 05:41:48 -05:00
|
|
|
#include "test-declarations.h"
|
2012-12-13 10:27:52 -05:00
|
|
|
#include "test-utils.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
test_framebuffer_get_bits (void)
|
|
|
|
{
|
|
|
|
CoglTexture2D *tex_a =
|
|
|
|
cogl_texture_2d_new_with_size (test_ctx,
|
2013-07-01 20:48:54 -04:00
|
|
|
16, 16); /* width/height */
|
2012-12-13 10:27:52 -05:00
|
|
|
CoglOffscreen *offscreen_a =
|
2013-10-09 08:31:12 -04:00
|
|
|
cogl_offscreen_new_with_texture (tex_a);
|
2020-10-13 05:35:47 -04:00
|
|
|
CoglFramebuffer *fb_a = COGL_FRAMEBUFFER (offscreen_a);
|
2012-12-13 10:27:52 -05:00
|
|
|
CoglTexture2D *tex_rgba =
|
|
|
|
cogl_texture_2d_new_with_size (test_ctx,
|
2013-07-01 20:48:54 -04:00
|
|
|
16, 16); /* width/height */
|
2012-12-13 10:27:52 -05:00
|
|
|
CoglOffscreen *offscreen_rgba =
|
2013-10-09 08:31:12 -04:00
|
|
|
cogl_offscreen_new_with_texture (tex_rgba);
|
2020-10-13 05:35:47 -04:00
|
|
|
CoglFramebuffer *fb_rgba = COGL_FRAMEBUFFER (offscreen_rgba);
|
2012-12-13 10:27:52 -05:00
|
|
|
|
2013-07-01 20:48:54 -04:00
|
|
|
cogl_texture_set_components (tex_a,
|
|
|
|
COGL_TEXTURE_COMPONENTS_A);
|
2012-12-13 10:27:52 -05:00
|
|
|
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);
|
|
|
|
|
2020-10-13 05:35:47 -04:00
|
|
|
g_object_unref (fb_rgba);
|
2012-12-13 10:27:52 -05:00
|
|
|
cogl_object_unref (tex_rgba);
|
2020-10-13 05:35:47 -04:00
|
|
|
g_object_unref (fb_a);
|
2012-12-13 10:27:52 -05:00
|
|
|
cogl_object_unref (tex_a);
|
|
|
|
}
|