1
0
Fork 0
Commit graph

993 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
f71151a5dd window-x11: Focus the default window with delay while waiting for take-focus
When requesting to a take-focus window to acquire the input, the client may or
may not respond with a SetInputFocus (this doesn't happen for no-input gtk
windows in fact [to be fixed there too]), in such case we were unsetting the
focus while waiting the reply.

In case the client won't respond, we wait for a small delay (set to 250 ms) for
the take-focus window to grab the input focus before setting it to the default
window.

Added a test for this behavior and for the case in which a window takes the
focus meanwhile we're waiting to focus the default window.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
6022b23923 test-runner: Add 'dispatch' command
This will only wait for events to be dispatched and processed by the server
without waiting for client processing.

Reuse the code for the wait command too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
d08763c18c test-runner: Add 'sleep' command
This allows to sleep for a given timeout in milliseconds.

Rename test_case_before_redraw to test_case_loop_quit since it's a generic
function and use it for the timeout too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
fcb408ad5d tests: Verify focused window in closed-transient tests
Ensure that we have a focused window when closing transient windows with
no-focus or no-take-focus atoms

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
51f9e04ef1 test-runner: Add 'assert_focused' command
This allows to verify which window should have the focus, which might not
be the same as the top of the stack.

It's possible to assert the case where there's no focused window using
"NONE" as parameter.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
2fc7760cee tests, stacking: Add tests with no-input and no-take-focus windows
When a window with no frame, that doesn't accept focus and that has no
take-focus atom set is destroyed, we ended up in not changing the current_focus
window, causing a crash.

Added test cases that verify this situation.

Related to https://gitlab.gnome.org/GNOME/mutter/issues/308
https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
f2d2d473b7 tests: Add 'can_take_focus' command to runner and client
Allow to set/unset WM_TAKE_FOCUS from client window.
This is added by default by gtk, but this might not happen in other toolkits,
so add an ability to (un)set this.

So fetch the protocols with XGetWMProtocols and unset the atom.

test-client now needs to depend on Xlib directly in meson build.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
e1f839f48f tests: Add 'accept_focus' command to runner and client
Under the hood, calls gtk_window_set_accept_focus in the client

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Jonas Ådahl
5c500ad402 backend: Move GPU ownership from the monitor manager to the backend
Lets work towards making MetaMonitorManager about managing monitors, and
not about managing GPUs. This changes other units to keep a pointer to
the backend instead of a monitor manager, in case their ownership
changed, or their main usage of the monitor manager was to look up GPUs.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Hans de Goede
446e82e86d test-utils: Fix compiler warning
This fixes the following compiler warning:

In file included from /usr/include/glib-2.0/glib.h:114,
                 from ../src/tests/test-utils.h:23,
                 from ../src/tests/test-utils.c:22:
../src/tests/test-utils.c: In function ‘test_init’:
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: warning: ‘basename’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   28 |   g_free (*pp);
      |   ^~~~~~~~~~~~
../src/tests/test-utils.c:73:24: note: ‘basename’ was declared here
   73 |       g_autofree char *basename;
      |                        ^~~~~~~~

https://gitlab.gnome.org/GNOME/mutter/merge_requests/627
2019-06-19 13:00:17 +02:00
Douglas R. Reno
a38bae259e
docs: Update tests instructions
The documentation still refers to autotools, update it to
use the corresponding meson commands.

https://gitlab.gnome.org/GNOME/mutter/issues/568
2019-06-05 14:49:35 -03:00
Marco Trevisan (Treviño)
f869e4d54b headless-start-test: Ignore frame counter warnings
When running in slow or busy machines (hey CI!) or under valgrind headless
tests could fail because of a non fatal warning during initialization.

So define a fatal handler that ignores the frame counter warning.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:26:30 -05:00
Marco Trevisan (Treviño)
c1059df7f9 test-runner: Always wait after creating a window
Creating a window could take some time, causing false-positive failures when
running in slower or busy hardware like:

  window 1/2 isn't known to Mutter

So before we proceed in doing any operation on it, wait for the client.
Do this in the test runner instead of repeating the same in every .metatest.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:23:55 -05:00
Marco Trevisan (Treviño)
7a17e236f7 Use free_full on GSList's instead of foreach + free
GList's used in legacy code were free'd using a g_slist_foreach + g_slist_free,
while we can just use g_slist_free_full as per GLib 2.28.

So replace code where we were using this legacy codepath.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/576
2019-05-15 14:49:56 -05:00
Marco Trevisan (Treviño)
63c40a9711 meson: Define srcdir and builddir using meson functions
No need to redefine paths starting from top src/build dirs, as meson can give us
this information for free using its functions.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
Marco Trevisan (Treviño)
a934fa07b8 tests: Use suites for test cases
They allows to filter tests better and so we can just launch tests with:
  meson test --suite [core|cogl|clutter] [single-test-name]

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
Marco Trevisan (Treviño)
c6d1cf4af4 tests: Add single stacking tests with suite
Don't launch the stacking tests in one single shot, to allow better debugging
and being able to launch just one single test using meson test.

Those tests can now be all launched with:
  meson test --suite stacking [single-test-name]

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
Marco Trevisan (Treviño)
8dbe4210b4 tests: Add missing stacking tests
List all .metatest files that were added only to autotools while they are
missing since the meson port.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
Jonas Ådahl
5d1eccfb6f boxes: Fix spelling in API
Change adjecent to adjacent.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
Marco Trevisan (Treviño)
9b8510ac56 monitor: Fix indentation style on calculate_supported_scales and friends
https://gitlab.gnome.org/GNOME/mutter/merge_requests/488
2019-03-12 00:15:42 +00:00
Pekka Paalanen
1c67260bd4 monitor-unit-tests: initial crtcs in custom_lid_switch
This test forgot to specify the existing CRTC routings in the setup. For the
first output the default 0 was ok, now it is -1 to ensure that the code will
assign it correctly. For the second output the default 0 was incorrect, because
possible_crtcs does not include 0.  Now that CRTC is initialized to off
instead, because the second output is hotplugged later and running a CRTC
without an output does not make sense.

