test-animator: Do not use mid-function blocks
authorEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 8 Feb 2010 17:56:35 +0000 (17:56 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 8 Feb 2010 17:56:35 +0000 (17:56 +0000)
The test_animator_properties unit is so small that declaring a
mid-function block for two variables is not that clever.

tests/conform/test-animator.c

index da17e31..c1b1933 100644 (file)
@@ -11,6 +11,8 @@ test_animator_properties (TestConformSimpleFixture *fixture,
   GError *error = NULL;
   gchar *test_file;
   GList *keys;
+  ClutterAnimatorKey *key;
+  GValue value = { 0, };
 
   test_file = clutter_test_get_data_file ("test-animator-2.json");
   clutter_script_load_from_file (script, test_file, &error);
@@ -26,35 +28,32 @@ test_animator_properties (TestConformSimpleFixture *fixture,
                                     NULL, NULL, -1.0);
   g_assert_cmpint (g_list_length (keys), ==, 3);
 
-  {
-    const ClutterAnimatorKey *key = g_list_nth_data (keys, 1);
-    GValue value = { 0, };
-
-    g_assert (key != NULL);
-
-    if (g_test_verbose ())
-      {
-        g_print ("keys[1] = \n"
-                 ".object = %s\n"
-                 ".progress = %.2f\n"
-                 ".name = '%s'\n"
-                 ".type = '%s'\n",
-                 clutter_get_script_id (clutter_animator_key_get_object (key)),
-                 clutter_animator_key_get_progress (key),
-                 clutter_animator_key_get_property_name (key),
-                 g_type_name (clutter_animator_key_get_property_type (key)));
-      }
-
-    g_assert (clutter_animator_key_get_object (key) != NULL);
-    g_assert_cmpfloat (clutter_animator_key_get_progress (key), ==, 0.2);
-    g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "x");
-
-    g_assert (clutter_animator_key_get_property_type (key) == G_TYPE_FLOAT);
-
-    g_value_init (&value, G_TYPE_FLOAT);
-    g_assert (clutter_animator_key_get_value (key, &value));
-    g_assert_cmpfloat (g_value_get_float (&value), ==, 150.0);
-  }
+  key = g_list_nth_data (keys, 1);
+  g_assert (key != NULL);
+
+  if (g_test_verbose ())
+    {
+      g_print ("keys[1] = \n"
+               ".object = %s\n"
+               ".progress = %.2f\n"
+               ".name = '%s'\n"
+               ".type = '%s'\n",
+               clutter_get_script_id (clutter_animator_key_get_object (key)),
+               clutter_animator_key_get_progress (key),
+               clutter_animator_key_get_property_name (key),
+               g_type_name (clutter_animator_key_get_property_type (key)));
+    }
+
+  g_assert (clutter_animator_key_get_object (key) != NULL);
+  g_assert_cmpfloat (clutter_animator_key_get_progress (key), ==, 0.2);
+  g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "x");
+
+  g_assert (clutter_animator_key_get_property_type (key) == G_TYPE_FLOAT);
+
+  g_value_init (&value, G_TYPE_FLOAT);
+  g_assert (clutter_animator_key_get_value (key, &value));
+  g_assert_cmpfloat (g_value_get_float (&value), ==, 150.0);
+  g_value_unset (&value);
 
   g_list_free (keys);
   g_object_unref (script);