2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Test the ipc shutdown event. This event is triggered when the connection to
18 # the ipc is about to shutdown because of a user action such as with a
19 # `restart` or `exit` command. The `change` field indicates why the ipc is
20 # shutting down. It can be either "restart" or "exit".
23 # Bug still in: 4.12-46-g2123888
27 skip "AnyEvent::I3 too old (need >= 0.17)", 1 if $AnyEvent::I3::VERSION < 0.17;
29 my $i3 = i3(get_socket_path());
33 my $timer = AE::timer 0.5, 0, sub { $cv->send(0); };
45 diag "Event:\n", Dumper($e);
46 ok($e, 'the shutdown event should emit when the ipc is restarted by command');
47 is($e->{change}, 'restart', 'the `change` field should tell the reason for the shutdown');
49 # restarting kills the ipc client so we have to make a new one
50 $i3 = i3(get_socket_path());
54 $timer = AE::timer 0.5, 0, sub { $cv->send(0); };
66 diag "Event:\n", Dumper($e);
67 ok($e, 'the shutdown event should emit when the ipc is exited by command');
68 is($e->{change}, 'exit', 'the `change` field should tell the reason for the shutdown');