mutter/src/tests
Marco Trevisan (Treviño) 7c1f3498fe window-props: Don't set override redirect windows as top-level parent
Java applications might use override-redirect windows as parent windows for
top-level windows, although this is not following the standard [1].

In such case, the first non-override-redirect child window that is created
was marked as being on_all_workspaces since the call to
should_be_on_all_workspaces() returns TRUE for its parent, and this even
though the on_all_workspaces_requested bit is unset.
When a further child of this window was added, it was set as not having a
workspace and not being on_all_workspaces, since the call to
should_be_on_all_workspaces() for its parent would return FALSE (unless if
it is in a different monitor, and the multiple-monitors workspaces are
disabled).

Since per commit 09bab98b we don't recompute the workspace if the
on_all_workspaces bit is unset, we could end up in a case where a window can
be nor in all the workspaces or in a specific workspace.

So let's just ignore the transient_for bit for a window if that points to an
override-redirect, using the x11 root window instead.

Add a stacking test to verify this scenario (was failing before of this
commit).

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/885
https://gitlab.gnome.org/GNOME/mutter/merge_requests/895

[1] https://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472512128


(cherry picked from commit bacbbbd628)
2019-11-07 16:21:37 +00:00
..
clutter clutter/actor: Don't emit property changes after ::destroy 2019-10-02 17:59:22 +00:00
migration monitor-tests: Test config migration with refresh rate wiggle room 2017-10-04 09:45:52 -04:00
monitor-configs tests: Add missing monitors config XML file 2018-07-04 10:07:30 +00:00
stacking window-props: Don't set override redirect windows as top-level parent 2019-11-07 16:21:37 +00:00
boxes-tests.c Use free_full on GSList's instead of foreach + free 2019-05-15 14:49:56 -05:00
boxes-tests.h tests: Make testboxes an actual test 2018-11-06 17:17:36 +01:00
clutter-test-utils.c tests: Move clutter-test-utils.[ch] to src/tests 2019-08-24 08:59:08 +00:00
clutter-test-utils.h main: Add test initialization function 2019-08-27 16:34:01 +00:00
headless-start-test.c backend: Move GPU ownership from the monitor manager to the backend 2019-06-20 13:31:55 +00:00
meson.build window-props: Don't set override redirect windows as top-level parent 2019-11-07 16:21:37 +00:00
meta-backend-test.c backend: Move GPU ownership from the monitor manager to the backend 2019-06-20 13:31:55 +00:00
meta-backend-test.h backend: Move GPU ownership from the monitor manager to the backend 2019-06-20 13:31:55 +00:00
meta-gpu-test.c backend: Move GPU ownership from the monitor manager to the backend 2019-06-20 13:31:55 +00:00
meta-gpu-test.h backend: Move GPU ownership from the monitor manager to the backend 2019-06-20 13:31:55 +00:00
meta-monitor-manager-test.c backend: Move GPU ownership from the monitor manager to the backend 2019-06-20 13:31:55 +00:00
meta-monitor-manager-test.h backend: Move GPU ownership from the monitor manager to the backend 2019-06-20 13:31:55 +00:00
monitor-config-migration-unit-tests.c monitor-tests: Test config migration with refresh rate wiggle room 2017-10-04 09:45:52 -04:00
monitor-config-migration-unit-tests.h tests: Add monitor config migration tests 2017-08-21 12:23:51 +08:00
monitor-store-unit-tests.c Remove old monitor configuration system 2017-08-21 12:20:53 +08:00
monitor-store-unit-tests.h tests: Add MetaMonitorConfigStore tests 2017-01-25 16:28:56 +08:00
monitor-test-utils.c tests: Add monitor config migration tests 2017-08-21 12:23:51 +08:00
monitor-test-utils.h tests: Add monitor config migration tests 2017-08-21 12:23:51 +08:00
monitor-unit-tests.c tests/monitor-unit-tests: Add another tiling window hot plug test 2019-11-05 08:56:26 -03:00
monitor-unit-tests.h tests/monitor-unit-tests: Run a client while testing 2017-08-30 13:44:05 +08:00
mutter-all.test.in Add Meson support for installed tests 2018-12-20 13:52:35 -02:00
README docs: Update tests instructions 2019-06-05 14:49:35 -03:00
test-client.c tests: Add "accept_take_focus" command 2019-07-08 11:21:17 +02:00
test-runner.c tests/runner: Move window shown synchronization to helper 2019-11-05 08:56:22 -03:00
test-utils.c tests/runner: Move window shown synchronization to helper 2019-11-05 08:56:22 -03:00
test-utils.h tests/runner: Move window shown synchronization to helper 2019-11-05 08:56:22 -03:00
unit-tests.c boxes: Fix spelling in API 2019-03-17 14:12:40 +00:00

This directory implements a framework for automated tests of Mutter. The basic
idea is that mutter-test-runner acts as the window manager and compositor, and
forks off instances of mutter-test-client to act as clients.

There's a simple scripting language for tests. A very small test would look like:

---
# Start up a new X11 client with the client id 1 (doesn't have to be an integer)
# Windows for this client will be referred to as 1/<window-id>
new_client 1 x11

# Create and show two windows - again the IDs don't have to be integers
create 1/1
show 1/1
create 1/2
show 1/2

# Wait for the commands we've executed in the clients to reach Mutter
wait

# Check that the windows are in the order we expect
assert_stacking 1/1 1/2
---

Running
=======

The tests are installed according to:

https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests

if -Dtests=true is passed to `meson configure`. You can run them uninstalled with:

 ninja test

Command reference
=================

The following commands are supported. Quoting and comments follow shell rules.

new_client <client-id> [wayland|x11]
 Starts a client, connecting by either Wayland or X11. The client
 will subsequently be known with the given client-id (an arbitrary
 string)

quit_client <client-id>
 Destroys all windows for the client, waits for that to be processed,
 then instructs the client to exit.

create <client-id>/<window-id> [override|csd]
 Creates a new window. For the X11 backend, the keyword 'override'
 can be given to create an override-redirect and the keyword 'csd'
 can be given to create a client-side decorated window.

show <client-id>/<window-id>
hide <client-id>/<window-id>
 Ask the client to show (map) or hide (unmap) the given window

activate <client-id>/<window-id>
 Ask the client to raise and focus the given window. This is currently a no-op
 for Wayland, where this capability is not supported in the protocol.

local_activate <client-id>-<window-id>
  The same as 'activate', but the operation is done directly inside Mutter
  and works for both backends

raise <client-id>/<window-id>
lower <client-id>/<window-id>
  Ask the client to raise or lower the given window ID. This is a no-op
  for Wayland clients. (It's also considered discouraged, but supported, for
  non-override-redirect X11 clients.)

minimize <client-id>/<window-id>
unminimize <client-id>/<window-id>
  Ask the client to minimize or unminimize the given window ID. This older
  term for this operation is "iconify".

destroy <client-id>/<window-id>
  Destroy the given window

wait
  Wait until all requests sent by Mutter to clients have been received by Mutter,
  and then wait until all requests by Mutter have been processed by the X server.

assert_stacking <client-id>/<window-id> <client-id>/<window-id> ...
  Assert that the list of client windows known to Mutter is as given and in
  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.