]> git.sur5r.net Git - i3/i3/blob - testcases/t/233-regress-manage-focus-unmapped.t
Bugfix: don't focus unmapped container on manage
[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 # • 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 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_autostart => 0;
23
24 my $config = <<'EOT';
25 # i3 config file (v4)
26 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
27
28 for_window [class="^special_kill$"] kill
29 for_window [class="^special_scratchpad$"] move scratchpad
30 EOT
31
32 my $pid = launch_with_config($config);
33
34 my $win = open_window;
35
36 my $scratch_window = open_window(
37     wm_class => 'special_scratchpad',
38     dont_map => 1
39 );
40 $scratch_window->map;
41 sync_with_i3;
42
43 is($x->input_focus, $win->{id},
44     'an assignment that sends a window to the scratchpad should not disturb focus');
45
46 my $kill_window = open_window(
47     wm_class => 'special_kill',
48     dont_map => 1
49 );
50 $kill_window->map;
51 sync_with_i3;
52
53 is($x->input_focus, $win->{id},
54     'an assignment that kills a window should not disturb focus');
55
56 exit_gracefully($pid);
57
58 done_testing;