tests: clean up/beautify all tests (code style / test style)

This commit is contained in:
Michael Stapelberg
2011-03-09 20:25:17 +01:00
parent 57e7cc8f6a
commit 2524b5262d
53 changed files with 334 additions and 415 deletions

View File

@ -3,31 +3,29 @@
#
# Check if empty split containers are automatically closed.
#
use i3test tests => 8;
use Time::HiRes qw(sleep);
use i3test;
my $i3 = i3("/tmp/nestedcons");
my $tmp = get_unused_workspace();
$i3->command("workspace $tmp")->recv;
my $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
my $first = open_empty_con($i3);
my $second = open_empty_con($i3);
$i3->command(qq|[con_id="$first"] focus|)->recv;
cmd qq|[con_id="$first"] focus|;
$i3->command('split v')->recv;
cmd 'split v';
($nodes, $focus) = get_ws_content($tmp);
is($nodes->[0]->{focused}, 0, 'split container not focused');
# focus the split container
$i3->command('level up')->recv;
cmd 'level up';
($nodes, $focus) = get_ws_content($tmp);
my $split = $focus->[0];
$i3->command('level down')->recv;
cmd 'level down';
my $second = open_empty_con($i3);
@ -37,8 +35,8 @@ isnt($first, $second, 'different container focused');
# close both windows and see if the split container still exists
##############################################################
$i3->command('kill')->recv;
$i3->command('kill')->recv;
cmd 'kill';
cmd 'kill';
($nodes, $focus) = get_ws_content($tmp);
isnt($nodes->[0]->{id}, $split, 'split container closed');
@ -47,26 +45,25 @@ isnt($nodes->[0]->{id}, $split, 'split container closed');
# of killing them
##############################################################
$tmp = get_unused_workspace();
$i3->command("workspace $tmp")->recv;
$tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
$first = open_empty_con($i3);
$second = open_empty_con($i3);
$i3->command(qq|[con_id="$first"] focus|)->recv;
cmd qq|[con_id="$first"] focus|;
$i3->command('split v')->recv;
cmd 'split v';
($nodes, $focus) = get_ws_content($tmp);
is($nodes->[0]->{focused}, 0, 'split container not focused');
# focus the split container
$i3->command('level up')->recv;
cmd 'level up';
($nodes, $focus) = get_ws_content($tmp);
my $split = $focus->[0];
$i3->command('level down')->recv;
cmd 'level down';
my $second = open_empty_con($i3);
@ -77,9 +74,9 @@ isnt($first, $second, 'different container focused');
##############################################################
my $otmp = get_unused_workspace();
$i3->command("move workspace $otmp")->recv;
$i3->command("move workspace $otmp")->recv;
cmd "move workspace $otmp";
cmd "move workspace $otmp";
($nodes, $focus) = get_ws_content($tmp);
isnt($nodes->[0]->{id}, $split, 'split container closed');
diag( "Testing i3, Perl $], $^X" );
done_testing;