]> git.sur5r.net Git - i3/i3/blob - testcases/t/295-net-wm-state-focused.t
1881154e4be362c0576d82c62b4b8604180936c4
[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
27 ok(is_net_wm_state_focused($windowA), 'a newly opened window that is focused should have _NET_WM_STATE_FOCUSED set');
28
29 $windowB = open_window;
30
31 ok(!is_net_wm_state_focused($windowA), 'when a another window is focused, the old window should not have _NET_WM_STATE_FOCUSED set');
32
33 fresh_workspace;
34
35 ok(!is_net_wm_state_focused($windowB), 'when focus moves to the ewmh support window, neither window should have _NET_WM_STATE_FOCUSED set');
36
37 done_testing;