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_config => <<EOT;
22 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
24 fake-outputs 1024x768+0+0,1024x768+1024+0,1024x768+0+768,1024x768+1024+768
27 my $s0_ws = fresh_workspace;
28 my $first = open_window;
29 my $second = open_window;
30 my $third = open_window;
31 cmd 'floating toggle';
35 $x->root->warp_pointer(1025, 0);
37 my $s1_ws = fresh_workspace;
39 my $fourth = open_window;
43 $x->root->warp_pointer(0, 769);
45 my $s2_ws = fresh_workspace;
47 my $fifth = open_window;
51 $x->root->warp_pointer(1025, 769);
53 my $s3_ws = fresh_workspace;
55 my $sixth = open_window;
56 my $seventh = open_window;
57 my $eighth = open_window;
58 cmd 'floating toggle';
60 # Layout should look like this (windows 3 and 8 are floating):
73 ###################################################################
74 # Test that focus (left|down|right|up) doesn't focus floating
75 # windows when moving into horizontally-split workspaces.
76 ###################################################################
80 cmd "workspace $ws; focus floating";
83 cmd "workspace $s1_ws";
85 is($x->input_focus, $second->id, 'second window focused');
88 cmd "workspace $s1_ws";
90 is($x->input_focus, $seventh->id, 'seventh window focused');
93 cmd "workspace $s2_ws";
95 is($x->input_focus, $sixth->id, 'sixth window focused');
98 cmd "workspace $s2_ws";
100 is($x->input_focus, $second->id, 'second window focused');
103 ###################################################################
104 # Put the workspaces on screens 0 and 3 into vertical split mode
105 # and test focus (left|down|right|up) again.
106 ###################################################################
108 cmd "workspace $s0_ws";
109 is($x->input_focus, $third->id, 'third window focused');
115 cmd "workspace $s3_ws";
116 is($x->input_focus, $eighth->id, 'eighth window focused');
122 cmd "workspace $s1_ws";
124 is($x->input_focus, $second->id, 'second window focused');
127 cmd "workspace $s1_ws";
129 is($x->input_focus, $sixth->id, 'sixth window focused');
132 cmd "workspace $s2_ws";
134 is($x->input_focus, $sixth->id, 'sixth window focused');
136 cmd "workspace $s2_ws";
138 is($x->input_focus, $second->id, 'second window focused');