From d85c3c1e940a6f42a4f38cf3ad9f8768a90485df Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Fri, 26 Jun 2020 21:32:39 +0200 Subject: [PATCH] tests/stacking: Add test for when no default focus window can be found The previous commit removed checks for intermediate focus states which would make tests randomly fail, because of their time dependence. What can be tested however is that if there is no other window available that would accept the focus, that the focus remains at 'none', after the focused window has been closed. This newly introduced test checks the focus directly after closing the window (and syncing) and after the time it would have taken for the queue to finish. The first check has a similar timing issue as the removed focus checks in the other tests, but the test will never accidentally fail, because regardless of whether the queue has finished or not, the focus is always expected to be 'none'. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1329 --- src/tests/meson.build | 1 + ...closed-transient-no-default-focus.metatest | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/tests/stacking/closed-transient-no-default-focus.metatest diff --git a/src/tests/meson.build b/src/tests/meson.build index 92d110375..77ab3b5d6 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -149,6 +149,7 @@ stacking_tests = [ 'basic-wayland', 'client-side-decorated', 'closed-transient', + 'closed-transient-no-default-focus', 'closed-transient-no-input-no-take-focus-parent', 'closed-transient-no-input-no-take-focus-parents', 'closed-transient-no-input-parent', diff --git a/src/tests/stacking/closed-transient-no-default-focus.metatest b/src/tests/stacking/closed-transient-no-default-focus.metatest new file mode 100644 index 000000000..a2db12d5b --- /dev/null +++ b/src/tests/stacking/closed-transient-no-default-focus.metatest @@ -0,0 +1,29 @@ +new_client 1 x11 +create 1/1 +accept_focus 1/1 false +show 1/1 + +create 1/2 csd +set_parent 1/2 1 +accept_focus 1/2 false +show 1/2 + +create 1/3 csd +set_parent 1/3 2 +show 1/3 + +wait +assert_focused 1/3 +assert_stacking 1/1 1/2 1/3 + +destroy 1/3 +wait + +assert_focused none +assert_stacking 1/1 1/2 + +sleep 150 +wait + +assert_focused none +assert_stacking 1/1 1/2