]> git.sur5r.net Git - i3/i3/blob - testcases/t/248-regress-urgency-clear.t
tests: replace http:// with https:// where appropriate
[i3/i3] / testcases / t / 248-regress-urgency-clear.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 # Ensures the urgency hint is cleared properly in the case where i3 set it (due
18 # to focus_on_window_activation=urgent), hence the application not clearing it.
19 # Ticket: #1825
20 # Bug still in: 4.10.3-253-g03799dd
21 use i3test i3_config => <<EOT;
22 # i3 config file (v4)
23 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
24
25 focus_on_window_activation urgent
26 EOT
27
28 sub send_net_active_window {
29     my ($id) = @_;
30
31     my $msg = pack "CCSLLLLLLL",
32         X11::XCB::CLIENT_MESSAGE, # response_type
33         32, # format
34         0, # sequence
35         $id, # destination window
36         $x->atom(name => '_NET_ACTIVE_WINDOW')->id,
37         0, # source
38         0, 0, 0, 0;
39
40     $x->send_event(0, $x->get_root_window(), X11::XCB::EVENT_MASK_SUBSTRUCTURE_REDIRECT, $msg);
41 }
42
43 my $ws = fresh_workspace;
44 my $first = open_window;
45 my $second = open_window;
46
47 send_net_active_window($first->id);
48 sync_with_i3;
49 is($x->input_focus, $second->id, 'second window still focused');
50
51 cmd '[urgent=latest] focus';
52 sync_with_i3;
53 is($x->input_focus, $first->id, 'first window focused');
54
55 cmd 'focus right';
56 sync_with_i3;
57 is($x->input_focus, $second->id, 'second window focused again');
58
59 cmd '[urgent=latest] focus';
60 sync_with_i3;
61 is($x->input_focus, $second->id, 'second window still focused');
62
63 done_testing;