diff --git a/src/tests/README b/src/tests/README index b7d9444ac..fb7d87eec 100644 --- a/src/tests/README +++ b/src/tests/README @@ -80,7 +80,10 @@ wait assert_stacking / / ... Assert that the list of client windows known to Mutter is as given and in - the given order, bottom to top. + the given order, bottom to top. The character '|' can be present in the + list of windows to indicate the guard window that separates hidden and + visible windows. If '|' isn't present, the guard window is asserted to + be below all client windows. This function also queries the X server stack and verifies that Mutter's expectation of the X server stack matches reality. diff --git a/src/tests/stacking/override-redirect.metatest b/src/tests/stacking/override-redirect.metatest index 96dde5b9d..b313d240b 100644 --- a/src/tests/stacking/override-redirect.metatest +++ b/src/tests/stacking/override-redirect.metatest @@ -12,7 +12,7 @@ assert_stacking 1/1 1/2 lower 1/2 wait -assert_stacking 1/2 1/1 +assert_stacking 1/2 | 1/1 raise 1/2 wait diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c index d5f723c3a..6996a87b3 100644 --- a/src/tests/test-runner.c +++ b/src/tests/test-runner.c @@ -610,6 +610,13 @@ test_case_assert_stacking (TestCase *test, else g_string_append_printf (stack_string, "(%s)", window->title); } + else if (windows[i] == display->screen->guard_window) + { + if (stack_string->len > 0) + g_string_append_c (stack_string, ' '); + + g_string_append_c (stack_string, '|'); + } } for (i = 0; i < n_expected_windows; i++) @@ -620,6 +627,16 @@ test_case_assert_stacking (TestCase *test, g_string_append (expected_string, expected_windows[i]); } + /* Don't require '| ' as a prefix if there are no hidden windows - we + * remove the prefix from the actual string instead of adding it to the + * expected string for clarity of the error message + */ + if (index (expected_string->str, '|') == NULL && stack_string->str[0] == '|') + { + g_string_erase (stack_string, + 0, stack_string->str[1] == ' ' ? 2 : 1); + } + if (strcmp (expected_string->str, stack_string->str) != 0) { g_set_error (error, TEST_RUNNER_ERROR, TEST_RUNNER_ERROR_ASSERTION_FAILED,