]> git.sur5r.net Git - i3/i3/blob - testcases/t/275-ipc-window-close.t
Merge "force_focus_wrapping" option into "focus_wrapping force"
[i3/i3] / testcases / t / 275-ipc-window-close.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 that the ipc close event works properly
18 #
19 # Bug still in: 4.8-7-gf4a8253
20 use i3test;
21
22 my $i3 = i3(get_socket_path());
23 $i3->connect()->recv;
24
25 my $cv;
26 my $t;
27
28 sub reset_test {
29     $cv = AE::cv;
30     $t = AE::timer(0.5, 0, sub { $cv->send(0); });
31 }
32
33 reset_test;
34
35 $i3->subscribe({
36         window => sub {
37             my ($e) = @_;
38             if ($e->{change} eq 'close') {
39                 $cv->send($e->{container});
40             }
41         },
42     })->recv;
43
44 my $window = open_window;
45
46 cmd 'kill';
47 my $con = $cv->recv;
48
49 ok($con, 'closing a window should send the window::close event');
50 is($con->{window}, $window->{id}, 'the event should contain information about the window');
51
52 done_testing;