This fix will keep this test passing when a future patch attempts to preserve
existing CRTC routings. Assuming that any existing routing is valid, such
routing will be kept. In this test case the existing routing was illegal, it
should have been impossible, which then causes that future patch to fail the
test by assigning the wrong CRTC.

https://gitlab.gnome.org/GNOME/mutter/issues/373
2019-02-21 17:22:12 +02:00
Georges Basile Stavracas Neto
9bd427a74c
meta/tests: Remove commented lines
Leftovers from the initial landing of Meson files.
2018-12-20 13:52:35 -02:00
Georges Basile Stavracas Neto
ebb6c56f67
Add Meson support for installed tests
This is the last remaining feature necessary to achieve
parity with the Autotools build.

A few changes were made to the install locations of the
tests, in order to better acomodate them in Meson:

 * Tests are now installed under a versioned folder (e.g.
   /usr/share/installed-tests/mutter-4)

 * The mutter-cogl.test file is now generated from an .in
   file, instead of a series of $(echo)s from within Makefile.

Notice that those tests need very controlled environments
to run correctly. Mutter installed tests, for example, will
failed when running under a regular session due to D-Bus
failing to acquire the ScreenCast and/or RemoteScreen names.
2018-12-20 13:52:35 -02:00
Emilio Pozuelo Monfort
5e005316ef output: Turn winsys_id into a uint64_t
We need a 64 bit field to combine the device id and connector
id into the output id (winsys_id).
2018-11-19 14:58:48 +00:00
Jonas Ådahl
563c5b0612 monitor-unit-tests: Try resizing clients while headless
Prior to 6dcce19932 this test would crash.

https://bugzilla.gnome.org/show_bug.cgi?id=790207
2018-11-14 16:04:10 +01:00
Jonas Ådahl
c8a4e37e0c tests/test-client: Add "resize" command
The "resize" command resizes a window.

https://bugzilla.gnome.org/show_bug.cgi?id=790207
2018-11-14 16:04:10 +01:00
Jonas Ådahl
1266c20d4c monitor-unit-tests: Also run a X11 client while testing
We already ran a Wayland client to test various Wayland paths. What was
missing to also run a X11 client was to hook in the X11 async waiter
wires, so do that and run both types of clients.

https://bugzilla.gnome.org/show_bug.cgi?id=790207
2018-11-14 16:04:10 +01:00
Jonas Ådahl
76760bfd79 tests: Make all alarm filters use the same type
That'll make them more interchangable, would so ever be needed.

https://bugzilla.gnome.org/show_bug.cgi?id=790207
2018-11-14 16:04:10 +01:00
Jonas Ådahl
bd624e4dfb tests: Override X11 display number
As with the Wayland display name, to avoid clashes with already an
running Xwayland or Xorg instance, override the X11 display name to
something less likely to cause a clash.

https://gitlab.gnome.org/GNOME/mutter/issues/193
2018-11-14 15:55:45 +01:00
Jonas Ådahl
fe1d9fb4a7 tests: Override Wayland display name in test_init()
It's overridden by all test cases, but they all also call test_init() so
do it there instead.

https://gitlab.gnome.org/GNOME/mutter/issues/193
2018-11-14 15:55:45 +01:00
Georges Basile Stavracas Neto
d1c4c46281
build: Prefer dependencies instead of link_with
Meson uses the 'dependencies' field to determine and
parallelize build steps, but that isn't entirely true
with 'link_with'; this might cause a race condition
when generating header files while trying to build
them.

Fix that by only using 'dependencies' instead of 'link_with'.
2018-11-06 17:50:24 -02:00
Jonas Ådahl
ef85d1a643 Add meson build support
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.

There are some differences between the autotools setup and the new
meson. Here are a few:

The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.

The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.

Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
2018-11-06 18:51:44 +01:00
Jonas Ådahl
32f3bb02e1 tests: Move out test client path init into helper function
Makes the common test init function simpler to read.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
d21022f562 tests/headless-start-test: Use common test init function
Outsource the initialization of GTest to the same function used by the
other tests.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
2af229fe98 tests: Call g_test_init() in test-runner too
This makes the log handler that breaks test redundant, as GTest already
does this.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
c663f4ae84 tests: Add env var to override plugin used for tests
This is so that the test suite can point at the non-installed version.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
0afaf5262b plugin: Rename the .so file from plugin.so to libplugin.so
This is the filename convention you get when you define a shared module
in meson, and since there is no particular reason to not include the
"lib" prefix, lets make it easier to port it over. While at it,
de-duplicate the retrieval of the plugin name.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
2f4a68c8c3 Clean up include macros mess
The order and way include macros were structured was chaotic, with no
real common thread between files. Try to tidy up the mess with some
common scheme, to make things look less messy.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
92f4ffc0dd tests: Make testboxes an actual test
testboxes was a binary that did unit testing, but it wasn't integrated
to the test system, so in effect, it was never run. Instead integrate it
into the other mutter unit tests. This includes changing a few of
meta_warning()s into g_warning()s so that the GTest framework can handle
them.
2018-11-06 17:17:36 +01:00
Florian Müllner
e283cd7b91 tests: Add "closed-transient" test
When a transient window is destroyed, the expected behavior is that
focus is passed to the ancestor if possible. This was broken for
quite a while until the previous commit, so add a test case to make
sure it doesn't happen again.

https://gitlab.gnome.org/GNOME/mutter/issues/15
2018-07-30 17:48:42 +00:00
Olivier Fourdan
7749f4d983 tests: Add the "parent_exported" test
This test aims at checking that the transient relationship set using the
xdg-foreign API is respected by mutter and that no crash occurs, such as
the one in issue !174.

Note: the crash from issue !174 occurs only if "attach_modal_dialogs" is
set, so one has to change that default value to "true" to be able to
trigger the crash:

    gsettings set org.gnome.mutter attach-modal-dialogs true

