Skip to content

Commit

Permalink
tests: test mixed-dpi configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
amezin committed Sep 3, 2022
1 parent f7c7f33 commit 64deee9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Service]
Environment="MUTTER_DEBUG_NUM_DUMMY_MONITORS=2"
Environment="[email protected]"
Environment="MUTTER_DEBUG_DUMMY_MONITOR_SCALES=2,1"
18 changes: 16 additions & 2 deletions test/extension_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,18 @@ function wait_move_resize(window_size, window_maximize, window_pos, monitor_inde
});
}

function is_mixed_dpi() {
let scales = [];

for (let i = 0; i < global.display.get_n_monitors(); i++) {
const scale = global.display.get_monitor_scale(i);
if (!scales.includes(scale))
scales.push(scale);
}

return scales.length > 1;
}

async function test_show(window_size, window_maximize, window_pos, current_monitor, window_monitor) {
message(`Starting test with window size=${window_size}, maximize=${window_maximize}, position=${window_pos}`);

Expand Down Expand Up @@ -641,11 +653,13 @@ async function test_show(window_size, window_maximize, window_pos, current_monit

const monitor_index = window_monitor_index(window_monitor);
const should_maximize = window_maximize === WindowMaximizeMode.EARLY || (window_size === 1.0 && settings.get_boolean('window-maximize'));
await wait_move_resize(window_size, should_maximize, window_pos, monitor_index, prev_maximize === should_maximize ? 0 : 1);
const mixed_dpi_penalty = is_mixed_dpi() ? 1 : 0;

await wait_move_resize(window_size, should_maximize, window_pos, monitor_index, (prev_maximize === should_maximize ? 0 : 1) + mixed_dpi_penalty);
verify_window_geometry(window_size, should_maximize, window_pos, monitor_index);

if (window_maximize === WindowMaximizeMode.LATE) {
const geometry_wait = wait_move_resize(window_size, true, window_pos, monitor_index, 1);
const geometry_wait = wait_move_resize(window_size, true, window_pos, monitor_index, 1 + mixed_dpi_penalty);

await set_settings_boolean('window-maximize', true);

Expand Down
31 changes: 31 additions & 0 deletions test/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,34 @@ def mount_configs(cls):
return super().mount_configs() + [
'/etc/systemd/user/[email protected]/mutter-dual-monitor.conf'
]


@pytest.mark.flaky
class TestWaylandMixedDPI(DualMonitorTests, SmallScreenMixin):
GNOME_SHELL_SESSION_NAME = 'gnome-wayland-nested'

@classmethod
def mount_configs(cls):
return super().mount_configs() + [
'/etc/systemd/user/[email protected]/mutter-mixed-dpi.conf'
]

@pytest.mark.skip
def test_resize_xte(self, monitor_config):
pass

@pytest.mark.skip
def test_change_position(self, monitor_config):
pass

@pytest.mark.skip
def test_unmaximize(self, monitor_config):
pass

@pytest.mark.skip
def test_unmaximize_correct_size(self, monitor_config):
pass

@pytest.mark.skip
def test_unmaximize_on_size_change(self, monitor_config):
pass

0 comments on commit 64deee9

Please sign in to comment.