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 # Test the 'no_focus' directive.
19 use i3test i3_autostart => 0;
21 my ($config, $pid, $ws, $first, $second, $focused);
23 #####################################################################
24 # 1: open a window and check that it takes focus
25 #####################################################################
29 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
32 $pid = launch_with_config($config);
34 $ws = fresh_workspace;
36 $focused = get_focused($ws);
37 $second = open_window;
39 isnt(get_focused($ws), $focused, 'focus has changed');
41 exit_gracefully($pid);
43 #####################################################################
44 # 2: open a window matched by a no_focus directive and check that
45 # it doesn't take focus
46 #####################################################################
50 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
52 no_focus [instance=notme]
55 $pid = launch_with_config($config);
57 $ws = fresh_workspace;
59 $focused = get_focused($ws);
60 $second = open_window(wm_class => 'notme');
62 is(get_focused($ws), $focused, 'focus has not changed');
64 exit_gracefully($pid);
66 #####################################################################