]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/21-next-prev.t
tests: clean up/beautify all tests (code style / test style)
[i3/i3] / testcases / t / 21-next-prev.t
index 688a498483fcfcd158031ce440a1d59c18d504d8..042573a47dedee83b18a42284cb8a35aabc18078 100644 (file)
@@ -3,27 +3,23 @@
 #
 # Tests focus switching (next/prev)
 #
-use i3test tests => 14;
-use X11::XCB qw(:all);
+use i3test;
 
-my $i3 = i3("/tmp/nestedcons");
-
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
 
 ######################################################################
 # Open one container, verify that 'next v' and 'next h' do nothing
 ######################################################################
-$i3->command('open')->recv;
+cmd 'open';
 
 my ($nodes, $focus) = get_ws_content($tmp);
 my $old_focused = $focus->[0];
 
-$i3->command('next v')->recv;
+cmd 'next v';
 ($nodes, $focus) = get_ws_content($tmp);
 is($focus->[0], $old_focused, 'focus did not change with only one con');
 
-$i3->command('next h')->recv;
+cmd 'next h';
 ($nodes, $focus) = get_ws_content($tmp);
 is($focus->[0], $old_focused, 'focus did not change with only one con');
 
@@ -32,38 +28,38 @@ is($focus->[0], $old_focused, 'focus did not change with only one con');
 ######################################################################
 my $left = $old_focused;
 
-$i3->command('open')->recv;
+cmd 'open';
 ($nodes, $focus) = get_ws_content($tmp);
 isnt($old_focused, $focus->[0], 'new container is focused');
 my $mid = $focus->[0];
 
-$i3->command('open')->recv;
+cmd 'open';
 ($nodes, $focus) = get_ws_content($tmp);
 isnt($old_focused, $focus->[0], 'new container is focused');
 my $right = $focus->[0];
 
-$i3->command('next h')->recv;
+cmd 'next h';
 ($nodes, $focus) = get_ws_content($tmp);
 isnt($focus->[0], $right, 'focus did change');
 is($focus->[0], $left, 'left container focused (wrapping)');
 
-$i3->command('next h')->recv;
+cmd 'next h';
 ($nodes, $focus) = get_ws_content($tmp);
 is($focus->[0], $mid, 'middle container focused');
 
-$i3->command('next h')->recv;
+cmd 'next h';
 ($nodes, $focus) = get_ws_content($tmp);
 is($focus->[0], $right, 'right container focused');
 
-$i3->command('prev h')->recv;
+cmd 'prev h';
 ($nodes, $focus) = get_ws_content($tmp);
 is($focus->[0], $mid, 'middle container focused');
 
-$i3->command('prev h')->recv;
+cmd 'prev h';
 ($nodes, $focus) = get_ws_content($tmp);
 is($focus->[0], $left, 'left container focused');
 
-$i3->command('prev h')->recv;
+cmd 'prev h';
 ($nodes, $focus) = get_ws_content($tmp);
 is($focus->[0], $right, 'right container focused');
 
@@ -72,11 +68,11 @@ is($focus->[0], $right, 'right container focused');
 # Test synonyms (horizontal/vertical instead of h/v)
 ######################################################################
 
-$i3->command('prev horizontal')->recv;
+cmd 'prev horizontal';
 ($nodes, $focus) = get_ws_content($tmp);
 is($focus->[0], $mid, 'middle container focused');
 
-$i3->command('next horizontal')->recv;
+cmd 'next horizontal';
 ($nodes, $focus) = get_ws_content($tmp);
 is($focus->[0], $right, 'right container focused');
 
@@ -84,9 +80,9 @@ is($focus->[0], $right, 'right container focused');
 # Test focus command
 ######################################################################
 
-$i3->command(qq|[con_id="$mid"] focus|)->recv;
+cmd qq|[con_id="$mid"] focus|;
 ($nodes, $focus) = get_ws_content($tmp);
 is($focus->[0], $mid, 'middle container focused');
 
 
-diag( "Testing i3, Perl $], $^X" );
+done_testing;