]> git.sur5r.net Git - i3/i3/commitdiff
t/525-i3bar-mouse-bindings: wait for i3bar to appear before testing
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 9 Jan 2016 11:47:00 +0000 (12:47 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 9 Jan 2016 11:47:00 +0000 (12:47 +0100)
Otherwise, this test is flaky when i3bar takes a while to start.

testcases/t/525-i3bar-mouse-bindings.t

index b76ccaf2a2f87745f98a2caa8d8589c5c1adab5f..39690291aedd0fbe1d02435c6ef6218ce3cdf94b 100644 (file)
@@ -54,13 +54,22 @@ $i3->subscribe({
             if ($event->{change} eq 'focus') {
                 $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;
 
+my $con = $cv->recv;
+ok($con, 'i3bar appeared');
+
 my $left = open_window;
 my $right = open_window;
 sync_with_i3;
-my $con = $cv->recv;
+$con = $cv->recv;
 is($con->{window}, $right->{id}, 'focus is initially on the right container');
 reset_test;