mirror of
https://github.com/brl/mutter.git
synced 2025-06-12 16:33:58 +00:00
units: Improve coverage of clutter_units_from_string()
Add a unit for an empty string as well as units for the missing unit types like cm, mm and px.
This commit is contained in:
@ -61,10 +61,21 @@ test_units_string (TestConformSimpleFixture *fixture,
|
||||
ClutterUnits units;
|
||||
gchar *string;
|
||||
|
||||
g_assert (clutter_units_from_string (&units, "") == FALSE);
|
||||
|
||||
g_assert (clutter_units_from_string (&units, "10") == TRUE);
|
||||
g_assert (clutter_units_get_unit_type (&units) == CLUTTER_UNIT_PIXEL);
|
||||
g_assert_cmpfloat (clutter_units_get_unit_value (&units), ==, 10);
|
||||
|
||||
g_assert (clutter_units_from_string (&units, "10 px") == TRUE);
|
||||
g_assert (clutter_units_get_unit_type (&units) == CLUTTER_UNIT_PIXEL);
|
||||
|
||||
g_assert (clutter_units_from_string (&units, "10 mm") == TRUE);
|
||||
g_assert (clutter_units_get_unit_type (&units) == CLUTTER_UNIT_MM);
|
||||
|
||||
g_assert (clutter_units_from_string (&units, "10 cm") == TRUE);
|
||||
g_assert (clutter_units_get_unit_type (&units) == CLUTTER_UNIT_CM);
|
||||
|
||||
g_assert (clutter_units_from_string (&units, "10 ") == TRUE);
|
||||
g_assert (clutter_units_get_unit_type (&units) == CLUTTER_UNIT_PIXEL);
|
||||
g_assert_cmpfloat (clutter_units_get_unit_value (&units), ==, 10);
|
||||
|
Reference in New Issue
Block a user