Related: https://gitlab.gnome.org/GNOME/mutter/issues/174
2018-07-18 14:31:38 +02:00
Olivier Fourdan
22aea3dc67 tests: Fix usage message for "set_parent"
"set_parent" usage message was referring to "menu" which is not a valid
command.
2018-07-18 14:30:51 +02:00
Olivier Fourdan
3d5784342d tests: Add "set_parent_exported" command
Add a "set_parent_exported" command to test the xdg-foreign support, so
that we can add a test which uses the GDK API for exported window:

  `gdk_wayland_window_set_transient_for_exported()`

That will allow to detect if transient is applied correctly between
foreign windows and detect possible crashes such as issue !174.

Related: https://gitlab.gnome.org/GNOME/mutter/issues/174
2018-07-18 14:30:40 +02:00
Bastien Nocera
951219650f backend: Move lid-is-closed handling to MetaBackend
Rather than handle UpClient in both MetaBackend (to reset the idletime
when the lid is opened), and in MetaMonitorManager and
MetaMonitorConfigManager (to turn the screen under the lid on/off
depending on its status), move the ability to get the lid status from
UPower or mock it in one place, in MetaBackend.
2018-07-18 10:17:36 +00:00
Jonas Ådahl
6d12d2eac2 tests: Move window-shown verification to test-runner
Previously we relied on the test-client to make sure that a window was
shown. For X11, we did not need to do anything, but for Wayland we had
to make sure we had drawn the first frame, otherwise mutter wouldn't
have a buffer making the window not showable.

Doing it this way doesn't work anymore however, since the 'after-paint'
event will be emitted even if we didn't actually paint anything. This is
the case with current Gtk under Wayland, where we won't draw until the
compositor has configured the surface. In effect, this mean we'll get a
dummy after-paint emission before the first frame is actually painted.

Instead, move the verification that a "show" command has completed by
having the test-runner wait for a "shown" signal on the window, which is
emitted in the end of meta_window_show(). This requires an additional
call to gdk_display_sync() in the test-client after creating the window,
to make sure that the window creation vents has been received in the
compositor.
2018-07-17 16:30:18 +02:00
Armin Krezović
d79ffd3976 Move UI and key grabs to MetaX11Display
https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
e1c67a1824 Move monitor management API to MetaDisplay
This includes changing various users to use MetaDisplay directly, who
used MetaScreen only for this before.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
98d912ba5f Move stack tracking and guard_window outside of MetaScreen
Move stack, stack_tracker to MetaDisplay guard_window to MetaX11Display

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
722c975aca Move alarm and xids management to MetaX11Display
https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
18779109de Start populating MetaX11Display
- Moved xdisplay, name and various atoms from MetaDisplay
- Moved xroot, screen_name, default_depth and default_xvisual
  from MetaScreen

- Moved some X11 specific functions from screen.c and display.c
  to meta-x11-display.c

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Jonas Ådahl
6621a9b5a0 tests: Add missing monitors config XML file
Lid switch test, but lid-switch.xml was not added, making it fail due to
theh file not being found.
2018-07-04 10:07:30 +00:00
Jonas Ådahl
1200182d70 backends: Move MetaOutput::crtc field into private struct
No functional changes. This is only done so that changes to reference
counting can done more reliably.

https://bugzilla.gnome.org/show_bug.cgi?id=786929
2018-06-28 13:42:15 +02:00
Hans de Goede
5eacdf7af7 monitor-unit-tests: Add non upright panel test
https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08:00
Hans de Goede
ca638d1354 monitor-unit-tests: Add support for panel-orientation
https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08:00
Jonas Ådahl
fc713ecb70 monitor-unit-tests: Check config loading on lid switches
Check that we apply the correct stored configuration when the lid is
opend and closed while an external monitor is connected.

https://bugzilla.gnome.org/show_bug.cgi?id=788915
2017-11-30 11:48:44 +08:00
Jonas Ådahl
500c13ab6f monitor-unit-tests: Always reset CRTC transform ability
Changing the test monitor managers ability to rotate CRTCs in one test
affected the next test. Avoid leaking such state by resetting it before
each test. To continue passing, some tests needed to be updated
regarding to still pass.

https://bugzilla.gnome.org/show_bug.cgi?id=788915
2017-11-30 11:48:44 +08:00
Jonas Ådahl
050267fe74 monitor-unit-tests: Add test for lid toggle after hot unplug
https://bugzilla.gnome.org/show_bug.cgi?id=788915
2017-11-30 11:48:44 +08:00
Jonas Ådahl
ce25a0171c monitor-unit-tests: Add test for lid closed after hot plug
Add a test case that checks that we don't try to revert to a
laptop-panel-only configuration after closing the lid after an external
monitor is connected.

https://bugzilla.gnome.org/show_bug.cgi?id=788915
2017-11-30 11:48:44 +08:00
Jonas Ådahl
12381d57d1 monitor-unit-tests: Check non-first preferred modes
Check that if there are multiple modes with the same ID (resolution,
refresh rate and handled flags) we correctly add the preferred mode to
the list of monitor modes.

https://bugzilla.gnome.org/show_bug.cgi?id=789153
2017-10-19 10:17:14 +08:00
Jonas Ådahl
76096a725b monitor-unit-tests: Check going headless -> headless
https://bugzilla.gnome.org/show_bug.cgi?id=788607
2017-10-07 00:36:03 -04:00
Jonas Ådahl
c1683073f1 backends: Split out CRTC/output management to MetaGpu
In order to eventually support multilpe GPUs with their own connectors,
split out related meta data management (i.e. outputs, CRTCs and CRTC
modes) into a new MetaGpu GObject.

The Xrandr backend always assumes there is always only a single "GPU" as
the GPU is abstracted by the X server; only the native backend (aside
from the test backend) will eventually see more than one GPU.

