tests/actor-pick: Allocate actor before picking

Picking now only happens on allocated actors, but the
callback in the actor-pick test is not waiting for the
stage to run an allocation cycle. Ideally, we'd wait
for this cycle, but for now, forcing an allocation works
as well.

Allocate the overlay actor in the actor-pick test.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1169
This commit is contained in:
Georges Basile Stavracas Neto 2020-03-31 19:01:53 -03:00
parent 059d2144b2
commit 7f488e3e1d

View File

@ -67,6 +67,9 @@ on_timeout (gpointer data)
}
else if (test_num == 2)
{
ClutterActorBox over_actor_box =
CLUTTER_ACTOR_BOX_INIT (0, 0, STAGE_WIDTH, STAGE_HEIGHT);
/* Make the actor visible but set a clip so that only some
of the actors are accessible */
clutter_actor_show (over_actor);
@ -76,6 +79,11 @@ on_timeout (gpointer data)
state->actor_width * (ACTORS_X - 4),
state->actor_height * (ACTORS_Y - 4));
/* Only allocated actors can be picked, so force an allocation
* of the overlay actor here.
*/
clutter_actor_allocate (over_actor, &over_actor_box, 0);
if (g_test_verbose ())
g_print ("Clipped covering actor:\n");
}