conform/color: Check invalid strings
We need to make sure to fail consistently for invalid strings.
This commit is contained in:
parent
0550a8b99d
commit
e374c2bd89
@ -73,8 +73,24 @@ test_color_hls_roundtrip (TestConformSimpleFixture *fixture,
|
||||
}
|
||||
|
||||
void
|
||||
test_color_from_string (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
test_color_from_string_invalid (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
{
|
||||
ClutterColor color;
|
||||
|
||||
g_assert (!clutter_color_from_string (&color, "ff0000ff"));
|
||||
g_assert (!clutter_color_from_string (&color, "#decaffbad"));
|
||||
g_assert (!clutter_color_from_string (&color, "ponies"));
|
||||
g_assert (!clutter_color_from_string (&color, "rgb(255, 0, 0, 0)"));
|
||||
g_assert (!clutter_color_from_string (&color, "rgba(1.0, 0, 0)"));
|
||||
g_assert (!clutter_color_from_string (&color, "hsl(100, 0, 0)"));
|
||||
g_assert (!clutter_color_from_string (&color, "hsla(10%, 0%, 50%)"));
|
||||
g_assert (!clutter_color_from_string (&color, "hsla(100%, 0%, 50%, 20%)"));
|
||||
}
|
||||
|
||||
void
|
||||
test_color_from_string_valid (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
{
|
||||
ClutterColor color;
|
||||
|
||||
|
@ -182,7 +182,8 @@ main (int argc, char **argv)
|
||||
TEST_CONFORM_SIMPLE ("/model", test_list_model_from_script);
|
||||
TEST_CONFORM_SIMPLE ("/model", test_list_model_row_changed);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/color", test_color_from_string);
|
||||
TEST_CONFORM_SIMPLE ("/color", test_color_from_string_valid);
|
||||
TEST_CONFORM_SIMPLE ("/color", test_color_from_string_invalid);
|
||||
TEST_CONFORM_SIMPLE ("/color", test_color_to_string);
|
||||
TEST_CONFORM_SIMPLE ("/color", test_color_hls_roundtrip);
|
||||
TEST_CONFORM_SIMPLE ("/color", test_color_operators);
|
||||
|
Loading…
Reference in New Issue
Block a user