From c8d57037882729a7ea0117726f2e8e48b10416ac Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 13 Nov 2009 14:10:29 +0000 Subject: [PATCH] tests: Add unit for Animation definitions Verify that an Animation can be defined using ClutterScript. No initial/final state of the animation, yet. --- .gitignore | 1 + tests/conform/test-conform-main.c | 1 + tests/conform/test-script-parser.c | 22 ++++++++++++++++++++++ tests/data/test-script-animation.json | 14 ++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 tests/data/test-script-animation.json diff --git a/.gitignore b/.gitignore index 3f95d61..c8b1df7 100644 --- a/.gitignore +++ b/.gitignore @@ -223,6 +223,7 @@ TAGS /tests/conform/test-script-child /tests/conform/test-script-implicit-alpha /tests/conform/test-script-object-property +/tests/conform/test-script-animation /tests/micro-bench/test-text-perf /tests/micro-bench/test-text /tests/micro-bench/test-picking diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c index 33aaa0f..a6475bc 100644 --- a/tests/conform/test-conform-main.c +++ b/tests/conform/test-conform-main.c @@ -189,6 +189,7 @@ main (int argc, char **argv) TEST_CONFORM_SIMPLE ("/script", test_script_child); TEST_CONFORM_SIMPLE ("/script", test_script_implicit_alpha); TEST_CONFORM_SIMPLE ("/script", test_script_object_property); + TEST_CONFORM_SIMPLE ("/script", test_script_animation); return g_test_run (); } diff --git a/tests/conform/test-script-parser.c b/tests/conform/test-script-parser.c index 7fe5ae0..1e9b397 100644 --- a/tests/conform/test-script-parser.c +++ b/tests/conform/test-script-parser.c @@ -256,3 +256,25 @@ test_script_object_property (TestConformSimpleFixture *fixture, clutter_actor_destroy (CLUTTER_ACTOR (actor)); g_free (test_file); } + +void +test_script_animation (TestConformSimpleFixture *fixture, + gconstpointer dummy) +{ + ClutterScript *script = clutter_script_new (); + GObject *animation = NULL; + GError *error = NULL; + gchar *test_file; + + test_file = clutter_test_get_data_file ("test-script-animation.json"); + clutter_script_load_from_file (script, test_file, &error); + if (g_test_verbose () && error) + g_print ("Error: %s", error->message); + g_assert (error == NULL); + + animation = clutter_script_get_object (script, "test"); + g_assert (CLUTTER_IS_ANIMATION (animation)); + + g_object_unref (script); + g_free (test_file); +} diff --git a/tests/data/test-script-animation.json b/tests/data/test-script-animation.json new file mode 100644 index 0000000..dfa5255 --- /dev/null +++ b/tests/data/test-script-animation.json @@ -0,0 +1,14 @@ +{ + "type" : "ClutterAnimation", + "id" : "test", + "mode" : "easeInCubic", + "duration" : 500, + "object" : { + "type" : "ClutterRectangle", + "id" : "rect", + "opacity" : 128, + "width" : 100, + "height" : 16, + "color" : "white" + }, +} -- 2.7.4