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';
41 $x->root->warp_pointer(1025, 0);
42 my $s1_ws = fresh_workspace;
45 my $fourth = open_window;
48 $x->root->warp_pointer(0, 769);
49 my $s2_ws = fresh_workspace;
52 my $fifth = open_window;
55 $x->root->warp_pointer(1025, 769);
56 my $s3_ws = fresh_workspace;
59 my $sixth = open_window;
60 my $seventh = open_window;
61 my $eighth = open_window;
62 cmd 'floating toggle';
64 # Layout should look like this (windows 3 and 8 are floating):
77 ###################################################################
78 # Test that focus (left|down|right|up) doesn't focus floating
79 # windows when moving into horizontally-split workspaces.
80 ###################################################################
84 cmd "workspace $ws; focus floating";
87 cmd "workspace $s1_ws";
89 is($x->input_focus, $second->id, 'second window focused');
92 cmd "workspace $s1_ws";
94 is($x->input_focus, $seventh->id, 'seventh window focused');
97 cmd "workspace $s2_ws";
99 is($x->input_focus, $sixth->id, 'sixth window focused');
102 cmd "workspace $s2_ws";
104 is($x->input_focus, $second->id, 'second window focused');
107 ###################################################################
108 # Put the workspaces on screens 0 and 3 into vertical split mode
109 # and test focus (left|down|right|up) again.
110 ###################################################################
112 cmd "workspace $s0_ws";
113 is($x->input_focus, $third->id, 'third window focused');
119 cmd "workspace $s3_ws";
120 is($x->input_focus, $eighth->id, 'eighth window focused');
126 cmd "workspace $s1_ws";
128 is($x->input_focus, $second->id, 'second window focused');
131 cmd "workspace $s1_ws";
133 is($x->input_focus, $sixth->id, 'sixth window focused');
136 cmd "workspace $s2_ws";
138 is($x->input_focus, $sixth->id, 'sixth window focused');
140 cmd "workspace $s2_ws";
142 is($x->input_focus, $second->id, 'second window focused');
144 exit_gracefully($pid);