conformance: Add unit on the implicit alpha definition

Exercise the implicit alpha and timeline definition to catch
regressions in the ClutterScript parser code.
This commit is contained in:
Emmanuele Bassi 2009-11-06 10:53:43 +00:00
parent f9581ca5ce
commit 185107c6cf
4 changed files with 42 additions and 0 deletions

1
.gitignore vendored
View 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

View 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 ();
}

View 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);
}

View File

@ -0,0 +1,8 @@
{
"id" : "test",
"type" : "ClutterBehaviourOpacity",
"alpha" : {
"mode" : "easeOutCirc",
"timeline" : { "duration" : 500 }
}
}