From 6e82d11daf8b1d7259c26e6a0816392a71c726f3 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 13 Jan 2010 17:31:13 +0000 Subject: [PATCH] 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. --- tests/conform/test-clutter-units.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/conform/test-clutter-units.c b/tests/conform/test-clutter-units.c index 105c454a9..d50a41689 100644 --- a/tests/conform/test-clutter-units.c +++ b/tests/conform/test-clutter-units.c @@ -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);