The Xrandr backend still moves some management to MetaGpuXrandr, in
order to behave more similarly to the KMS counterparts.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:05:20 -04:00
Jonas Ådahl
315a6f43d7 monitor-manager: Keep pointer to backend
Instead of accessing the global singleton, keep a pointer to the
backend in the MetaMonitorManager struct.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
16a6aef5a7 backends/native: Move KMS fd management to monitor manager
Move finding, opening and managment of the KMS file descriptor to
MetaMonitorManagerKms. This means that the monitor manager creation can
now fail, both if more than one GPU with connectors is discovered, or
if finding or opening the primary GPU fails.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
cfee58798e backends/crtc: Keep a pointer to the monitor manager
Instead of passing it around or fetching the singleton, keep a pointer
to the monitor manager that owns the CRTC. This will eventually be
replaced with a per GPU/graphics card object.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
e0d839aea2 backends/output: Keep a pointer to the monitor manager
Instead of passing it around or fetching the singleton, keep a pointer
to the monitor manager that owns the output. This will eventually be
replaced with a per GPU/graphics card object.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
2db5505216 monitor-manager: Turn MetaCrtcMode into a GObject
Convert MetaCrtcMode from a plain struct to a GObject. This changes the
storage format, and also the API, as the API was dependent on the
storage format.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
f64fab1d2d monitor-manager: Make MetaCrtc a GObject
Turn MetaCrtc into a GObject and move it to a separate file. This
changes the storage format, resulting in changing the API for accessing
MetaCrtcs from using an array, to using a GList.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
9817a6aa47 Make MetaOutput a GObject
Turn MetaOutput into a GObject and move it to a separate file. This
changes the storage format, resulting in changing the API for accessing
MetaOutputs from using an array, to using a GList.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
120db06c60 monitor-tests: Test config migration with refresh rate wiggle room
Check that we finish configurations within range, and discard the ones
out of range.

https://bugzilla.gnome.org/show_bug.cgi?id=787668
2017-10-04 09:45:52 -04:00
Jonas Ådahl
e76ab05d45 monitor-tests: Fix error message grammar mistake 2017-10-04 09:45:02 -04:00
Jonas Ådahl
99e1cd549d monitor-unit-tests: Test configs with explicitly disabled monitors
Check that configurations where monitors are disabled are properly
used. Also test that old configurations with explicitly disabled
outputs are migrated properly.

https://bugzilla.gnome.org/show_bug.cgi?id=787629
2017-10-02 15:34:41 -04:00
Jonas Ådahl
efdbeb7c1b monitor-unit-tests: Add way for test case setup to specify output serial
This is needed to avoid migration tests to avoid the best-effort tiling
monitor detection paths.

https://bugzilla.gnome.org/show_bug.cgi?id=787629
2017-10-02 15:34:41 -04:00
Jonas Ådahl
22cdc8f414 monitor-manager: Pass config to derive from when updating state
When we update state, we might not have set the current config yet (for
example if the Xrandr assignment didn't change), so pass the monitors
config we should derive from instead of fetching it from the monitor
config manager.

https://bugzilla.gnome.org/show_bug.cgi?id=787477
2017-09-20 17:26:32 +08:00
Jonas Ådahl
e2d904c32b tests/monitor-unit-tests: Run a client while testing
Run a client while testing and check that it's alive when checking each
monitor configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:44:05 +08:00
Jonas Ådahl
fa9c09feee tests/monitor-unit-tests: Sleep some after each hot plug
Give clients (such as Xwayland) a chance to bind the wl_output global
before we continue, otherwise there is an significant risk that mutter
won't see the bind request until after the next hot plug which might
have destroyed the global object.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:44:05 +08:00
Jonas Ådahl
3f6a2d02fd tests: Add headless start test case
Test that mutter starts properly when there are no monitors connected
yet, and that things work when a monitor is eventually connected.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:44:05 +08:00
Jonas Ådahl
5b37901b57 tests/utils: Add test_client_quit() helper
https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:44:05 +08:00
Jonas Ådahl
522eec00cd monitor: Add foreach output helper and fix foreach crtc helper
The foreach CRTC monitor mode helper incorrectly iterated over outputs
without CRTC when non-tiled modes were set on tiled monitors. This was
not expected by callers, so fix the helper to only iterate over active
outputs (that has or should have a CRTC).

The test cases uses the incorrect behaviour of the foreach CRTC helper
to check that the disabled outputs mode are set to NULL, so add a
foreach output helper and change the tests to use that instead.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
be11c32815 tests: Move out test client helper from test-runner.c
It could be useful for running other types of test clients in other
tests.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
0aa7405a2a monitor-manager: Fall back to minimum screen size of 640 x 480
When headless, we don't have any logical monitors to derive a screen
size from, but we can't set it to empty as that will cause issues with
the clutter stage, UI widget layout and other things. To avoid such
issues, just fall back to a 640 x 480 screen size when headless.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
35c9280fb6 monitor-manager: Try to restore previous config before regenerating
When opening a laptop lid, one will likely want to restore the
configuration one had prior to closing it, so when ensuring monitor
configuration, first try to see if the previously set configuration is
both complete (all connected monitors are configured) and applicable
(it is a valid configuration) and only try to generate a new from
scratch if that failed.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
8b92ad1d4b tests/monitor-unit-tests: Clear config history before each test
To not let different tests interfere with each other, clear the config
history before each run.
2017-08-21 12:23:51 +08:00
Jonas Ådahl
0d6e3fd675 tests/monitor-unit-tests: Use special purpose add test helper
Will later be used to set a setup function.
2017-08-21 12:23:51 +08:00
Jonas Ådahl
6c0f107db0 tests: Add rotated multi head monitor config migration test
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
61950755ec tests: Add monitor config migration tests
So far some basic testing, including:

 * Test that the migrated configuration is applicable
 * Test that a monitors.xml with multiple configurations are translated
 * Test rotation
 * Test tiled monitor discovery (well, test a made up tiled monitor
   configuration since I don't have a real one)

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
bc3162460f Migrate old monitor configuration files to new system
This commit changes the new configuration system to use monitors.xml
instead of monitors-experimental.xml. When starting up and the
monitors.xml file is loaded, if a legacy monitors.xml file is
discovered (it has the version number 1), an attempt is made to migrate
the stored configuration onto the new system.

This is done in two steps:

1) Parsing and translation of the old configuration. This works by
parsing file using the mostly the old parser, but then translating the
resulting configuration structs into the new configuration system. As
the legacy configuration system doesn't carry over some state (such as
tiling and scale used), some things are not available. For tiling, the
migration paths makes an attempt to discover tiled monitors by
comparing EDID data, and guessing what the main tile is. Determination
of the scale of a migrated configuration is postponed until the
configuration is actually applied. This works by flagging the
configuration as 'migrated'.

