]> git.sur5r.net Git - i3/i3/blob - testcases/t/242-no-focus.t
Merge branch 'master' into next
[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 #####################################################################
22 # 1: open a window and check that it takes focus
23 #####################################################################
24
25 my $config = <<EOT;
26 # i3 config file (v4)
27 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
28 EOT
29
30 my $pid = launch_with_config($config);
31  
32 my $ws = fresh_workspace;
33 my $first = open_window;
34 my $focused = get_focused($ws);
35 my $second = open_window;
36
37 isnt(get_focused($ws), $focused, 'focus has changed');
38
39 exit_gracefully($pid);
40
41 #####################################################################
42 # 2: open a window matched by a no_focus directive and check that
43 #    it doesn't take focus
44 #####################################################################
45
46 my $config = <<EOT;
47 # i3 config file (v4)
48 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
49
50 no_focus [instance=notme]
51 EOT
52
53 my $pid = launch_with_config($config);
54  
55 my $ws = fresh_workspace;
56 my $first = open_window;
57 my $focused = get_focused($ws);
58 my $second = open_window(wm_class => 'notme');
59
60 is(get_focused($ws), $focused, 'focus has not changed');
61
62 exit_gracefully($pid);
63
64 #####################################################################
65
66 done_testing;