2 # vim:ts=4:sw=4:expandtab
4 # Check if empty split containers are automatically closed.
8 my $i3 = i3(get_socket_path());
10 my $tmp = fresh_workspace;
12 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
14 my $first = open_empty_con($i3);
15 my $second = open_empty_con($i3);
16 cmd qq|[con_id="$first"] focus|;
20 ($nodes, $focus) = get_ws_content($tmp);
22 is($nodes->[0]->{focused}, 0, 'split container not focused');
24 # focus the split container
26 ($nodes, $focus) = get_ws_content($tmp);
27 my $split = $focus->[0];
30 my $second = open_empty_con($i3);
32 isnt($first, $second, 'different container focused');
34 ##############################################################
35 # close both windows and see if the split container still exists
36 ##############################################################
40 ($nodes, $focus) = get_ws_content($tmp);
41 isnt($nodes->[0]->{id}, $split, 'split container closed');
43 ##############################################################
44 # same thing but this time we are moving the cons away instead
46 ##############################################################
48 $tmp = fresh_workspace;
50 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
52 $first = open_empty_con($i3);
53 $second = open_empty_con($i3);
54 cmd qq|[con_id="$first"] focus|;
58 ($nodes, $focus) = get_ws_content($tmp);
60 is($nodes->[0]->{focused}, 0, 'split container not focused');
62 # focus the split container
64 ($nodes, $focus) = get_ws_content($tmp);
65 my $split = $focus->[0];
68 my $second = open_empty_con($i3);
70 isnt($first, $second, 'different container focused');
72 ##############################################################
73 # close both windows and see if the split container still exists
74 ##############################################################
76 my $otmp = get_unused_workspace();
77 cmd "move workspace $otmp";
78 cmd "move workspace $otmp";
79 ($nodes, $focus) = get_ws_content($tmp);
80 isnt($nodes->[0]->{id}, $split, 'split container closed');