Implement the tick event
This makes our tests less flaky, shorter, and more readable. fixes #2988
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
#
|
||||
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
||||
# (unless you are already familiar with Perl)
|
||||
#
|
||||
#
|
||||
# Ticket: #990
|
||||
# Bug still in: 4.5.1-23-g82b5978
|
||||
|
||||
@ -23,46 +23,17 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||
fake-outputs 1024x768+0+0,1024x768+1024+0
|
||||
EOT
|
||||
|
||||
my $i3 = i3(get_socket_path());
|
||||
|
||||
$i3->connect()->recv;
|
||||
|
||||
################################
|
||||
# Workspaces requests and events
|
||||
################################
|
||||
|
||||
my $old_ws = get_ws(focused_ws);
|
||||
|
||||
# Events
|
||||
|
||||
# We are switching to an empty workpspace on the output to the right from an empty workspace on the output on the left, so we expect
|
||||
# to receive "init", "focus", and "empty".
|
||||
my $focus = AnyEvent->condvar;
|
||||
$i3->subscribe({
|
||||
workspace => sub {
|
||||
my ($event) = @_;
|
||||
if ($event->{change} eq 'focus') {
|
||||
$focus->send($event);
|
||||
}
|
||||
}
|
||||
})->recv;
|
||||
|
||||
my $t;
|
||||
$t = AnyEvent->timer(
|
||||
after => 0.5,
|
||||
cb => sub {
|
||||
$focus->send(0);
|
||||
}
|
||||
);
|
||||
|
||||
cmd 'focus output right';
|
||||
|
||||
my $event = $focus->recv;
|
||||
my @events = events_for(
|
||||
sub { cmd 'focus output right' },
|
||||
'workspace');
|
||||
|
||||
my $current_ws = get_ws(focused_ws);
|
||||
|
||||
ok($event, 'Workspace "focus" event received');
|
||||
is($event->{current}->{id}, $current_ws->{id}, 'Event gave correct current workspace');
|
||||
is($event->{old}->{id}, $old_ws->{id}, 'Event gave correct old workspace');
|
||||
is(scalar @events, 1, 'Received 1 event');
|
||||
is($events[0]->{current}->{id}, $current_ws->{id}, 'Event gave correct current workspace');
|
||||
is($events[0]->{old}->{id}, $old_ws->{id}, 'Event gave correct old workspace');
|
||||
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user