tests: Add test for testing that setting a parent affects the stack

A new test is added that tests that xdg_surface.set_parent (referred to
as "transient for" in X11 terminology) affects the stack immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=755606
This commit is contained in:
Jonas Ådahl 2015-09-24 13:39:58 +08:00
parent 213f0fa160
commit 75b992c7d0
4 changed files with 57 additions and 0 deletions

View File

@ -9,6 +9,7 @@ dist_stacking_DATA = \
tests/stacking/basic-wayland.metatest \
tests/stacking/minimized.metatest \
tests/stacking/mixed-windows.metatest \
tests/stacking/set-parent.metatest \
tests/stacking/override-redirect.metatest
mutter-all.test: tests/mutter-all.test.in

View File

@ -0,0 +1,14 @@
new_client 1 wayland
create 1/1
show 1/1
create 1/2
show 1/2
wait
assert_stacking 1/1 1/2
set_parent 1/1 2
wait
assert_stacking 1/2 1/1
local_activate 1/2
assert_stacking 1/2 1/1

View File

@ -136,6 +136,31 @@ process_line (const char *line)
}
}
else if (strcmp (argv[0], "set_parent") == 0)
{
if (argc != 3)
{
g_print ("usage: menu <window-id> <parent-id>");
goto out;
}
GtkWidget *window = lookup_window (argv[1]);
if (!window)
{
g_print ("unknown window %s", argv[1]);
goto out;
}
GtkWidget *parent_window = lookup_window (argv[2]);
if (!parent_window)
{
g_print ("unknown parent window %s", argv[2]);
goto out;
}
gtk_window_set_transient_for (GTK_WINDOW (window),
GTK_WINDOW (parent_window));
}
else if (strcmp (argv[0], "show") == 0)
{
if (argc != 2)

View File

@ -767,6 +767,23 @@ test_case_do (TestCase *test,
NULL))
return FALSE;
}
else if (strcmp (argv[0], "set_parent") == 0)
{
if (argc != 3)
BAD_COMMAND("usage: %s <client-id>/<window-id> <parent-window-id>",
argv[0]);
TestClient *client;
const char *window_id;
if (!test_case_parse_window_id (test, argv[1], &client, &window_id, error))
return FALSE;
if (!test_client_do (client, error,
"set_parent", window_id,
argv[2],
NULL))
return FALSE;
}
else if (strcmp (argv[0], "show") == 0 ||
strcmp (argv[0], "hide") == 0 ||
strcmp (argv[0], "activate") == 0 ||