]> git.sur5r.net Git - i3/i3/blob - testcases/t/239-net-close-window-request.t
Merge branch 'next' into master
[i3/i3] / testcases / t / 239-net-close-window-request.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 _NET_CLOSE_WINDOW requests to close a window.
18 # See https://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472668896
19 # Ticket: #1396
20 # Bug still in: 4.8-116-gbb1f857
21 use i3test;
22
23 sub send_close_window_request {
24     my ($win) = @_;
25
26     my $msg = pack "CCSLLLLLL",
27         X11::XCB::CLIENT_MESSAGE, # response_type
28         32, # format
29         0, # sequence
30         $win->id, # window
31         $x->atom(name => '_NET_CLOSE_WINDOW')->id, # message type
32         0, # data32[0]
33         0, # data32[1]
34         0, # data32[2]
35         0, # data32[3]
36         0; # data32[4]
37
38     $x->send_event(0, $x->get_root_window(), X11::XCB::EVENT_MASK_SUBSTRUCTURE_REDIRECT, $msg);
39 }
40
41 my $ws = fresh_workspace;
42 my $win = open_window;
43
44 send_close_window_request($win);
45 sync_with_i3;
46
47 is(@{get_ws($ws)->{nodes}}, 0, 'When a pager sends a _NET_CLOSE_WINDOW request for a window, the container should be closed');
48
49 done_testing;