]> git.sur5r.net Git - i3/i3/blob - testcases/t/503-workspace.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 503-workspace.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Tests whether 'workspace next_on_output' and the like work correctly.
5 #
6 use List::Util qw(first);
7 use i3test;
8
9 ################################################################################
10 # Setup workspaces so that they stay open (with an empty container).
11 ################################################################################
12
13 is(focused_ws, '1', 'starting on workspace 1');
14 # ensure workspace 1 stays open
15 open_window;
16
17 cmd 'focus output right';
18 is(focused_ws, '2', 'workspace 2 on second output');
19 # ensure workspace 2 stays open
20 open_window;
21
22 cmd 'focus output right';
23 is(focused_ws, '1', 'back on workspace 1');
24
25 # We don’t use fresh_workspace with named workspaces here since they come last
26 # when using 'workspace next'.
27 cmd 'workspace 5';
28 # ensure workspace 5 stays open
29 open_window;
30
31 ################################################################################
32 # Use workspace next and verify the correct order.
33 ################################################################################
34
35 # The current order should be:
36 # output 1: 1, 5
37 # output 2: 2
38 cmd 'workspace 1';
39 cmd 'workspace next';
40 is(focused_ws, '2', 'workspace 2 focused');
41 cmd 'workspace next';
42 is(focused_ws, '5', 'workspace 5 focused');
43
44 ################################################################################
45 # Now try the same with workspace next_on_output.
46 ################################################################################
47
48 cmd 'workspace 1';
49 cmd 'workspace next_on_output';
50 is(focused_ws, '5', 'workspace 5 focused');
51 cmd 'workspace next_on_output';
52 is(focused_ws, '1', 'workspace 1 focused');
53
54 cmd 'workspace prev_on_output';
55 is(focused_ws, '5', 'workspace 5 focused');
56 cmd 'workspace prev_on_output';
57 is(focused_ws, '1', 'workspace 1 focused');
58
59 cmd 'workspace 2';
60
61 cmd 'workspace prev_on_output';
62 is(focused_ws, '2', 'workspace 2 focused');
63
64 done_testing;