units: Improve coverage of clutter_units_from_string()
authorEmmanuele Bassi <ebassi@linux.intel.com>
Wed, 13 Jan 2010 17:31:13 +0000 (17:31 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Wed, 13 Jan 2010 17:31:13 +0000 (17:31 +0000)
Add a unit for an empty string as well as units for the missing unit
types like cm, mm and px.

tests/conform/test-clutter-units.c

index 105c454..d50a416 100644 (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);