2) Finishing the migration when applying. When a configuration with the
'migrated' flag is retrieved from the configuration store, the final
step of the migration is taken place. This involves calculating the
preferred scale given the mode configured, while making sure this
doesn't result in any overlapping logical monitor regions etc.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
e8a62861c9 Remove old monitor configuration system
Remove the old MetaMonitorConfig system and mark the new one as
non-experimental. This also removes the D-Bus property.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:20:53 +08:00
Jonas Ådahl
2bdd97e067 monitor-unit-tests: Check tiled monitors with non-origin main output
Test that a tiled monitor with tile (0, 0) as the non-main output,
where main output is defined as the output that is active as long as
the monitor is active.

https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-07-19 17:06:17 +08:00
Jonas Ådahl
4cc5b25493 tests: Add test for setting an interlaced monitor mode
https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
49c5228655 DisplayConfig: Add support for interlaced modes
Differentiate between non-interlaced and interlaced modes. This is done
by appending an "i" after the resolution part of the mode ID, and
adding a 'is-interlaced' (b) property to the mode properties.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
85638c1b19 tests: Check expected monitor mode count
https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
2507e53d04 tests: Test monitor mode refresh rate
Check that the monitor refresh rate corresponds to the CRTC mode
refresh rate.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
a9c1c6d9fb Fix a couple of wrong indentations
https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
e42206cc43 tests: Add non-precise fractional scaling test
https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
b2a530b326 DisplayConfig: Make supported scales per mode
This changes the API to pass supported scales per mode instead of
providing a global list. This allows for more flexible scaling
scenarious, where a scale compatible with one mode can still be made
available even though another mode is incompatible.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
5ab116a87f tests: Add tests for fractional scaling
https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
10b0351a59 Add support for rudimentary fractional scaling
When the logical layout mode is used, allow configuring the scaling to
be non-integer. Supported scales are so far hard coded to include at
most 1, 1.5 and 2, and scales that doesn't result in non-fractional
logical monitor sizes are discarded.

Wayland outputs are set to have scale ceil(actual_scale) meaning well
behaving Wayland clients will provide buffers with buffer scale 2, thus
being scaled down to the fractional scale.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
b64c69e4bc logical-monitor: Make scale a float
To support fractional scaling, the logical monitor scale must be stored
as a float. No other functional changes is part of this commit.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
fb5ebffb8d tests/monitor-unit-tests: Check handling of odd tiled monitors
Add tests for handling tiled monitors where the origin tile output is
not the main output.

https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-05-26 14:32:43 +08:00
Jonas Ådahl
94d843b80e tests/monitor-unit-tests: Check meta_monitor_is_active()
https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-05-26 14:32:43 +08:00
Jonas Ådahl
1bb0e18042 monitor-manager/xrandr: Allow configuring scales on X11 too
This commit makes it possible to configure logical monitor scale also
when running on top of an X11 server using Xrandr. An extra property
'requires-globla-scale' is added to the D-Bus API is added to instruct
a configuration application to only allow setting a global logical
monitor scale.

This is needed to let gsd-xsettings use the configured state to set a
XSettings state that respects the explicit monitor configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
2718699ccc backend: Move settings into a new MetaSettings object
Introduce MetaSettings and add the settings managed by MetaBackend into
the new object. These settings include: experimental-features and UI
scaling factor.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
c391cefd71 tests: Fix indentation
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
52af529950 tests: Test non-native monitor transform
Test that configuration works as expected when the backend doesn't
support handling the transform and an intermediate offscreen
framebuffer is used.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
c30cb069f5 tests: Make it possible to emulate backend not supporting tranforms
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
99a0b43f28 tests: Derive configuration when stage views is disabled
In order to test deriving the logical state from the underlying
configuration, as is always done on X11, make the test backend derive
the state when stage views are disabled.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
1ad3382bff tests: Test rotation of tiled monitors
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
17c54c6e03 tests: Test that transforms are properly configured
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
dd14e1cebc tests: Add monitor transform config parsing tests
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
afcc1bf512 monitor: Don't keep CRTC position in MetaMonitorCrtcMode
The CRTC position depends on the transform and how the transform is
implemented. The function calculating the positions still doesn't
support anything but the non-transformed case; this commit is in
preparation of adding support for transforms.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
744b4dcb7c tests/monitor-unit-tests: Add tests for custom tiled monitor modes
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
0c64c35a8a monitor-manager: Make the config manager an 'experimental feature'
Instead of using a environment variable, add a new 'experimental
feature' gsetting keyword "monitor-config-manager" that enables the use
of the new MetaMonitorConfigManager. This commit also makes it possible
to switch between the two systems without restarting mutter.

The D-Bus API is disabled when the experimental feature is not enabled,
and clients trying to access it will get a access-denied error in
response. A new property 'IsExperimentalApiEnabled' is added to let the
D-Bus client know whether it is possible to use the experimental API or
not.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
8163ca6821 Add support for scaled logical monitor framebuffers
This commit adds support for rendering onto enlarged per logical
monitor framebuffers, using the scaled clutter stage views, for HiDPI
enabled logical monitors.

This works by scaling the mode of the monitors in a logical monitors by
the scale, no longer relying on scaling the window actors and window
geometry for making windows have the correct size on HiDPI monitors.

It is disabled by default, as in automatically created configurations
will still use the old mode. This is partly because Xwayland clients
will not yet work good enough to make it feasible.

To enable, add the 'scale-monitor-framebuffer' keyword to the
org.gnome.mutter.experimental-features gsettings array.

It is still possible to specify the mode via the new D-Bus API, which
has been adapted.

The adaptations to the D-Bus API means the caller need to be aware of
how to position logical monitors on the stage grid. This depends on the
'layout-mode' property that is used (see the DisplayConfig D-Bus
documentation).

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
f25f14351c monitor-manager: Make max screen size optional
Make the concept of maximum screen size optional, as it is not
necessarily a thing on all systems (e.g. when using the native backend
and stage views).

