]> git.sur5r.net Git - i3/i3/blob - testcases/t/242-no-focus.t
Merge pull request #1712 from Airblader/feature-next-wm-size-hints-adopted
[i3/i3] / testcases / t / 242-no-focus.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • http://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 # Test the 'no_focus' directive.
18 # Ticket: #1416
19 use i3test i3_autostart => 0;
20
21 my ($config, $pid, $ws, $first, $second, $focused);
22
23 #####################################################################
24 # 1: open a window and check that it takes focus
25 #####################################################################
26
27 $config = <<EOT;
28 # i3 config file (v4)
29 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
30 EOT
31
32 $pid = launch_with_config($config);
33  
34 $ws = fresh_workspace;
35 $first = open_window;
36 $focused = get_focused($ws);
37 $second = open_window;
38
39 isnt(get_focused($ws), $focused, 'focus has changed');
40
41 exit_gracefully($pid);
42
43 #####################################################################
44 # 2: open a window matched by a no_focus directive and check that
45 #    it doesn't take focus
46 #####################################################################
47
48 $config = <<EOT;
49 # i3 config file (v4)
50 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
51
52 no_focus [instance=notme]
53 EOT
54
55 $pid = launch_with_config($config);
56  
57 $ws = fresh_workspace;
58 $first = open_window;
59 $focused = get_focused($ws);
60 $second = open_window(wm_class => 'notme');
61
62 is(get_focused($ws), $focused, 'focus has not changed');
63
64 exit_gracefully($pid);
65
66 #####################################################################
67
68 done_testing;