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 if the 'force_focus_wrapping' config directive works correctly.
19 use i3test i3_autostart => 0;
21 #####################################################################
22 # 1: test the wrapping behaviour without force_focus_wrapping
23 #####################################################################
27 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
30 my $pid = launch_with_config($config);
32 my $tmp = fresh_workspace;
34 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
36 my $first = open_window;
37 my $second = open_window;
42 my $third = open_window;
43 is($x->input_focus, $third->id, 'third window focused');
46 is($x->input_focus, $second->id, 'second window focused');
49 is($x->input_focus, $first->id, 'first window focused');
51 # now test the wrapping
53 is($x->input_focus, $second->id, 'second window focused');
55 # but focusing right should not wrap now, but instead focus the third window
57 is($x->input_focus, $third->id, 'third window focused');
59 exit_gracefully($pid);
61 #####################################################################
62 # 2: test the wrapping behaviour with force_focus_wrapping
63 #####################################################################
67 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
68 force_focus_wrapping true
71 $pid = launch_with_config($config);
73 $tmp = fresh_workspace;
75 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
78 $second = open_window;
85 is($x->input_focus, $third->id, 'third window focused');
88 is($x->input_focus, $second->id, 'second window focused');
91 is($x->input_focus, $first->id, 'first window focused');
93 # now test the wrapping
95 is($x->input_focus, $second->id, 'second window focused');
97 # focusing right should now be forced to wrap
99 is($x->input_focus, $first->id, 'first window focused');
101 exit_gracefully($pid);