The meta_monitor_monitor_get_limits() function is replaced by a
meta_monitor_manager_get_max_screen_size() which fails when no screen
limit is available. Callers and other users of the previous max screen
size fields are updated to deal with the fact that the limit is
optional.

The new D-Bus API is changed to move it to the properties bag, where
its absence means there is no applicable limit.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
691e7951ea DisplayConfig: Add new API for configuring monitors
Add a new D-Bus API that uses the state from GetCurrentState to
configure high level monitors, instead of low level CRTCs and
connectors. So far persistent configuration is not implemented, as
writing to the configuration store is still not supported.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
0548c9e7d5 MetaMonitorConfig: Rename is_underscanning to enable_underscanning
Use better terminology to imply that the configuration enables
underscanning, not what already "is".

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:47 +08:00
Jonas Ådahl
2035f2f2e2 monitor-config-manager: Verify that logical monitors are adjecent
Logical monitors in a configuration must be adjecent to each other,
meaning there will be at least one pixel long side touching some other
logical monitor.

The exception to this is when there is only one logical monitor, which
cannot be adjecent to any other.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:47 +08:00
Jonas Ådahl
d050fdb17f monitor-manager: Add per backend capabilities
Add a private API for querying backend capabilities. For now, only
mirroring capability is reported.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:47 +08:00
Jonas Ådahl
9e8ee491e6 monitor-manager: Add API to get scales supported by the backend
For the Xrandr backend, only scale 1 is supported, for the others, 1
and 2 are reported as supported.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:47 +08:00
Jonas Ådahl
fcc0288f0c monitor-manager: Let the backends handle no configuration
Let the backends decide whether to just rebuild a derived state, or use
the NULL config to rebuild an empty logical state.

This also changes the expected screen size values of the no-outputs
test; as this case is actually handled now.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:47 +08:00
Jonas Ådahl
4e03e89869 tests: Check that mirroring is configured properly
This test checks that mirroring works when using separate CRTCs. It
does not check cloning.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:47 +08:00
Jonas Ådahl
4e17017501 monitor-unit-tests: Check custom tiled monitor config
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:47 +08:00
Jonas Ådahl
63bc86cd43 tests: Test configured custom logical monitor scale
Check that a configured logical monitor scale overrides any calculated
one.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:47 +08:00
Jonas Ådahl
a393a614a1 monitor-manager: Remove 'scale' from MetaOutput
Replace the 'scale' of an output with a vfunc on the MetaMonitorManager
class that takes a monitor and a monitor mode which calculates the
scale. On X11 this always returns 1, on KMS, the old formula is used.
On the dummy and test backends, the already configured values are
returned.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:46 +08:00
Jonas Ådahl
944339f6a5 monitor-manager: Expose whether the backend handles a transform
Expose via a new API whether the transform on a logical monitor is
handled by the backend. This was previously only exposed only in the
native backend. This will be used to emulate not supporting transforms
in the backend in the nested backend.

https://bugzilla.gnome.org/show_bug.cgi?id=779745
2017-03-09 10:17:30 +08:00
Jonas Ådahl
e20e60783a tests: Make test backend inherit MetaBackendX11Nested
The test backend must inherit the nested backend, as MetaBackendX11 is
not complete.

https://bugzilla.gnome.org/show_bug.cgi?id=779745
2017-03-09 10:17:30 +08:00
Jonas Ådahl
6fa8238ebf monitor-unit-tests: Check monitor <-> logical monitor relationships
Make sure that each logical monitor owns the expected actual monitors.
This currently needs special care when dealing with laptop lid the
configuration, as the MetaMonitorConfigManager path still deosn't
handle restoring the previous configuration, meaning the logical
monitor with the external monitor will continue being primary.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:57 +08:00
Jonas Ådahl
1c6eef48f1 monitor-unit-tests: Move logical monitor checking into separate function
Split the big check function, makes things easier to read.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:57 +08:00
Jonas Ådahl
1fdf2ac746 monitor-unit-tests: Check that each CRTC mode is correct
This is partly redundant given that the current monitor mode is checked
against the CRTC mode, but this also checks the disabled CRTCs. Later
the configured mode position and transform will be checked.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
3ae9feef0c monitor-unit-tests: Check monitor mode CRTC mode positions
Check that the crtc mode has the correct intra-monitor position. In
effect, this tests that the CRTCs in a tiled monitor are configured with
the correct mode on the correct position.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
e9a8208607 tests: Add monitor store and config test for output underscanning
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
0fd9c00580 tests: Add monitor and monitor store test for custom primary
Test that having a custom primary logical monitor is configured as
expected.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
4a51a1dfe5 monitor-unit-tests: Check handling of the primary presentation flags
The main output of the main (first) monitor of a primary logical
monitor should have the MetaOutput::is_primary field set; all other
outputs should have it not set.

