conformance: Add unit on the implicit alpha definition
authorEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 6 Nov 2009 10:53:43 +0000 (10:53 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 6 Nov 2009 11:39:30 +0000 (11:39 +0000)
Exercise the implicit alpha and timeline definition to catch
regressions in the ClutterScript parser code.

.gitignore
tests/conform/test-conform-main.c
tests/conform/test-script-parser.c
tests/data/test-script-implicit-alpha.json [new file with mode: 0644]

index 17a20fc..89476a5 100644 (file)
@@ -221,6 +221,7 @@ TAGS
 /tests/conform/test-texture-fbo
 /tests/conform/test-script-single
 /tests/conform/test-script-child
+/tests/conform/test-script-implicit-alpha
 /tests/micro-bench/test-text-perf
 /tests/micro-bench/test-text
 /tests/micro-bench/test-picking
index 9872e23..3811e7f 100644 (file)
@@ -187,6 +187,7 @@ main (int argc, char **argv)
 
   TEST_CONFORM_SIMPLE ("/script", test_script_single);
   TEST_CONFORM_SIMPLE ("/script", test_script_child);
+  TEST_CONFORM_SIMPLE ("/script", test_script_implicit_alpha);
 
   return g_test_run ();
 }
index 6411fec..3a38374 100644 (file)
@@ -193,3 +193,35 @@ test_script_single (TestConformSimpleFixture *fixture,
   clutter_actor_destroy (rect);
   g_free (test_file);
 }
+
+void
+test_script_implicit_alpha (TestConformSimpleFixture *fixture,
+                            gconstpointer dummy)
+{
+  ClutterScript *script = clutter_script_new ();
+  ClutterTimeline *timeline;
+  GObject *behaviour = NULL;
+  GError *error = NULL;
+  ClutterAlpha *alpha;
+  gchar *test_file;
+
+  test_file = clutter_test_get_data_file ("test-script-implicit-alpha.json");
+  clutter_script_load_from_file (script, test_file, &error);
+  g_assert (error == NULL);
+
+  behaviour = clutter_script_get_object (script, "test");
+  g_assert (CLUTTER_IS_BEHAVIOUR (behaviour));
+
+  alpha = clutter_behaviour_get_alpha (CLUTTER_BEHAVIOUR (behaviour));
+  g_assert (CLUTTER_IS_ALPHA (alpha));
+
+  g_assert_cmpint (clutter_alpha_get_mode (alpha), ==, CLUTTER_EASE_OUT_CIRC);
+
+  timeline = clutter_alpha_get_timeline (alpha);
+  g_assert (CLUTTER_IS_TIMELINE (timeline));
+
+  g_assert_cmpint (clutter_timeline_get_duration (timeline), ==, 500);
+
+  g_object_unref (script);
+  g_free (test_file);
+}
diff --git a/tests/data/test-script-implicit-alpha.json b/tests/data/test-script-implicit-alpha.json
new file mode 100644 (file)
index 0000000..5aab70d
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "id" : "test",
+  "type" : "ClutterBehaviourOpacity",
+  "alpha" : {
+    "mode" : "easeOutCirc",
+    "timeline" : { "duration" : 500 }
+  }
+}