clutter: Remove ClutterAnimation

This removes ClutterAnimation and related tests. ClutterAnimation has
been deprecated for a long time, and replacements exist and are used by
e.g. GNOME Shell since a while back.

This also disables a few relatively unrelated interactive tests, as they
rely on ClutterAnimation to implement some animations they use to
illustrate what they actually test.

As interactive tests currently are more or less untestable due to any
interaction with them crashing, as well as they in practice means
rewriting the tests using non-deprecated animation APIs, they are not
ported right now. To actually port the interactive tests, it needs to be
possible to fist interact with them.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1192
This commit is contained in:
Jonas Ådahl
2020-04-09 17:54:45 +02:00
committed by Georges Basile Stavracas Neto
parent b46bc98d44
commit 322b51cded
16 changed files with 19 additions and 1924 deletions

View File

@ -251,28 +251,6 @@ script_named_object (void)
g_free (test_file);
}
static void
script_animation (void)
{
ClutterScript *script = clutter_script_new ();
GObject *animation = NULL;
GError *error = NULL;
gchar *test_file;
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-animation.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);
animation = clutter_script_get_object (script, "test");
g_assert (CLUTTER_IS_ANIMATION (animation));
g_object_unref (script);
g_free (test_file);
}
static void
script_layout_property (void)
{
@ -383,7 +361,6 @@ CLUTTER_TEST_SUITE (
CLUTTER_TEST_UNIT ("/script/single-object", script_single)
CLUTTER_TEST_UNIT ("/script/container-child", script_child)
CLUTTER_TEST_UNIT ("/script/named-object", script_named_object)
CLUTTER_TEST_UNIT ("/script/animation", script_animation)
CLUTTER_TEST_UNIT ("/script/object-property", script_object_property)
CLUTTER_TEST_UNIT ("/script/layout-property", script_layout_property)
CLUTTER_TEST_UNIT ("/script/actor-margin", script_margin)

View File

@ -1,14 +0,0 @@
{
"type" : "ClutterAnimation",
"id" : "test",
"mode" : "easeInCubic",
"duration" : 500,
"object" : {
"type" : "ClutterRectangle",
"id" : "rect",
"opacity" : 128,
"width" : 100,
"height" : 16,
"color" : "white"
}
}

View File

@ -17,7 +17,6 @@ clutter_tests_interactive_link_args = [
clutter_tests_interactive_test_sources = [
'test-events.c',
'test-actors.c',
'test-shader-effects.c',
'test-script.c',
'test-grab.c',
'test-cogl-shader-glsl.c',
@ -25,9 +24,7 @@ clutter_tests_interactive_test_sources = [
'test-cogl-tex-convert.c',
'test-cogl-offscreen.c',
'test-cogl-tex-polygon.c',
'test-cogl-multitexture.c',
'test-paint-wrapper.c',
'test-layout.c',
'test-animation.c',
'test-easing.c',
'test-binding-pool.c',
@ -38,11 +35,9 @@ clutter_tests_interactive_test_sources = [
'test-stage-sizing.c',
'test-swipe-action.c',
'test-cogl-point-sprites.c',
'test-path-constraint.c',
'test-devices.c',
'test-content.c',
'test-keyframe-transition.c',
'test-bind-constraint.c',
'test-touch-events.c',
'test-rotate-zoom.c',
'test-image.c',

View File

@ -53,8 +53,6 @@ static gboolean recenter = FALSE;
static ClutterActor *main_stage = NULL;
static ClutterActor *easing_mode_label = NULL;
static ClutterAnimation *last_animation = NULL;
int
test_easing_main (int argc, char *argv[]);
@ -66,21 +64,23 @@ test_easing_describe (void);
* repositions (through an animation) the bouncer at the center of the stage
*/
static void
recenter_bouncer (ClutterAnimation *animation,
ClutterActor *rectangle)
recenter_bouncer (ClutterActor *rectangle)
{
gfloat base_x, base_y;
gint cur_mode;
cur_mode = easing_modes[current_mode].mode;
base_x = clutter_actor_get_width (main_stage) / 2;
base_y = clutter_actor_get_height (main_stage) / 2;
cur_mode = easing_modes[current_mode].mode;
clutter_actor_set_easing_duration (rectangle, 250);
clutter_actor_set_easing_mode (rectangle, cur_mode);
clutter_actor_set_position (rectangle, base_x, base_y);
clutter_actor_animate (rectangle, cur_mode, 250,
"x", base_x,
"y", base_y,
NULL);
g_signal_connect_after (rectangle, "transition-completed",
G_CALLBACK (clutter_actor_restore_easing_state),
NULL);
}
static gboolean
@ -108,28 +108,22 @@ on_button_press (ClutterActor *actor,
}
else if (event->button == CLUTTER_BUTTON_PRIMARY)
{
ClutterAnimation *animation;
ClutterAnimationMode cur_mode;
cur_mode = easing_modes[current_mode].mode;
/* tween the actor using the current easing mode */
animation =
clutter_actor_animate (rectangle, cur_mode, duration * 1000,
"x", event->x,
"y", event->y,
NULL);
clutter_actor_save_easing_state (rectangle);
clutter_actor_set_easing_duration (rectangle, duration * 1000);
clutter_actor_set_easing_mode (rectangle, cur_mode);
clutter_actor_set_position (rectangle, event->x, event->y);
/* if we were asked to, recenter the bouncer at the end of the
* animation. we keep track of the animation to avoid connecting
* the signal handler to the same Animation twice.
*/
if (recenter && last_animation != animation)
g_signal_connect_after (animation, "completed",
G_CALLBACK (recenter_bouncer),
rectangle);
last_animation = animation;
g_signal_connect_after (rectangle, "transition-completed",
G_CALLBACK (recenter_bouncer),
rectangle);
}
return TRUE;