mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
tests: Don't rely on latency for actually showing Wayland windows
The test runner sends a "show" command to the test clients and assumes this was enough work done by the client to enable the compositor to map the window. Now that we wait to show a Wayland window until the first buffer is attached (see bug 750552), we need to make sure that we attach a buffer before assuming that we have the final stacking order. So, to in order to continue relying on "show" to be enough to actually show a window, let the test client wait until it has drawn the first frame. This makes the tests using Wayland clients test non-flaky. https://bugzilla.gnome.org/show_bug.cgi?id=754711
This commit is contained in:
parent
d455de32a0
commit
5054b2a99c
@ -41,6 +41,16 @@ lookup_window (const char *window_id)
|
||||
return window;
|
||||
}
|
||||
|
||||
static void
|
||||
on_after_paint (GdkFrameClock *clock,
|
||||
GMainLoop *loop)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (clock,
|
||||
(gpointer) on_after_paint,
|
||||
loop);
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
static void
|
||||
process_line (const char *line)
|
||||
{
|
||||
@ -135,10 +145,25 @@ process_line (const char *line)
|
||||
}
|
||||
|
||||
GtkWidget *window = lookup_window (argv[1]);
|
||||
GdkWindow *gdk_window = gtk_widget_get_window (window);
|
||||
if (!window)
|
||||
goto out;
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* When a Wayland client, we cannot be really sure that the window has
|
||||
* been mappable until after we have painted. So, in order to have the
|
||||
* test runner rely on the "show" command to have done what the client
|
||||
* needs to do in order for a window to be mappable compositor side, lets
|
||||
* wait with returning until after the first frame.
|
||||
*/
|
||||
GdkFrameClock *frame_clock = gdk_window_get_frame_clock (gdk_window);
|
||||
GMainLoop *loop = g_main_loop_new (NULL, FALSE);
|
||||
g_signal_connect (frame_clock, "after-paint",
|
||||
G_CALLBACK (on_after_paint),
|
||||
loop);
|
||||
g_main_loop_run (loop);
|
||||
g_main_loop_unref (loop);
|
||||
}
|
||||
else if (strcmp (argv[0], "hide") == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user