]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/135-floating-focus.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 135-floating-focus.t
index 5e5a68f23c3389e474eb9b7a7f396d1b41e80e7d..c7218130166f082f22a8dcd2a991df3fcc000fc7 100644 (file)
@@ -2,10 +2,6 @@
 # vim:ts=4:sw=4:expandtab
 
 use i3test;
-use X11::XCB qw(:all);
-use X11::XCB::Connection;
-
-my $x = X11::XCB::Connection->new;
 
 my $tmp = fresh_workspace;
 
@@ -13,8 +9,8 @@ my $tmp = fresh_workspace;
 # 1: see if focus stays the same when toggling tiling/floating mode
 #############################################################################
 
-my $first = open_window($x);
-my $second = open_window($x);
+my $first = open_window;
+my $second = open_window;
 
 is($x->input_focus, $second->id, 'second window focused');
 
@@ -30,9 +26,9 @@ is($x->input_focus, $second->id, 'second window still focused after mode toggle'
 
 $tmp = fresh_workspace;
 
-$first = open_window($x);    # window 2
-$second = open_window($x);   # window 3
-my $third = open_window($x); # window 4
+$first = open_window;    # window 2
+$second = open_window;   # window 3
+my $third = open_window; # window 4
 
 is($x->input_focus, $third->id, 'last container focused');
 
@@ -40,8 +36,6 @@ cmd 'floating enable';
 
 cmd '[id="' . $second->id . '"] focus';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second con focused');
 
 cmd 'floating enable';
@@ -49,7 +43,7 @@ cmd 'floating enable';
 # now kill the third one (it's floating). focus should stay unchanged
 cmd '[id="' . $third->id . '"] kill';
 
-wait_for_unmap($x);
+wait_for_unmap($third);
 
 is($x->input_focus, $second->id, 'second con still focused after killing third');
 
@@ -61,9 +55,9 @@ is($x->input_focus, $second->id, 'second con still focused after killing third')
 
 $tmp = fresh_workspace;
 
-$first = open_window($x, { background_color => '#ff0000' });    # window 5
-$second = open_window($x, { background_color => '#00ff00' });   # window 6
-$third = open_window($x, { background_color => '#0000ff' }); # window 7
+$first = open_window({ background_color => '#ff0000' });    # window 5
+$second = open_window({ background_color => '#00ff00' });   # window 6
+$third = open_window({ background_color => '#0000ff' }); # window 7
 
 is($x->input_focus, $third->id, 'last container focused');
 
@@ -71,8 +65,6 @@ cmd 'floating enable';
 
 cmd '[id="' . $second->id . '"] focus';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second con focused');
 
 cmd 'floating enable';
@@ -80,12 +72,12 @@ cmd 'floating enable';
 # now kill the second one. focus should fall back to the third one, which is
 # also floating
 cmd 'kill';
-wait_for_unmap($x);
+wait_for_unmap($second);
 
 is($x->input_focus, $third->id, 'third con focused');
 
 cmd 'kill';
-wait_for_unmap($x);
+wait_for_unmap($third);
 
 is($x->input_focus, $first->id, 'first con focused after killing all floating cons');
 
@@ -95,11 +87,11 @@ is($x->input_focus, $first->id, 'first con focused after killing all floating co
 
 $tmp = fresh_workspace;
 
-$first = open_window($x, { background_color => '#ff0000' });    # window 5
+$first = open_window({ background_color => '#ff0000' });    # window 5
 cmd 'split v';
 cmd 'layout stacked';
-$second = open_window($x, { background_color => '#00ff00' });   # window 6
-$third = open_window($x, { background_color => '#0000ff' }); # window 7
+$second = open_window({ background_color => '#00ff00' });   # window 6
+$third = open_window({ background_color => '#0000ff' }); # window 7
 
 is($x->input_focus, $third->id, 'last container focused');
 
@@ -107,23 +99,21 @@ cmd 'floating enable';
 
 cmd '[id="' . $second->id . '"] focus';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second con focused');
 
 cmd 'floating enable';
 
-sync_with_i3($x);
+sync_with_i3;
 
 # now kill the second one. focus should fall back to the third one, which is
 # also floating
 cmd 'kill';
-wait_for_unmap($x);
+wait_for_unmap($second);
 
 is($x->input_focus, $third->id, 'third con focused');
 
 cmd 'kill';
-wait_for_unmap($x);
+wait_for_unmap($third);
 
 is($x->input_focus, $first->id, 'first con focused after killing all floating cons');
 
@@ -133,10 +123,8 @@ is($x->input_focus, $first->id, 'first con focused after killing all floating co
 
 $tmp = fresh_workspace;
 
-$first = open_window($x, { background_color => '#ff0000' });    # window 8
-$second = open_window($x, { background_color => '#00ff00' });   # window 9
-
-sync_with_i3($x);
+$first = open_window({ background_color => '#ff0000' });    # window 8
+$second = open_window({ background_color => '#00ff00' });   # window 9
 
 is($x->input_focus, $second->id, 'second container focused');
 
@@ -146,32 +134,22 @@ is($x->input_focus, $second->id, 'second container focused');
 
 cmd 'focus tiling';
 
-sync_with_i3($x);
-
 is($x->input_focus, $first->id, 'first (tiling) container focused');
 
 cmd 'focus floating';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second (floating) container focused');
 
 cmd 'focus floating';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second (floating) container still focused');
 
 cmd 'focus mode_toggle';
 
-sync_with_i3($x);
-
 is($x->input_focus, $first->id, 'first (tiling) container focused');
 
 cmd 'focus mode_toggle';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second (floating) container focused');
 
 #############################################################################
@@ -180,42 +158,30 @@ is($x->input_focus, $second->id, 'second (floating) container focused');
 
 $tmp = fresh_workspace;
 
-$first = open_floating_window($x, { background_color => '#ff0000' });# window 10
-$second = open_floating_window($x, { background_color => '#00ff00' }); # window 11
-$third = open_floating_window($x, { background_color => '#0000ff' }); # window 12
-
-sync_with_i3($x);
+$first = open_floating_window({ background_color => '#ff0000' });# window 10
+$second = open_floating_window({ background_color => '#00ff00' }); # window 11
+$third = open_floating_window({ background_color => '#0000ff' }); # window 12
 
 is($x->input_focus, $third->id, 'third container focused');
 
 cmd 'focus left';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second container focused');
 
 cmd 'focus left';
 
-sync_with_i3($x);
-
 is($x->input_focus, $first->id, 'first container focused');
 
 cmd 'focus left';
 
-sync_with_i3($x);
-
 is($x->input_focus, $third->id, 'focus wrapped to third container');
 
 cmd 'focus right';
 
-sync_with_i3($x);
-
 is($x->input_focus, $first->id, 'focus wrapped to first container');
 
 cmd 'focus right';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'focus on second container');
 
 done_testing;