]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/40-focus-lost.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 40-focus-lost.t
index 9b2db079ad8d84d161f4cac4dae46b3a375f79ed..fb77f01e83b75ebefb943da352e4cfde2af09162 100644 (file)
@@ -2,15 +2,14 @@
 # vim:ts=4:sw=4:expandtab
 # Regression: Check if the focus stays the same when switching the layout
 # bug introduced by 77d0d42ed2d7ac8cafe267c92b35a81c1b9491eb
-use i3test tests => 4;
+use i3test;
 use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
 
 BEGIN {
     use_ok('X11::XCB::Window');
 }
 
-my $i3 = i3("/tmp/nestedcons");
+my $i3 = i3(get_socket_path());
 my $x = X11::XCB::Connection->new;
 
 sub check_order {
@@ -23,24 +22,24 @@ sub check_order {
     cmp_deeply(\@nums, \@sorted, $msg);
 }
 
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
 
-my $left = open_standard_window($x);
-sleep 0.25;
-my $mid = open_standard_window($x);
-sleep 0.25;
-my $right = open_standard_window($x);
-sleep 0.25;
+my $left = open_window($x);
+my $mid = open_window($x);
+my $right = open_window($x);
+
+sync_with_i3($x);
 
 diag("left = " . $left->id . ", mid = " . $mid->id . ", right = " . $right->id);
 
 is($x->input_focus, $right->id, 'Right window focused');
 
-$i3->command('prev h')->recv;
+cmd 'focus left';
 
 is($x->input_focus, $mid->id, 'Mid window focused');
 
-$i3->command('layout stacked')->recv;
+cmd 'layout stacked';
 
 is($x->input_focus, $mid->id, 'Mid window focused');
+
+done_testing;