color: Support the CSS hsl() notation

Since we support the rgb() and rgba() notations we might as well also
support the hsl() one.
This commit is contained in:
Emmanuele Bassi
2010-11-22 15:02:47 +00:00
parent ab6da347f6
commit e86db85cd2
2 changed files with 84 additions and 0 deletions

View File

@ -191,6 +191,20 @@ test_color_from_string (TestConformSimpleFixture *fixture,
g_assert_cmpint (color.green, ==, 0);
g_assert_cmpint (color.blue, ==, 255);
g_assert_cmpint (color.alpha, ==, 255);
g_assert (clutter_color_from_string (&color, "hsl( 0, 100%, 50% )"));
if (g_test_verbose ())
{
g_print ("color = { %x, %x, %x, %x }, expected = { 255, 0, 0, 255 }\n",
color.red,
color.green,
color.blue,
color.alpha);
}
g_assert_cmpint (color.red, ==, 255);
g_assert_cmpint (color.green, ==, 0);
g_assert_cmpint (color.blue, ==, 0);
g_assert_cmpint (color.alpha, ==, 255);
}
void