tests: Wait for windows being mapped after show

Since having a window shown is becoming a more asynchronous process,
we should wait for the window actor being mapped after requesting
the window to be shown.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2175>
This commit is contained in:
Carlos Garnacho 2022-09-17 14:08:40 +02:00 committed by Marge Bot
parent 05efcb4b21
commit 62d91bb5fd

View File

@ -116,6 +116,14 @@ wait_for_paint (ClutterActor *stage)
g_signal_handler_disconnect (stage, was_painted_id);
}
static void
wait_for_window_map (ClutterActor *stage,
ClutterActor *window_actor)
{
while (!clutter_actor_is_mapped (window_actor))
wait_for_paint (stage);
}
static void
on_stage_views_changed (ClutterActor *actor,
gboolean *stage_views_changed)
@ -1158,6 +1166,7 @@ meta_test_actor_stage_views_queue_frame_drawn (void)
if (!test_window)
g_error ("Failed to find the window: %s", error->message);
window_actor = CLUTTER_ACTOR (meta_window_actor_from_window (test_window));
wait_for_window_map (stage, window_actor);
g_assert_nonnull (clutter_actor_peek_stage_views (window_actor));
/* Queue an X11 _NET_WM_FRAME_DRAWN event; this will find the frame clock via