gri3-wm/testcases/t/503-workspace.t

84 lines
2.4 KiB
Perl
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!perl
# vim:ts=4:sw=4:expandtab
#
# Tests whether 'workspace next_on_output' and the like work correctly.
#
use List::Util qw(first);
use i3test i3_autostart => 0;
my $config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
my $pid = launch_with_config($config);
################################################################################
# Setup workspaces so that they stay open (with an empty container).
################################################################################
$x->root->warp_pointer(0, 0);
sync_with_i3;
is(focused_ws, '1', 'starting on workspace 1');
# ensure workspace 1 stays open
open_window;
cmd 'focus output right';
is(focused_ws, '2', 'workspace 2 on second output');
# ensure workspace 2 stays open
open_window;
cmd 'focus output right';
is(focused_ws, '1', 'back on workspace 1');
# We dont use fresh_workspace with named workspaces here since they come last
# when using 'workspace next'.
cmd 'workspace 5';
# ensure workspace 5 stays open
open_window;
################################################################################
# Use workspace next and verify the correct order.
################################################################################
# The current order should be:
# output 1: 1, 5
# output 2: 2
cmd 'workspace 1';
cmd 'workspace next';
is(focused_ws, '2', 'workspace 2 focused');
cmd 'workspace next';
is(focused_ws, '5', 'workspace 5 focused');
################################################################################
# Now try the same with workspace next_on_output.
################################################################################
cmd 'workspace 1';
cmd 'workspace next_on_output';
is(focused_ws, '5', 'workspace 5 focused');
cmd 'workspace next_on_output';
is(focused_ws, '1', 'workspace 1 focused');
cmd 'workspace prev_on_output';
is(focused_ws, '5', 'workspace 5 focused');
cmd 'workspace prev_on_output';
is(focused_ws, '1', 'workspace 1 focused');
cmd 'workspace 2';
# XXX: This is to avoid EnterNotifies changing the focus. Not sure why they
# appear sometimes in the first place. Only happens when running the full
# testsuite.
$x->root->warp_pointer(1025, 0);
sync_with_i3;
cmd 'workspace prev_on_output';
is(focused_ws, '2', 'workspace 2 focused');
exit_gracefully($pid);
done_testing;