t/525-i3bar-mouse-bindings: wait for i3bar to appear before testing

Otherwise, this test is flaky when i3bar takes a while to start.
This commit is contained in:
Michael Stapelberg 2016-01-09 12:47:00 +01:00
parent f3a5796a8b
commit 338cb693dc
1 changed files with 10 additions and 1 deletions

View File

@ -54,13 +54,22 @@ $i3->subscribe({
if ($event->{change} eq 'focus') { if ($event->{change} eq 'focus') {
$cv->send($event->{container}); $cv->send($event->{container});
} }
if ($event->{change} eq 'new') {
if (defined($event->{container}->{window_properties}->{class}) &&
$event->{container}->{window_properties}->{class} eq 'i3bar') {
$cv->send($event->{container});
}
}
}, },
})->recv; })->recv;
my $con = $cv->recv;
ok($con, 'i3bar appeared');
my $left = open_window; my $left = open_window;
my $right = open_window; my $right = open_window;
sync_with_i3; sync_with_i3;
my $con = $cv->recv; $con = $cv->recv;
is($con->{window}, $right->{id}, 'focus is initially on the right container'); is($con->{window}, $right->{id}, 'focus is initially on the right container');
reset_test; reset_test;