Implement the tick event

This makes our tests less flaky, shorter, and more readable.

fixes #2988
This commit is contained in:
Michael Stapelberg
2017-09-24 15:40:30 +02:00
parent 14c8cf8622
commit ce21de8dde
29 changed files with 457 additions and 734 deletions

View File

@ -23,13 +23,13 @@
# Bug still in: 4.12-46-g2123888
use i3test;
SKIP: {
skip "AnyEvent::I3 too old (need >= 0.17)", 1 if $AnyEvent::I3::VERSION < 0.17;
# We cannot use events_for in this test as we cannot send events after
# issuing the restart/shutdown command.
my $i3 = i3(get_socket_path());
$i3->connect->recv;
my $cv = AE::cv;
my $cv = AnyEvent->condvar;
my $timer = AE::timer 0.5, 0, sub { $cv->send(0); };
$i3->subscribe({
@ -50,7 +50,7 @@ is($e->{change}, 'restart', 'the `change` field should tell the reason for the s
$i3 = i3(get_socket_path());
$i3->connect->recv;
$cv = AE::cv;
$cv = AnyEvent->condvar;
$timer = AE::timer 0.5, 0, sub { $cv->send(0); };
$i3->subscribe({
@ -66,6 +66,5 @@ $e = $cv->recv;
diag "Event:\n", Dumper($e);
ok($e, 'the shutdown event should emit when the ipc is exited by command');
is($e->{change}, 'exit', 'the `change` field should tell the reason for the shutdown');
}
done_testing;