All outputs associated with a logical monitor with presentation set
should have MetaOutput::is_presentation set. No other outputs should
have it set.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
9fb8abf840 monitor-store-unit-tests: Check the primary and presentation flags
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
449320cd23 monitor-unit-tests: Check that a stored config is preferred
Check that the stored config (where the logical monitors are placed
vertically) is preferred to the otherwise generated linear config.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
12b69dbabb monitor-unit-tests: Make hotplug_mode_update optional
Add a flag to the test setup creation function enabling the caller to
specify whether a stored config should be used. This is done by
changing the value of the hotplug_mode_update MetaOutput field,
normally used by VMs to do the same.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
4652bde3d7 tests: Move monitor test helpers to a helper file
Both the monitor unit tests and monitor store unit tests will want to
check whether the config manager is used and set custom configuration
files.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
702facbc91 monitor-store-unit-tests: Add test for vertical placement
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
339340df34 tests: Add MetaMonitorConfigStore tests
Add tests that check that a XML configuration file results in correct
MetaMonitorsConfig objects.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
28a8c714ea unit-tests: Pass argc/argv directly to g_test_init
Don't let a dummy option context consume the arguments; just let the
GLib test suite do it. It'll handle the basic command line arguments
and allow doing things such as specifying what test to run.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
c9f18bfef3 monitor-unit-tests: Test headless mode
This tests only the monitor configuration and basic functionality. It
does not test anything related to window management and Wayland client
interaction.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
f45e7703ba monitor-unit-tests: Add lid-closed with no external monitor test case
Test that when the laptop lid is closed, but no external monitors are
connected, that we still have a mode set on the laptop panel.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
1ee0412177 monitor-unit-tests: Use g_assert_cmp* macros when suitable
Use the g_assert_cmp(int|uint|...) macros when comparing integers and
unsigned integers. This means that the mismatched numbers are printed
in the test report.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
81923410f6 monitor-unit-tests: Test starting with lid closed
Add a test case that checks that configuration works when the lid is
initialy closed then later opened. This test case is disabled when the
legacy configuration is used as it does not handle that situation.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
cde1a730e8 monitor-unit-tests: Add laptop lid switch test case
Test that the laptop panel is disabled if the lid is closed.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
d6efdfab4b monitor-unit-tests: Mock laptop lid state
For now, always assume the laptop lid is open, as all test cases assume
this.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
8d1be7ffc0 monitor-unit-tests: Add test for handling too few CRTCs
Check that configuration when there are more outputs than CRTCs does
something sane.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
644ee666f6 Introduce new monitor configuration system
The new monitor configuration system (MetaMonitorConfigManager) aims to
replace the current MetaMonitorConfig. The main difference between the
two is that MetaMonitorConfigManager works with higher level input
(MetaMonitor, MetaMonitorMode) instead of directly looking at the CRTC
and connector state. It still produces CRTC and connector configuration
later applied by the respective backends.

