2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Tests whether 'workspace next_on_output' and the like work correctly.
19 use List::Util qw(first);
20 use i3test i3_autostart => 0;
24 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
26 fake-outputs 1024x768+0+0,1024x768+1024+0
28 my $pid = launch_with_config($config);
30 ################################################################################
31 # Setup workspaces so that they stay open (with an empty container).
32 ################################################################################
34 $x->root->warp_pointer(0, 0);
37 is(focused_ws, '1', 'starting on workspace 1');
38 # ensure workspace 1 stays open
41 cmd 'focus output right';
42 is(focused_ws, '2', 'workspace 2 on second output');
43 # ensure workspace 2 stays open
46 cmd 'focus output right';
47 is(focused_ws, '1', 'back on workspace 1');
49 # We don’t use fresh_workspace with named workspaces here since they come last
50 # when using 'workspace next'.
52 # ensure workspace 5 stays open
55 ################################################################################
56 # Use workspace next and verify the correct order.
57 ################################################################################
59 # The current order should be:
64 is(focused_ws, '2', 'workspace 2 focused');
66 is(focused_ws, '5', 'workspace 5 focused');
68 ################################################################################
69 # Now try the same with workspace next_on_output.
70 ################################################################################
73 cmd 'workspace next_on_output';
74 is(focused_ws, '5', 'workspace 5 focused');
75 cmd 'workspace next_on_output';
76 is(focused_ws, '1', 'workspace 1 focused');
78 cmd 'workspace prev_on_output';
79 is(focused_ws, '5', 'workspace 5 focused');
80 cmd 'workspace prev_on_output';
81 is(focused_ws, '1', 'workspace 1 focused');
85 # XXX: This is to avoid EnterNotifies changing the focus. Not sure why they
86 # appear sometimes in the first place. Only happens when running the full
88 $x->root->warp_pointer(1025, 0);
91 cmd 'workspace prev_on_output';
92 is(focused_ws, '2', 'workspace 2 focused');
94 exit_gracefully($pid);