6
#include "test-utils.h"
8
#define cogl_assert_float(a, b) \
10
if (fabsf ((a) - (b)) >= 0.0001f) \
11
g_assert_cmpfloat ((a), ==, (b)); \
18
float hue, saturation, luminance;
20
cogl_color_init_from_4ub(&color, 108, 198, 78, 255);
21
cogl_color_to_hsl(&color, &hue, &saturation, &luminance);
23
cogl_assert_float(hue, 105.f);
24
cogl_assert_float(saturation, 0.512821);
25
cogl_assert_float(luminance, 0.541176);
27
memset(&color, 0, sizeof (CoglColor));
28
cogl_color_init_from_hsl(&color, hue, saturation, luminance);
30
g_assert_cmpint (cogl_color_get_red_byte (&color), ==, 108);
31
g_assert_cmpint (cogl_color_get_green_byte (&color), ==, 198);
32
g_assert_cmpint (cogl_color_get_blue_byte (&color), ==, 78);
33
g_assert_cmpint (cogl_color_get_alpha_byte (&color), ==, 255);
35
memset(&color, 0, sizeof (CoglColor));
36
cogl_color_init_from_hsl(&color, hue, 0, luminance);
38
cogl_assert_float (cogl_color_get_red_float (&color), luminance);
39
cogl_assert_float (cogl_color_get_green_float (&color), luminance);
40
cogl_assert_float (cogl_color_get_blue_float (&color), luminance);
41
cogl_assert_float (cogl_color_get_alpha_float (&color), 1.0f);
43
if (cogl_test_verbose ())