2010-07-17 00:54:47 +02:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
|
|
|
# Check if empty split containers are automatically closed.
|
|
|
|
#
|
2011-03-09 20:25:17 +01:00
|
|
|
use i3test;
|
2010-07-17 00:54:47 +02:00
|
|
|
|
2011-07-25 13:35:56 +02:00
|
|
|
my $i3 = i3(get_socket_path());
|
2010-07-17 00:54:47 +02:00
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
my $tmp = fresh_workspace;
|
2010-07-17 00:54:47 +02:00
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
2010-07-17 15:52:22 +02:00
|
|
|
my $first = open_empty_con($i3);
|
2010-11-28 21:49:42 +01:00
|
|
|
my $second = open_empty_con($i3);
|
2011-03-09 20:25:17 +01:00
|
|
|
cmd qq|[con_id="$first"] focus|;
|
2010-07-17 00:54:47 +02:00
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
cmd 'split v';
|
2010-07-17 00:54:47 +02:00
|
|
|
|
2011-11-21 21:04:00 +01:00
|
|
|
my ($nodes, $focus) = get_ws_content($tmp);
|
2010-07-17 00:54:47 +02:00
|
|
|
|
|
|
|
is($nodes->[0]->{focused}, 0, 'split container not focused');
|
|
|
|
|
|
|
|
# focus the split container
|
2012-05-27 06:44:29 +02:00
|
|
|
cmd 'focus parent';
|
2010-07-17 00:54:47 +02:00
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
my $split = $focus->[0];
|
2012-05-27 06:44:29 +02:00
|
|
|
cmd 'focus child';
|
2010-07-17 00:54:47 +02:00
|
|
|
|
2011-11-21 21:04:00 +01:00
|
|
|
$second = open_empty_con($i3);
|
2010-07-17 00:54:47 +02:00
|
|
|
|
|
|
|
isnt($first, $second, 'different container focused');
|
|
|
|
|
|
|
|
##############################################################
|
|
|
|
# close both windows and see if the split container still exists
|
|
|
|
##############################################################
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
cmd 'kill';
|
|
|
|
cmd 'kill';
|
2010-07-17 00:54:47 +02:00
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
isnt($nodes->[0]->{id}, $split, 'split container closed');
|
|
|
|
|
2011-01-20 10:09:43 +01:00
|
|
|
##############################################################
|
|
|
|
# same thing but this time we are moving the cons away instead
|
|
|
|
# of killing them
|
|
|
|
##############################################################
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
$tmp = fresh_workspace;
|
2011-01-20 10:09:43 +01:00
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
|
|
|
$first = open_empty_con($i3);
|
|
|
|
$second = open_empty_con($i3);
|
2011-03-09 20:25:17 +01:00
|
|
|
cmd qq|[con_id="$first"] focus|;
|
2011-01-20 10:09:43 +01:00
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
cmd 'split v';
|
2011-01-20 10:09:43 +01:00
|
|
|
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
|
|
|
|
is($nodes->[0]->{focused}, 0, 'split container not focused');
|
|
|
|
|
|
|
|
# focus the split container
|
2012-05-27 06:44:29 +02:00
|
|
|
cmd 'focus parent';
|
2011-01-20 10:09:43 +01:00
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
2011-11-21 21:04:00 +01:00
|
|
|
$split = $focus->[0];
|
2012-05-27 06:44:29 +02:00
|
|
|
cmd 'focus child';
|
2011-01-20 10:09:43 +01:00
|
|
|
|
2011-11-21 21:04:00 +01:00
|
|
|
$second = open_empty_con($i3);
|
2011-01-20 10:09:43 +01:00
|
|
|
|
|
|
|
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 20:25:17 +01:00
|
|
|
cmd "move workspace $otmp";
|
|
|
|
cmd "move workspace $otmp";
|
2011-01-20 10:09:43 +01:00
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
isnt($nodes->[0]->{id}, $split, 'split container closed');
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
done_testing;
|