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 that switching workspaces via 'focus $dir' never leaves a floating
20 use i3test i3_autostart => 0;
22 # Ensure the pointer is at (0, 0) so that we really start on the first
23 # (the left) workspace.
24 $x->root->warp_pointer(0, 0);
28 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
30 fake-outputs 1024x768+0+0,1024x768+1024+0,1024x768+0+768,1024x768+1024+768
32 my $pid = launch_with_config($config);
34 my $s0_ws = fresh_workspace;
35 my $first = open_window;
36 my $second = open_window;
37 my $third = open_window;
38 cmd 'floating toggle';
42 $x->root->warp_pointer(1025, 0);
44 my $s1_ws = fresh_workspace;
46 my $fourth = open_window;
50 $x->root->warp_pointer(0, 769);
52 my $s2_ws = fresh_workspace;
54 my $fifth = open_window;
58 $x->root->warp_pointer(1025, 769);
60 my $s3_ws = fresh_workspace;
62 my $sixth = open_window;
63 my $seventh = open_window;
64 my $eighth = open_window;
65 cmd 'floating toggle';
67 # Layout should look like this (windows 3 and 8 are floating):
80 ###################################################################
81 # Test that focus (left|down|right|up) doesn't focus floating
82 # windows when moving into horizontally-split workspaces.
83 ###################################################################
87 cmd "workspace $ws; focus floating";
90 cmd "workspace $s1_ws";
92 is($x->input_focus, $second->id, 'second window focused');
95 cmd "workspace $s1_ws";
97 is($x->input_focus, $seventh->id, 'seventh window focused');
100 cmd "workspace $s2_ws";
102 is($x->input_focus, $sixth->id, 'sixth window focused');
105 cmd "workspace $s2_ws";
107 is($x->input_focus, $second->id, 'second window focused');
110 ###################################################################
111 # Put the workspaces on screens 0 and 3 into vertical split mode
112 # and test focus (left|down|right|up) again.
113 ###################################################################
115 cmd "workspace $s0_ws";
116 is($x->input_focus, $third->id, 'third window focused');
122 cmd "workspace $s3_ws";
123 is($x->input_focus, $eighth->id, 'eighth window focused');
129 cmd "workspace $s1_ws";
131 is($x->input_focus, $second->id, 'second window focused');
134 cmd "workspace $s1_ws";
136 is($x->input_focus, $sixth->id, 'sixth window focused');
139 cmd "workspace $s2_ws";
141 is($x->input_focus, $sixth->id, 'sixth window focused');
143 cmd "workspace $s2_ws";
145 is($x->input_focus, $second->id, 'second window focused');
147 exit_gracefully($pid);