tests/stacking: Test always-on-top stacking and focus

Adds the command make_above to set and unset always-on-top behavior of a
window and tests stacking and focus when activating other windows and
switching workspaces.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2489>
This commit is contained in:
Sebastian Wick 2022-07-09 12:30:23 +02:00 committed by Marge Bot
parent ed7a9af62a
commit 7ac982d0d2
3 changed files with 75 additions and 0 deletions

View File

@ -442,6 +442,7 @@ stacking_tests = [
'map-on-hotplug',
'workspace-basic',
'workspace-test',
'always-on-top',
]
foreach stacking_test: stacking_tests

View File

@ -0,0 +1,51 @@
num_workspaces 2
new_client 1 wayland
create 1/1
show 1/1
create 1/2
show 1/2
create 1/3
show 1/3
wait
assert_stacking_workspace 0 1/1 1/2 1/3
assert_stacking_workspace 1
assert_focused 1/3
local_activate 1/1
assert_stacking_workspace 0 1/2 1/3 1/1
assert_stacking_workspace 1
assert_focused 1/1
make_above 1/3 true
assert_stacking_workspace 0 1/2 1/1 1/3
assert_stacking_workspace 1
assert_focused 1/1
local_activate 1/2
assert_stacking_workspace 0 1/1 1/2 1/3
assert_stacking_workspace 1
assert_focused 1/2
activate_workspace 1
assert_stacking_workspace 0 1/1 1/2 1/3
assert_stacking_workspace 1
assert_focused none
activate_workspace 0
assert_stacking_workspace 0 1/1 1/2 1/3
assert_stacking_workspace 1
assert_focused 1/2
make_above 1/3 false
local_activate 1/1
assert_stacking_workspace 0 1/2 1/3 1/1
assert_stacking_workspace 1
assert_focused 1/1

View File

@ -1148,6 +1148,29 @@ test_case_do (TestCase *test,
meta_window_change_workspace (window, workspace);
}
else if (strcmp (argv[0], "make_above") == 0)
{
if (argc != 3 ||
(g_ascii_strcasecmp (argv[2], "true") != 0 &&
g_ascii_strcasecmp (argv[2], "false") != 0))
BAD_COMMAND("usage: %s <client-id>/<window-id> [true|false]",
argv[0]);
MetaTestClient *client;
const char *window_id;
if (!test_case_parse_window_id (test, argv[1], &client, &window_id, error))
return FALSE;
MetaWindow *window;
window = meta_test_client_find_window (client, window_id, error);
if (!window)
return FALSE;
if (g_ascii_strcasecmp (argv[2], "true") == 0)
meta_window_make_above (window);
else
meta_window_unmake_above (window);
}
else
{
BAD_COMMAND("Unknown command %s", argv[0]);