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:
Emmanuele Bassi 2010-01-13 17:31:13 +00:00
parent ed735ae730
commit 6e82d11daf

View File

@ -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);