]> git.sur5r.net Git - i3/i3/blob - testcases/t/30-close-empty-split.t
close empty parent containers, add testcase
[i3/i3] / testcases / t / 30-close-empty-split.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Check if empty split containers are automatically closed.
5 #
6 use i3test tests => 4;
7 use Time::HiRes qw(sleep);
8
9 my $i3 = i3("/tmp/nestedcons");
10
11 my $tmp = get_unused_workspace();
12 $i3->command("workspace $tmp")->recv;
13
14 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
15
16 $i3->command('open')->recv;
17 my ($nodes, $focus) = get_ws_content($tmp);
18 my $first = $focus->[0];
19
20 $i3->command('split v')->recv;
21
22 ($nodes, $focus) = get_ws_content($tmp);
23
24 is($nodes->[0]->{focused}, 0, 'split container not focused');
25
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;
31
32 $i3->command('open')->recv;
33
34 ($nodes, $focus) = get_ws_content($tmp);
35 my $second = $focus->[0];
36
37 isnt($first, $second, 'different container focused');
38
39 ##############################################################
40 # close both windows and see if the split container still exists
41 ##############################################################
42
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');
47
48 diag( "Testing i3, Perl $], $^X" );