2010-07-16 18:54:47 -04:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
|
|
|
# Check if empty split containers are automatically closed.
|
|
|
|
#
|
2011-03-09 14:25:17 -05:00
|
|
|
use i3test;
|
2010-07-16 18:54:47 -04:00
|
|
|
|
|
|
|
my $i3 = i3("/tmp/nestedcons");
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
my $tmp = fresh_workspace;
|
2010-07-16 18:54:47 -04:00
|
|
|
|
|
|
|
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);
|
2011-03-09 14:25:17 -05:00
|
|
|
cmd qq|[con_id="$first"] focus|;
|
2010-07-16 18:54:47 -04:00
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
cmd 'split v';
|
2010-07-16 18:54:47 -04:00
|
|
|
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
|
|
|
|
is($nodes->[0]->{focused}, 0, 'split container not focused');
|
|
|
|
|
|
|
|
# focus the split container
|
2011-03-09 14:25:17 -05:00
|
|
|
cmd 'level up';
|
2010-07-16 18:54:47 -04:00
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
my $split = $focus->[0];
|
2011-03-09 14:25:17 -05:00
|
|
|
cmd 'level down';
|
2010-07-16 18:54:47 -04:00
|
|
|
|
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
|
|
|
|
##############################################################
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
cmd 'kill';
|
|
|
|
cmd 'kill';
|
2010-07-16 18:54:47 -04:00
|
|
|
($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
|
|
|
|
##############################################################
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
$tmp = fresh_workspace;
|
2011-01-20 04:09:43 -05:00
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
|
|
|
$first = open_empty_con($i3);
|
|
|
|
$second = open_empty_con($i3);
|
2011-03-09 14:25:17 -05:00
|
|
|
cmd qq|[con_id="$first"] focus|;
|
2011-01-20 04:09:43 -05:00
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
cmd 'split v';
|
2011-01-20 04:09:43 -05:00
|
|
|
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
|
|
|
|
is($nodes->[0]->{focused}, 0, 'split container not focused');
|
|
|
|
|
|
|
|
# focus the split container
|
2011-03-09 14:25:17 -05:00
|
|
|
cmd 'level up';
|
2011-01-20 04:09:43 -05:00
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
my $split = $focus->[0];
|
2011-03-09 14:25:17 -05:00
|
|
|
cmd 'level down';
|
2011-01-20 04:09:43 -05:00
|
|
|
|
|
|
|
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();
|
2011-03-09 14:25:17 -05:00
|
|
|
cmd "move workspace $otmp";
|
|
|
|
cmd "move workspace $otmp";
|
2011-01-20 04:09:43 -05:00
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
isnt($nodes->[0]->{id}, $split, 'split container closed');
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
done_testing;
|