2 # vim:ts=4:sw=4:expandtab
4 # Check if empty split containers are automatically closed.
7 use Time::HiRes qw(sleep);
9 my $i3 = i3("/tmp/nestedcons");
11 my $tmp = get_unused_workspace();
12 $i3->command("workspace $tmp")->recv;
14 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
16 $i3->command('open')->recv;
17 my ($nodes, $focus) = get_ws_content($tmp);
18 my $first = $focus->[0];
20 $i3->command('split v')->recv;
22 ($nodes, $focus) = get_ws_content($tmp);
24 is($nodes->[0]->{focused}, 0, 'split container not focused');
26 # focus the split container
27 $i3->command('level up')->recv;
28 ($nodes, $focus) = get_ws_content($tmp);
29 my $split = $focus->[0];
30 $i3->command('level down')->recv;
32 $i3->command('open')->recv;
34 ($nodes, $focus) = get_ws_content($tmp);
35 my $second = $focus->[0];
37 isnt($first, $second, 'different container focused');
39 ##############################################################
40 # close both windows and see if the split container still exists
41 ##############################################################
43 $i3->command('kill')->recv;
44 $i3->command('kill')->recv;
45 ($nodes, $focus) = get_ws_content($tmp);
46 isnt($nodes->[0]->{id}, $split, 'split container closed');
48 diag( "Testing i3, Perl $], $^X" );