diff options
Diffstat (limited to 'clutter/tests/conform')
-rw-r--r-- | clutter/tests/conform/Makefile.am | 7 | ||||
-rw-r--r-- | clutter/tests/conform/animator.c | 199 | ||||
-rw-r--r-- | clutter/tests/conform/meson.build | 1 | ||||
-rw-r--r-- | clutter/tests/conform/scripts/test-animator-1.json | 5 | ||||
-rw-r--r-- | clutter/tests/conform/scripts/test-animator-2.json | 29 | ||||
-rw-r--r-- | clutter/tests/conform/scripts/test-animator-3.json | 40 | ||||
-rw-r--r-- | clutter/tests/conform/scripts/test-state-1.json | 33 | ||||
-rw-r--r-- | clutter/tests/conform/state.c | 87 |
8 files changed, 1 insertions, 400 deletions
diff --git a/clutter/tests/conform/Makefile.am b/clutter/tests/conform/Makefile.am index acd9d2d09..11d4835ad 100644 --- a/clutter/tests/conform/Makefile.am +++ b/clutter/tests/conform/Makefile.am @@ -49,7 +49,6 @@ general_tests = \ # Test for deprecated functionality deprecated_tests = \ - animator \ behaviours \ group \ rectangle \ @@ -61,9 +60,6 @@ test_programs = $(actor_tests) $(general_tests) $(classes_tests) $(deprecated_te dist_test_data = $(script_ui_files) script_ui_files = $(addprefix scripts/,$(script_tests)) script_tests = \ - test-animator-1.json \ - test-animator-2.json \ - test-animator-3.json \ test-script-animation.json \ test-script-child.json \ test-script-implicit-alpha.json \ @@ -74,8 +70,7 @@ script_tests = \ test-script-named-object.json \ test-script-object-property.json \ test-script-single.json \ - test-script-timeline-markers.json \ - test-state-1.json + test-script-timeline-markers.json TESTS_ENVIRONMENT += G_ENABLE_DIAGNOSTIC=0 CLUTTER_ENABLE_DIAGNOSTIC=0 CLUTTER_SCALE=1 diff --git a/clutter/tests/conform/animator.c b/clutter/tests/conform/animator.c deleted file mode 100644 index 971169903..000000000 --- a/clutter/tests/conform/animator.c +++ /dev/null @@ -1,199 +0,0 @@ -#define CLUTTER_DISABLE_DEPRECATION_WARNINGS -#include <clutter/clutter.h> - -static void -animator_multi_properties (void) -{ - ClutterScript *script = clutter_script_new (); - GObject *animator = NULL, *foo = NULL; - GError *error = NULL; - gchar *test_file; - GList *keys; - ClutterAnimatorKey *key; - GValue value = { 0, }; - - test_file = g_test_build_filename (G_TEST_DIST, - "scripts", - "test-animator-3.json", - NULL); - clutter_script_load_from_file (script, test_file, &error); - if (g_test_verbose () && error) - g_print ("Error: %s", error->message); - - g_assert_no_error (error); - - foo = clutter_script_get_object (script, "foo"); - g_assert (G_IS_OBJECT (foo)); - - animator = clutter_script_get_object (script, "animator"); - g_assert (CLUTTER_IS_ANIMATOR (animator)); - - /* get all the keys for foo:x */ - keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator), - foo, "x", - -1.0); - g_assert_cmpint (g_list_length (keys), ==, 3); - - key = g_list_nth_data (keys, 1); - g_assert (key != NULL); - - if (g_test_verbose ()) - { - g_print ("(foo, x).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); - - /* get all the keys for foo:y */ - keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator), - foo, "y", - -1.0); - g_assert_cmpint (g_list_length (keys), ==, 3); - - key = g_list_nth_data (keys, 2); - g_assert (key != NULL); - - if (g_test_verbose ()) - { - g_print ("(foo, y).keys[2] = \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.8); - g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "y"); - - 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), ==, 200.0); - g_value_unset (&value); - - g_list_free (keys); - - g_object_unref (script); - g_free (test_file); -} - -static void -animator_properties (void) -{ - ClutterScript *script = clutter_script_new (); - GObject *animator = NULL; - GError *error = NULL; - gchar *test_file; - GList *keys; - ClutterAnimatorKey *key; - GValue value = { 0, }; - - test_file = g_test_build_filename (G_TEST_DIST, - "scripts", - "test-animator-2.json", - NULL); - clutter_script_load_from_file (script, test_file, &error); - if (g_test_verbose () && error) - g_print ("Error: %s", error->message); - - g_assert_no_error (error); - - animator = clutter_script_get_object (script, "animator"); - g_assert (CLUTTER_IS_ANIMATOR (animator)); - - /* get all the keys */ - keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator), - NULL, NULL, -1.0); - g_assert_cmpint (g_list_length (keys), ==, 3); - - 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); - g_free (test_file); -} - -static void -animator_base (void) -{ - ClutterScript *script = clutter_script_new (); - GObject *animator = NULL; - GError *error = NULL; - guint duration = 0; - gchar *test_file; - - test_file = g_test_build_filename (G_TEST_DIST, - "scripts", - "test-animator-1.json", - NULL); - clutter_script_load_from_file (script, test_file, &error); - if (g_test_verbose () && error) - g_print ("Error: %s", error->message); - - g_assert_no_error (error); - - animator = clutter_script_get_object (script, "animator"); - g_assert (CLUTTER_IS_ANIMATOR (animator)); - - duration = clutter_animator_get_duration (CLUTTER_ANIMATOR (animator)); - g_assert_cmpint (duration, ==, 1000); - - g_object_unref (script); - g_free (test_file); -} - -CLUTTER_TEST_SUITE ( - CLUTTER_TEST_UNIT ("/script/animator/base", animator_base) - CLUTTER_TEST_UNIT ("/script/animator/properties", animator_properties) - CLUTTER_TEST_UNIT ("/script/animator/multi-properties", animator_multi_properties) -) diff --git a/clutter/tests/conform/meson.build b/clutter/tests/conform/meson.build index 87b316318..474af146d 100644 --- a/clutter/tests/conform/meson.build +++ b/clutter/tests/conform/meson.build @@ -40,7 +40,6 @@ clutter_conform_tests_general_tests = [ ] clutter_conform_tests_deprecated_tests = [ - 'animator', 'behaviours', 'rectangle', 'texture', diff --git a/clutter/tests/conform/scripts/test-animator-1.json b/clutter/tests/conform/scripts/test-animator-1.json deleted file mode 100644 index 2d6aab908..000000000 --- a/clutter/tests/conform/scripts/test-animator-1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type" : "ClutterAnimator", - "id" : "animator", - "duration" : 1000 -} diff --git a/clutter/tests/conform/scripts/test-animator-2.json b/clutter/tests/conform/scripts/test-animator-2.json deleted file mode 100644 index 9059f57ed..000000000 --- a/clutter/tests/conform/scripts/test-animator-2.json +++ /dev/null @@ -1,29 +0,0 @@ -[ - { - "type" : "ClutterRectangle", - "id" : "foo", - "x" : 0, - "y" : 0, - "width" : 100, - "height" : 100 - }, - { - "type" : "ClutterAnimator", - "id" : "animator", - "duration" : 1000, - - "properties" : [ - { - "object" : "foo", - "name" : "x", - "ease-in" : true, - "interpolation" : "linear", - "keys" : [ - [ 0.0, "easeInCubic", 100.0 ], - [ 0.2, "easeOutCubic", 150.0 ], - [ 0.8, "linear", 200.0 ] - ] - } - ] - } -] diff --git a/clutter/tests/conform/scripts/test-animator-3.json b/clutter/tests/conform/scripts/test-animator-3.json deleted file mode 100644 index 26d779bee..000000000 --- a/clutter/tests/conform/scripts/test-animator-3.json +++ /dev/null @@ -1,40 +0,0 @@ -[ - { - "type" : "ClutterRectangle", - "id" : "foo", - "x" : 0, - "y" : 0, - "width" : 100, - "height" : 100 - }, - { - "type" : "ClutterAnimator", - "id" : "animator", - "duration" : 1000, - - "properties" : [ - { - "object" : "foo", - "name" : "x", - "ease-in" : true, - "interpolation" : "linear", - "keys" : [ - [ 0.0, "easeInCubic", 100.0 ], - [ 0.2, "easeOutCubic", 150.0 ], - [ 0.8, "linear", 200.0 ] - ] - }, - { - "object" : "foo", - "name" : "y", - "ease-in" : true, - "interpolation" : "linear", - "keys" : [ - [ 0.0, "easeInCubic", 100.0 ], - [ 0.2, "easeOutCubic", 150.0 ], - [ 0.8, "linear", 200.0 ] - ] - } - ] - } -] diff --git a/clutter/tests/conform/scripts/test-state-1.json b/clutter/tests/conform/scripts/test-state-1.json deleted file mode 100644 index 78ab5de89..000000000 --- a/clutter/tests/conform/scripts/test-state-1.json +++ /dev/null @@ -1,33 +0,0 @@ -[ - { - "type" : "ClutterRectangle", - "id" : "rect", - "width" : 100, - "height" : 100 - }, - { - "type" : "ClutterState", - "id" : "state", - - "transitions" : [ - { - "source" : "base", - "target" : "clicked", - "duration" : 250, - - "keys" : [ - [ "rect", "opacity", "linear", 128 ] - ] - }, - { - "source" : "clicked", - "target" : "base", - "duration" : 150, - - "keys" : [ - [ "rect", "opacity", "linear", 255 ] - ] - } - ] - } -] diff --git a/clutter/tests/conform/state.c b/clutter/tests/conform/state.c deleted file mode 100644 index 7e4720dc5..000000000 --- a/clutter/tests/conform/state.c +++ /dev/null @@ -1,87 +0,0 @@ -#include <clutter/clutter.h> - -#include "test-conform-common.h" - -void -state_base (TestConformSimpleFixture *fixture G_GNUC_UNUSED, - gconstpointer dummy G_GNUC_UNUSED) -{ - ClutterScript *script = clutter_script_new (); - GObject *state = NULL; - GError *error = NULL; - gchar *test_file; - GList *states, *keys; - ClutterStateKey *state_key; - guint duration; - - test_file = clutter_test_get_data_file ("test-state-1.json"); - clutter_script_load_from_file (script, test_file, &error); - if (g_test_verbose () && error) - g_print ("Error: %s\n", error->message); - - g_free (test_file); - -#if GLIB_CHECK_VERSION (2, 20, 0) - g_assert_no_error (error); -#else - g_assert (error == NULL); -#endif - - state = clutter_script_get_object (script, "state"); - g_assert (CLUTTER_IS_STATE (state)); - - states = clutter_state_get_states (CLUTTER_STATE (state)); - g_assert (states != NULL); - - g_assert (g_list_find (states, g_intern_static_string ("clicked"))); - g_list_free (states); - - duration = clutter_state_get_duration (CLUTTER_STATE (state), "base", "clicked"); - g_assert_cmpint (duration, ==, 250); - - duration = clutter_state_get_duration (CLUTTER_STATE (state), "clicked", "base"); - g_assert_cmpint (duration, ==, 150); - - keys = clutter_state_get_keys (CLUTTER_STATE (state), "base", "clicked", - clutter_script_get_object (script, "rect"), - "opacity"); - - g_assert (keys != NULL); - g_assert_cmpint (g_list_length (keys), ==, 1); - - state_key = keys->data; - g_assert (clutter_state_key_get_object (state_key) == clutter_script_get_object (script, "rect")); - g_assert (clutter_state_key_get_mode (state_key) == CLUTTER_LINEAR); - g_assert_cmpstr (clutter_state_key_get_property_name (state_key), ==, "opacity"); - - g_list_free (keys); - keys = clutter_state_get_keys (CLUTTER_STATE (state), NULL, NULL, NULL, NULL); - g_assert_cmpint (g_list_length (keys), ==, 2); - g_list_free (keys); - - - - clutter_state_set (CLUTTER_STATE (state), "base", "clicked", state, "state", CLUTTER_LINEAR, "foo", NULL); - - keys = clutter_state_get_keys (CLUTTER_STATE (state), "base", "clicked", - NULL, NULL); - - g_assert (keys != NULL); - g_assert_cmpint (g_list_length (keys), ==, 2); - g_list_free (keys); - - states = clutter_state_get_states (CLUTTER_STATE (state)); - g_assert_cmpint (g_list_length (states), ==, 2); - g_list_free (states); - - clutter_state_remove_key (CLUTTER_STATE (state), NULL, "clicked", NULL, NULL); - states = clutter_state_get_states (CLUTTER_STATE (state)); - - /* removing the "clicked" state, will also cause the "base" state to be removed - * since in the .json there is no default source state - */ - g_assert_cmpint (g_list_length (states), ==, 0); - g_list_free (states); - - g_object_unref (script); -} |