]> git.sur5r.net Git - i3/i3/blob - testcases/t/233-regress-manage-focus-unmapped.t
Update ewmh focused only when new focus is different (#3496)
[i3/i3] / testcases / t / 233-regress-manage-focus-unmapped.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://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 that an assignment that unmaps a window does not disturb input focus.
18 # This can cause i3 focus to be an unmapped window and different than X focus
19 # which can lead to complications
20 # Ticket: #1283
21 # Bug still in: 4.8-24-g60070de
22 use i3test i3_config => <<'EOT';
23 # i3 config file (v4)
24 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
25
26 for_window [class="^special_kill$"] kill
27 for_window [class="^special_scratchpad$"] move scratchpad
28 EOT
29
30 my $win = open_window;
31
32 my $scratch_window = open_window(
33     wm_class => 'special_scratchpad',
34     dont_map => 1
35 );
36 $scratch_window->map;
37 sync_with_i3;
38
39 is($x->input_focus, $win->{id},
40     'an assignment that sends a window to the scratchpad should not disturb focus');
41
42 my $kill_window = open_window(
43     wm_class => 'special_kill',
44     dont_map => 1
45 );
46 $kill_window->map;
47 sync_with_i3;
48
49 is($x->input_focus, $win->{id},
50     'an assignment that kills a window should not disturb focus');
51
52 done_testing;