]> git.sur5r.net Git - i3/i3/blob - testcases/t/295-net-wm-state-focused.t
fd7c251306ecee62a4446360d8d22f2afae11fcd
[i3/i3] / testcases / t / 295-net-wm-state-focused.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 # Tests for setting and removing the _NET_WM_STATE_FOCUSED atom properly.
18 # Ticket: #2273
19 use i3test;
20 use X11::XCB qw(:all);
21
22 my ($windowA, $windowB);
23
24 fresh_workspace;
25 $windowA = open_window;
26 ok(is_net_wm_state_focused($windowA), 'a newly opened window that is focused should have _NET_WM_STATE_FOCUSED set');
27
28 $windowB = open_window;
29 ok(!is_net_wm_state_focused($windowA), 'when a another window is focused, the old window should not have _NET_WM_STATE_FOCUSED set');
30 ok(is_net_wm_state_focused($windowB), 'a newly opened window that is focused should have _NET_WM_STATE_FOCUSED set');
31
32 # See issue #3495.
33 cmd 'kill';
34 ok(is_net_wm_state_focused($windowA), 'when the second window is closed, the first window should have _NET_WM_STATE_FOCUSED set');
35
36 fresh_workspace;
37 ok(!is_net_wm_state_focused($windowA), 'when focus moves to the ewmh support window, no window should have _NET_WM_STATE_FOCUSED set');
38
39 done_testing;