2012-01-08 17:33:16 +01:00
|
|
|
|
#!perl
|
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
|
#
|
2012-09-10 14:09:01 +02:00
|
|
|
|
# Please read the following documents before working on tests:
|
|
|
|
|
# • http://build.i3wm.org/docs/testsuite.html
|
|
|
|
|
# (or docs/testsuite)
|
|
|
|
|
#
|
|
|
|
|
# • http://build.i3wm.org/docs/lib-i3test.html
|
|
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
|
#
|
|
|
|
|
# • http://build.i3wm.org/docs/ipc.html
|
|
|
|
|
# (or docs/ipc)
|
|
|
|
|
#
|
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
|
#
|
2012-01-08 17:33:16 +01:00
|
|
|
|
# Tests whether 'workspace next_on_output' and the like work correctly.
|
|
|
|
|
#
|
|
|
|
|
use List::Util qw(first);
|
2012-04-09 14:27:33 +02:00
|
|
|
|
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);
|
2012-01-08 17:33:16 +01:00
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Setup workspaces so that they stay open (with an empty container).
|
|
|
|
|
################################################################################
|
|
|
|
|
|
2012-04-09 14:48:43 +02:00
|
|
|
|
$x->root->warp_pointer(0, 0);
|
|
|
|
|
sync_with_i3;
|
|
|
|
|
|
2012-01-08 17:33:16 +01:00
|
|
|
|
is(focused_ws, '1', 'starting on workspace 1');
|
|
|
|
|
# ensure workspace 1 stays open
|
2012-01-09 20:15:59 +01:00
|
|
|
|
open_window;
|
2012-01-08 17:33:16 +01:00
|
|
|
|
|
|
|
|
|
cmd 'focus output right';
|
|
|
|
|
is(focused_ws, '2', 'workspace 2 on second output');
|
|
|
|
|
# ensure workspace 2 stays open
|
2012-01-09 20:15:59 +01:00
|
|
|
|
open_window;
|
2012-01-08 17:33:16 +01:00
|
|
|
|
|
|
|
|
|
cmd 'focus output right';
|
|
|
|
|
is(focused_ws, '1', 'back on workspace 1');
|
|
|
|
|
|
|
|
|
|
# We don’t use fresh_workspace with named workspaces here since they come last
|
|
|
|
|
# when using 'workspace next'.
|
|
|
|
|
cmd 'workspace 5';
|
2012-01-09 20:15:59 +01:00
|
|
|
|
# ensure workspace 5 stays open
|
|
|
|
|
open_window;
|
2012-01-08 17:33:16 +01:00
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# 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';
|
2012-12-26 22:02:43 +01:00
|
|
|
|
# We need to sync after changing focus to a different output to wait for the
|
|
|
|
|
# EnterNotify to be processed, otherwise it will be processed at some point
|
|
|
|
|
# later in time and mess up our subsequent tests.
|
|
|
|
|
sync_with_i3;
|
|
|
|
|
|
2012-01-08 17:33:16 +01:00
|
|
|
|
is(focused_ws, '2', 'workspace 2 focused');
|
|
|
|
|
cmd 'workspace next';
|
2012-12-26 22:02:43 +01:00
|
|
|
|
# We need to sync after changing focus to a different output to wait for the
|
|
|
|
|
# EnterNotify to be processed, otherwise it will be processed at some point
|
|
|
|
|
# later in time and mess up our subsequent tests.
|
|
|
|
|
sync_with_i3;
|
|
|
|
|
|
2012-01-08 17:33:16 +01:00
|
|
|
|
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';
|
2012-12-26 22:02:43 +01:00
|
|
|
|
# We need to sync after changing focus to a different output to wait for the
|
|
|
|
|
# EnterNotify to be processed, otherwise it will be processed at some point
|
|
|
|
|
# later in time and mess up our subsequent tests.
|
2012-04-09 14:48:43 +02:00
|
|
|
|
sync_with_i3;
|
|
|
|
|
|
2012-01-08 17:33:16 +01:00
|
|
|
|
cmd 'workspace prev_on_output';
|
|
|
|
|
is(focused_ws, '2', 'workspace 2 focused');
|
|
|
|
|
|
2012-04-09 14:27:33 +02:00
|
|
|
|
exit_gracefully($pid);
|
|
|
|
|
|
2012-01-08 17:33:16 +01:00
|
|
|
|
done_testing;
|