]> git.sur5r.net Git - i3/i3/blob - testcases/t/503-workspace.t
Restrict directional focus in fullscreen.
[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 i3_autostart => 0;
8
9 my $config = <<EOT;
10 # i3 config file (v4)
11 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
12
13 fake-outputs 1024x768+0+0,1024x768+1024+0
14 EOT
15 my $pid = launch_with_config($config);
16
17 ################################################################################
18 # Setup workspaces so that they stay open (with an empty container).
19 ################################################################################
20
21 $x->root->warp_pointer(0, 0);
22 sync_with_i3;
23
24 is(focused_ws, '1', 'starting on workspace 1');
25 # ensure workspace 1 stays open
26 open_window;
27
28 cmd 'focus output right';
29 is(focused_ws, '2', 'workspace 2 on second output');
30 # ensure workspace 2 stays open
31 open_window;
32
33 cmd 'focus output right';
34 is(focused_ws, '1', 'back on workspace 1');
35
36 # We don’t use fresh_workspace with named workspaces here since they come last
37 # when using 'workspace next'.
38 cmd 'workspace 5';
39 # ensure workspace 5 stays open
40 open_window;
41
42 ################################################################################
43 # Use workspace next and verify the correct order.
44 ################################################################################
45
46 # The current order should be:
47 # output 1: 1, 5
48 # output 2: 2
49 cmd 'workspace 1';
50 cmd 'workspace next';
51 is(focused_ws, '2', 'workspace 2 focused');
52 cmd 'workspace next';
53 is(focused_ws, '5', 'workspace 5 focused');
54
55 ################################################################################
56 # Now try the same with workspace next_on_output.
57 ################################################################################
58
59 cmd 'workspace 1';
60 cmd 'workspace next_on_output';
61 is(focused_ws, '5', 'workspace 5 focused');
62 cmd 'workspace next_on_output';
63 is(focused_ws, '1', 'workspace 1 focused');
64
65 cmd 'workspace prev_on_output';
66 is(focused_ws, '5', 'workspace 5 focused');
67 cmd 'workspace prev_on_output';
68 is(focused_ws, '1', 'workspace 1 focused');
69
70 cmd 'workspace 2';
71
72 # XXX: This is to avoid EnterNotifies changing the focus. Not sure why they
73 # appear sometimes in the first place. Only happens when running the full
74 # testsuite.
75 $x->root->warp_pointer(1025, 0);
76 sync_with_i3;
77
78 cmd 'workspace prev_on_output';
79 is(focused_ws, '2', 'workspace 2 focused');
80
81 exit_gracefully($pid);
82
83 done_testing;