]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/525-i3bar-mouse-bindings.t
Merge branch 'next' into master
[i3/i3] / testcases / t / 525-i3bar-mouse-bindings.t
index 8755278508e0391563ee8f0ae96ab8db7ff12898..3593ea0b54cc70f72da6dc1b82336cd2dfe219cc 100644 (file)
@@ -100,11 +100,19 @@ sub focus_subtest {
     is_deeply(\@focus, $want, $msg);
 }
 
     is_deeply(\@focus, $want, $msg);
 }
 
+sub sync {
+    # Ensure XTEST events were sent to i3, which grabs and hence needs to
+    # forward any events to i3bar:
+    xtest_sync_with_i3;
+    # Ensure any pending i3bar IPC messages were handled by i3:
+    xtest_sync_with($i3bar_window);
+}
+
 subtest 'button 1 moves focus left', \&focus_subtest,
     sub {
        xtest_button_press(1, 3, 3);
        xtest_button_release(1, 3, 3);
 subtest 'button 1 moves focus left', \&focus_subtest,
     sub {
        xtest_button_press(1, 3, 3);
        xtest_button_release(1, 3, 3);
-       xtest_sync_with($i3bar_window);
+       sync;
     },
     [ $left->{id} ],
     'button 1 moves focus left';
     },
     [ $left->{id} ],
     'button 1 moves focus left';
@@ -113,7 +121,7 @@ subtest 'button 2 moves focus right', \&focus_subtest,
     sub {
        xtest_button_press(2, 3, 3);
        xtest_button_release(2, 3, 3);
     sub {
        xtest_button_press(2, 3, 3);
        xtest_button_release(2, 3, 3);
-       xtest_sync_with($i3bar_window);
+       sync;
     },
     [ $right->{id} ],
     'button 2 moves focus right';
     },
     [ $right->{id} ],
     'button 2 moves focus right';
@@ -122,7 +130,7 @@ subtest 'button 3 moves focus left', \&focus_subtest,
     sub {
        xtest_button_press(3, 3, 3);
        xtest_button_release(3, 3, 3);
     sub {
        xtest_button_press(3, 3, 3);
        xtest_button_release(3, 3, 3);
-       xtest_sync_with($i3bar_window);
+       sync;
     },
     [ $left->{id} ],
     'button 3 moves focus left';
     },
     [ $left->{id} ],
     'button 3 moves focus left';
@@ -131,7 +139,7 @@ subtest 'button 4 moves focus right', \&focus_subtest,
     sub {
        xtest_button_press(4, 3, 3);
        xtest_button_release(4, 3, 3);
     sub {
        xtest_button_press(4, 3, 3);
        xtest_button_release(4, 3, 3);
-       xtest_sync_with($i3bar_window);
+       sync;
     },
     [ $right->{id} ],
     'button 4 moves focus right';
     },
     [ $right->{id} ],
     'button 4 moves focus right';
@@ -140,7 +148,7 @@ subtest 'button 5 moves focus left', \&focus_subtest,
     sub {
        xtest_button_press(5, 3, 3);
        xtest_button_release(5, 3, 3);
     sub {
        xtest_button_press(5, 3, 3);
        xtest_button_release(5, 3, 3);
-       xtest_sync_with($i3bar_window);
+       sync;
     },
     [ $left->{id} ],
     'button 5 moves focus left';
     },
     [ $left->{id} ],
     'button 5 moves focus left';
@@ -152,7 +160,7 @@ my $old_focus = get_focused($ws);
 subtest 'button 6 does not move focus while pressed', \&focus_subtest,
     sub {
         xtest_button_press(6, 3, 3);
 subtest 'button 6 does not move focus while pressed', \&focus_subtest,
     sub {
         xtest_button_press(6, 3, 3);
-        xtest_sync_with($i3bar_window);
+        sync;
     },
     [],
     'button 6 does not move focus while pressed';
     },
     [],
     'button 6 does not move focus while pressed';
@@ -161,7 +169,7 @@ is(get_focused($ws), $old_focus, 'focus unchanged');
 subtest 'button 6 release moves focus right', \&focus_subtest,
     sub {
         xtest_button_release(6, 3, 3);
 subtest 'button 6 release moves focus right', \&focus_subtest,
     sub {
         xtest_button_release(6, 3, 3);
-        xtest_sync_with($i3bar_window);
+        sync;
     },
     [ $right->{id} ],
     'button 6 release moves focus right';
     },
     [ $right->{id} ],
     'button 6 release moves focus right';
@@ -171,7 +179,7 @@ subtest 'button 6 release moves focus right', \&focus_subtest,
 subtest 'button 7 press moves focus left', \&focus_subtest,
     sub {
         xtest_button_press(7, 3, 3);
 subtest 'button 7 press moves focus left', \&focus_subtest,
     sub {
         xtest_button_press(7, 3, 3);
-        xtest_sync_with($i3bar_window);
+        sync;
     },
     [ $left->{id} ],
     'button 7 press moves focus left';
     },
     [ $left->{id} ],
     'button 7 press moves focus left';
@@ -179,7 +187,7 @@ subtest 'button 7 press moves focus left', \&focus_subtest,
 subtest 'button 7 release moves focus right', \&focus_subtest,
     sub {
         xtest_button_release(7, 3, 3);
 subtest 'button 7 release moves focus right', \&focus_subtest,
     sub {
         xtest_button_release(7, 3, 3);
-        xtest_sync_with($i3bar_window);
+        sync;
     },
     [ $right->{id} ],
     'button 7 release moves focus right';
     },
     [ $right->{id} ],
     'button 7 release moves focus right';