1
0
Fork 0

tests/stacking: Add pointer rest and auto raise tests

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
This commit is contained in:
Sebastian Wick 2023-09-12 19:36:52 +02:00 committed by Marge Bot
parent ac33792db4
commit ad7ce7c7ca
5 changed files with 124 additions and 1 deletions

View file

@ -92,7 +92,7 @@ static GDesktopTitlebarAction action_right_click_titlebar = G_DESKTOP_TITLEBAR_A
static gboolean dynamic_workspaces = FALSE;
static gboolean disable_workarounds = FALSE;
static gboolean auto_raise = FALSE;
static gboolean auto_raise_delay = 500;
static int auto_raise_delay = 500;
static gboolean focus_change_on_pointer_rest = FALSE;
static gboolean bell_is_visible = FALSE;
static gboolean bell_is_audible = TRUE;

View file

@ -709,6 +709,8 @@ stacking_tests = [
'suspend-state-timeout',
'cloned-windows',
'sloppy-focus',
'sloppy-focus-pointer-rest',
'sloppy-focus-auto-raise',
]
foreach stacking_test: stacking_tests

View file

@ -0,0 +1,48 @@
resize_monitor default 800 600
set_pref focus-mode sloppy
set_pref focus-change-on-pointer-rest false
set_pref auto-raise true
set_pref auto-raise-delay 25
move_cursor_to 150 50
wait
new_client w wayland
create w/0 csd
resize w/0 100 100
show w/0
create w/1 csd
resize w/1 100 100
show w/1
wait_reconfigure
move w/0 0 0
move w/1 100 0
wait_reconfigure
assert_stacking w/0 w/1
assert_focused w/1
assert_position w/0 0 0
assert_size w/0 100 100
assert_position w/1 100 0
assert_size w/1 100 100
move_cursor_to 150 50
assert_stacking w/0 w/1
assert_focused w/1
move_cursor_to 50 50
assert_stacking w/0 w/1
assert_focused w/0
sleep 50
assert_stacking w/1 w/0
assert_focused w/0

View file

@ -0,0 +1,59 @@
resize_monitor default 800 600
set_pref focus-mode sloppy
set_pref focus-change-on-pointer-rest true
move_cursor_to 150 50
wait
new_client w wayland
create w/0 csd
resize w/0 100 100
show w/0
create w/1 csd
resize w/1 100 100
show w/1
create w/2 csd
resize w/2 100 100
show w/2
wait_reconfigure
move w/0 0 0
move w/1 100 0
move w/2 200 0
wait_reconfigure
assert_stacking w/0 w/1 w/2
assert_focused w/2
assert_position w/0 0 0
assert_size w/0 100 100
assert_position w/1 100 0
assert_size w/1 100 100
assert_position w/2 200 0
assert_size w/2 100 100
move_cursor_to 50 50
sleep 50
assert_stacking w/0 w/1 w/2
assert_focused w/0
move_cursor_to 150 50
assert_stacking w/0 w/1 w/2
assert_focused w/0
move_cursor_to 250 50
assert_stacking w/0 w/1 w/2
assert_focused w/0
sleep 50
assert_stacking w/0 w/1 w/2
assert_focused w/2

View file

@ -1332,6 +1332,20 @@ test_case_do (TestCase *test,
g_assert_true (g_settings_set_boolean (mutter, "focus-change-on-pointer-rest", value));
}
else if (strcmp (argv[1], "auto-raise") == 0)
{
gboolean value;
if (!str_to_bool (argv[2], &value))
BAD_COMMAND("usage: %s %s [true|false]", argv[0], argv[1]);
g_assert_true (g_settings_set_boolean (wm, "auto-raise", value));
}
else if (strcmp (argv[1], "auto-raise-delay") == 0)
{
int value = atoi (argv[2]);
g_assert_true (g_settings_set_int (wm, "auto-raise-delay", value));
}
else {
BAD_COMMAND("Unknown preference %s", argv[1]);
}