Other difference the new system aims to introduce is that the
configuration system doesn't manipulate the monitor manager state; that
responsibility is left for the monitor manager to handle (it only
manages configuration and creates CRTC/connector assignments, it
doesn't apply anything).

The new configuration system allows backends to not rely on deriving the
current configuration from the CRTC/connector state, as this may no longer be
possible (i.e. when using KMS and multiple framebuffers).

The MetaMonitorConfigManager system is so far disabled by default, as
it does not yet have all the features of the old system, but eventually
it will replace MetaMonitorConfig which will at that point be removed.
This will make it possible to remove old hacks introduced due to
limitations in the old system.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
ee0677a021 monitor-manager: Let backend implementations handle inital config
How the initial configuration is done depends on the backend, so let
them do it themself.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
1a2b493d17 tests/monitor-unit-tests: Check current monitor mode
Check both that current mode is up to date, and that deriving it again
won't change it.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
be13d0f8ee monitor: Allow monitor mode foreach crtc iterator failable
Allow the function used to iterate over the CRTC modes of a monitor
mode to fail, causing the iteration to fail as well.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
81438eebef monitor-unit-tests: Test suggested-x/y configuration
Test the suggested-x/y output state often set by virtual machines.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
c041851fa5 monitor-manager: Rename read_current_config to read_current_state
The function meta_monitor_manager_read_current_config() was renamed to
meta_monitor_manager_read_current_state() as it does not read any
configuration, but reads the current state as described by the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
63ed134165 monitor-unit-tests: Check monitor modes
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
ff633f295e logical-monitor: Don't duplicate output list
Just use the monitor list and the output lists of each monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
310064601c monitor-unit-tests: Check tiled monitor adding/removing notification
Check that the moniter manager backends get the tiled monitor
added/removed notification.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
4fa8b74dc7 monitor-unit-tests: Add musing about test declarations
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
f48acd8448 tests: Check that the crtc gets a logical monitor set
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
d0c9d2dc7b tests: Check that the monitors are properly generated
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
4e812410cc monitor-manager: Move logical monitor into its own file
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
0873e3812b backends: Rename MetaMonitorMode to MetaCrtcMode
The MetaMonitorMode referred to the mode of a CRTC, and with the future
introduction of a MetaMonitor, theh old name would be confusing.
Instead call it what it is.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
1650c35e38 monitor-manager: Rename MetaCRTC(Info) to MetaCrtc(Info)
Change to follow the naming convention used everywhere else. This means
changing CRTC to Crtc even though it is an abbreviation.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
156c478ccb tests/monitor: Add HiDPI test
This doesn't test the actual calculation, since that is done in the
backend, it only tests the configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
10e6eae0dd tests/monitor: Add tiled monitor test
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
8a8ab6c673 tests/monitor: Test preferred mode
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
9e28303588 tests/monitor: Test one out of two outputs being off
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
6776329cf5 tests/monitor: Test two crtcs, one output
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
2e4c516d43 tests/monitor-manager: Add API to emulate a hotplug event
Let a test case pass a test setup, which will be used as the new state
emulated by the test backend.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
d920eaba4a tests: Also make test case verification declarative
Set up the expected result in a declarative way in the same place as
the test case setup is declared. This way we have a completely
declarative way to create test cases.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
376a76a082 tests: Make monitor test case setup more declarative
In order to more easily create more test cases, make the test case
setup more declarative.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
c6d940d3b2 tests: Make monitor unit tests create initial config
This way we have both the test setup and testing in the same file.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
95c101a0ba tests: Use custom Wayland display name
This gets rid of a warning about the Wayland display name already being
taken.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
12150c1ca7 tests: Add basic monitor configuration tests
The added test checks that two monitors are lied out on a row next to
each other.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
a251675cc0 tests: Use special purpose backend in unit tests
Use a special purpose backend when running the unit tests. This will
eventually allow testing things like configuration and hot plugging.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Florian Müllner
868b3fd01e unit-tests: Fix const compiler warning 2016-03-11 12:26:38 +01:00
Jonas Ådahl
2d65b485fd tests: Ensure tests run in a nested mutter
Since mutter was changed to be D-Bus activatable, the test cases has not
been working when running from inside a GNOME Wayland session. This
commit makes the test work again by ensuring the tests run in a nested
mutter instance.

https://bugzilla.gnome.org/show_bug.cgi?id=763125
2016-03-07 11:19:08 +08:00
Jonas Ådahl
821d737e2c tests: Test scheduling a later MetaLater from a later callback works
The added test tests for the bug fixed by "MetaLater: Invoke later
callbacks queued by earlier ones".

https://bugzilla.gnome.org/show_bug.cgi?id=755605
2016-02-26 17:52:01 +08:00
Jonas Ådahl
00139755ff tests: Add unit tests framework runner
Separate from meta-test-runner which runs metatests testing window
manager operations, a new test program (mutter-unit-tests) is
introduced. This is meant to run unit test like tests on various units
in mutter.

An initial test testing the order of MetaLater callback invokation was
added.

https://bugzilla.gnome.org/show_bug.cgi?id=755605
2016-02-26 17:52:01 +08:00
Jonas Ådahl
75b992c7d0 tests: Add test for testing that setting a parent affects the stack
A new test is added that tests that xdg_surface.set_parent (referred to
as "transient for" in X11 terminology) affects the stack immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=755606
2015-12-23 14:59:36 +08:00
Jonas Ådahl
5054b2a99c tests: Don't rely on latency for actually showing Wayland windows
The test runner sends a "show" command to the test clients and assumes
this was enough work done by the client to enable the compositor to map
the window. Now that we wait to show a Wayland window until the first
buffer is attached (see bug 750552), we need to make sure that we attach
a buffer before assuming that we have the final stacking order.

So, to in order to continue relying on "show" to be enough to actually
show a window, let the test client wait until it has drawn the first
frame.

This makes the tests using Wayland clients test non-flaky.

https://bugzilla.gnome.org/show_bug.cgi?id=754711
2015-12-23 12:19:36 +08:00
Florian Müllner
bc00f118f3 Avoid shadowing existing variables 2015-09-24 03:08:22 +02:00
Florian Müllner
25a796afc6 Fix constness warnings 2015-09-24 03:01:51 +02:00
Jasper St. Pierre
cd4206764e Remove a few more guards for frees 2014-12-28 19:51:22 -08:00
Owen W. Taylor
cdfb301200 Add a test for stacking vs. minimization
Test that the guard window is in the right place.

https://bugzilla.gnome.org/show_bug.cgi?id=737233
2014-09-24 16:51:20 -04:00
Owen W. Taylor
371560c2b6 tests: Add minimize/unminimize commands
Add commands to request the client to minimize or unminimize the window;
unminimize doesn't currently work for GTK+ because it expects XMapRequest
to be received by the window manager, but the window is already mapped.

https://bugzilla.gnome.org/show_bug.cgi?id=737233
2014-09-24 16:26:17 -04:00
Owen W. Taylor
7616881afa test-runner: represent the guard window as '|' for assert_stacking
Allow putting '|' into the list of windows for assert_stacking to
represent the position of the guard window. Not present is the same
as at the beginning (bottom) of the list.

https://bugzilla.gnome.org/show_bug.cgi?id=737233
2014-09-24 16:26:17 -04:00
Owen W. Taylor
74c37d49c4 test-runner: make test_case_wait() wait for queued-work
Sometimes (for example with minimization) a request from the client
causes queued work rather than immediate work; so make the test client
'wait' command wait for a full frame cycle.

https://bugzilla.gnome.org/show_bug.cgi?id=737233
2014-09-24 16:26:17 -04:00
Owen W. Taylor
21f123c69f Don't restack windows while we are unmanaging them
Restacking the frame for a window while unmanaging the window is
harmless, but for undecorated (in particular, client-side-decorated)
windows, this causes problems because the window is typically
destroyed by the client immediately after withredrawing the window.

Skip windows flagged as being unmanaged when assembling the new
stack and when comparing the old order to the new stack.

Add a stacking test for this.
2014-09-16 13:44:42 -04:00
Owen W. Taylor
e53456d87c mutter-test-runner: Make criticals and warnings failures
Tests should not be counted as successful if Mutter is spewing
warnings - hook to the log handler so that we can catch that.
2014-09-16 10:59:45 -04:00
Owen W. Taylor
5716fc4b90 test-runner: Add 'csd' keyword for window creation
Allow specifying 'csd' when creating a window to make the client
create a client-side-decorated window.
2014-09-16 10:59:45 -04:00
Owen W. Taylor
73573a85de Replace MetaStackWindow with a 64-bit "stack ID"
Putting X windows and pointers to MetaWindows into a union had a number of
problems:

 - It caused awkward initialization and conditionalization
 - There was no way to refer to Wayland windows (represented by
   MetaWindow *) in the past, which is necessary for the MetaStackTracker
   algorithms
 - We never even cleaned up old MetaStackWindow so there could be
   records in MetaStackWindow pointing to freed MetaWindow.

Replace MetaStackWindow with a 64-bit "stack ID" which is:

 - The XID for X Windows
 - a "window stamp" for Wayland windows - window stamps are assigned
   for all MetaWindow and are unique across the life of the process.

https://bugzilla.gnome.org/show_bug.cgi?id=736559
2014-09-12 13:42:56 -04:00
Owen W. Taylor
b49a4ae0bc Add missing file from test framework
mutter-all.test.in was accidentally not committed.
2014-09-12 13:40:33 -04:00
Owen W. Taylor
2f63c39fa6 Add a test framework and stacking tests
Add a basic framework for tests of Mutter handling of client behavior;
mutter-test-runner is a Mutter-based compositor that forks off instances
of mutter-test-client and sends commands to them based on scripts.
The scripts also include assertions.

mutter-test-runner always runs in nested-Wayland mode since the separate
copy of Xwayland is helpful in giving a reliably clean X server to
test against.

Initially the commands and assertions are designed to test the stacking
behavior of Mutter, but the framework should be extensible to test other
parts of client behavior like focus.

The tests are installed according to:

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

if --enable-installed-tests is passed to configure. You can run them
uninstalled with:

 cd src && make run-tests

(Not in 'make check' to avoid breaking 'make distcheck' if Mutter can't be
run nested.)

https://bugzilla.gnome.org/show_bug.cgi?id=736505
2014-09-12 13:14:51 -04:00