From d830d985c19de9dfd970c010b0c1594f125791ac Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Fri, 26 Jun 2020 21:31:10 +0200 Subject: [PATCH 1/2] tests/stacking: Don't test for time-dependent intermediate focus state While c3d13203 ensured that the test-client has actually closed the window before testing for the focus change, it also made another timing related issue with the tests more likely to happen. Serveral tests assert that the focus is set to 'none' after the focussed window has been closed when the window below does not accept focus. This however can never be reliably tested, because closing the window triggers timeout based iteration of a queue of default focus candidate windows. This starts after the window has been closed and might finish before the clients have finished synchronizing. This issue is more likely to trigger the shorter the queue is and the more test clients there are that could delay the synchronization. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1329 --- ...ient-no-input-parent-delayed-focus-default-cancelled.metatest | 1 - src/tests/stacking/closed-transient-no-input-parent.metatest | 1 - ...ient-no-input-parents-queued-default-focus-destroyed.metatest | 1 - src/tests/stacking/closed-transient-no-input-parents.metatest | 1 - 4 files changed, 4 deletions(-) diff --git a/src/tests/stacking/closed-transient-no-input-parent-delayed-focus-default-cancelled.metatest b/src/tests/stacking/closed-transient-no-input-parent-delayed-focus-default-cancelled.metatest index 75a17e4e53c..90a65e6597c 100644 --- a/src/tests/stacking/closed-transient-no-input-parent-delayed-focus-default-cancelled.metatest +++ b/src/tests/stacking/closed-transient-no-input-parent-delayed-focus-default-cancelled.metatest @@ -22,7 +22,6 @@ assert_stacking 2/1 1/1 1/2 1/3 destroy 1/3 wait -assert_focused none assert_stacking 2/1 1/1 1/2 activate 2/1 diff --git a/src/tests/stacking/closed-transient-no-input-parent.metatest b/src/tests/stacking/closed-transient-no-input-parent.metatest index 1fe00d7bfc3..5c2be11fba5 100644 --- a/src/tests/stacking/closed-transient-no-input-parent.metatest +++ b/src/tests/stacking/closed-transient-no-input-parent.metatest @@ -22,7 +22,6 @@ assert_stacking 2/1 1/1 1/2 1/3 destroy 1/3 wait -assert_focused none assert_stacking 2/1 1/1 1/2 sleep 150 diff --git a/src/tests/stacking/closed-transient-no-input-parents-queued-default-focus-destroyed.metatest b/src/tests/stacking/closed-transient-no-input-parents-queued-default-focus-destroyed.metatest index 2131771330f..e361fbdf6ad 100644 --- a/src/tests/stacking/closed-transient-no-input-parents-queued-default-focus-destroyed.metatest +++ b/src/tests/stacking/closed-transient-no-input-parents-queued-default-focus-destroyed.metatest @@ -32,7 +32,6 @@ assert_stacking 0/1 1/1 1/2 1/3 1/4 1/5 destroy 1/5 wait -assert_focused none assert_stacking 0/1 1/1 1/2 1/3 1/4 destroy 1/2 diff --git a/src/tests/stacking/closed-transient-no-input-parents.metatest b/src/tests/stacking/closed-transient-no-input-parents.metatest index dcba70eba58..365f6f444d6 100644 --- a/src/tests/stacking/closed-transient-no-input-parents.metatest +++ b/src/tests/stacking/closed-transient-no-input-parents.metatest @@ -32,7 +32,6 @@ assert_stacking 0/1 1/1 1/2 1/3 1/4 1/5 destroy 1/5 wait -assert_focused none assert_stacking 0/1 1/1 1/2 1/3 1/4 sleep 600 -- GitLab From d85c3c1e940a6f42a4f38cf3ad9f8768a90485df Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Fri, 26 Jun 2020 21:32:39 +0200 Subject: [PATCH 2/2] 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 92d110375ee..77ab3b5d6d5 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 00000000000..a2db12d5bac --- /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 -- GitLab