2010-07-16 18:54:47 -04:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
|
|
|
# Check if empty split containers are automatically closed.
|
|
|
|
#
|
2011-01-20 04:09:43 -05:00
|
|
|
use i3test tests => 8;
|
2010-07-16 18:54:47 -04:00
|
|
|
use Time::HiRes qw(sleep);
|
|
|
|
|
|
|
|
my $i3 = i3("/tmp/nestedcons");
|
|
|
|
|
|
|
|
my $tmp = get_unused_workspace();
|
|
|
|
$i3->command("workspace $tmp")->recv;
|
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
2010-07-17 09:52:22 -04:00
|
|
|
my $first = open_empty_con($i3);
|
2010-11-28 15:49:42 -05:00
|
|
|
my $second = open_empty_con($i3);
|
|
|
|
$i3->command(qq|[con_id="$first"] focus|)->recv;
|
2010-07-16 18:54:47 -04:00
|
|
|
|
|
|
|
$i3->command('split v')->recv;
|
|
|
|
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
|
|
|
|
is($nodes->[0]->{focused}, 0, 'split container not focused');
|
|
|
|
|
|
|
|
# focus the split container
|
|
|
|
$i3->command('level up')->recv;
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
my $split = $focus->[0];
|
|
|
|
$i3->command('level down')->recv;
|
|
|
|
|
2010-07-17 09:52:22 -04:00
|
|
|
my $second = open_empty_con($i3);
|
2010-07-16 18:54:47 -04:00
|
|
|
|
|
|
|
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;
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
isnt($nodes->[0]->{id}, $split, 'split container closed');
|
|
|
|
|
2011-01-20 04:09:43 -05:00
|
|
|
##############################################################
|
|
|
|
# same thing but this time we are moving the cons away instead
|
|
|
|
# of killing them
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
$tmp = get_unused_workspace();
|
|
|
|
$i3->command("workspace $tmp")->recv;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
$i3->command('split v')->recv;
|
|
|
|
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
|
|
|
|
is($nodes->[0]->{focused}, 0, 'split container not focused');
|
|
|
|
|
|
|
|
# focus the split container
|
|
|
|
$i3->command('level up')->recv;
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
my $split = $focus->[0];
|
|
|
|
$i3->command('level down')->recv;
|
|
|
|
|
|
|
|
my $second = open_empty_con($i3);
|
|
|
|
|
|
|
|
isnt($first, $second, 'different container focused');
|
|
|
|
|
|
|
|
##############################################################
|
|
|
|
# close both windows and see if the split container still exists
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
my $otmp = get_unused_workspace();
|
|
|
|
$i3->command("move workspace $otmp")->recv;
|
|
|
|
$i3->command("move workspace $otmp")->recv;
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
isnt($nodes->[0]->{id}, $split, 'split container closed');
|
|
|
|
|
2010-07-16 18:54:47 -04:00
|
|
|
diag( "Testing i3, Perl $], $^X" );
|