2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Check if empty split containers are automatically closed.
21 my $i3 = i3(get_socket_path());
23 my $tmp = fresh_workspace;
25 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
27 my $first = open_empty_con($i3);
28 my $second = open_empty_con($i3);
29 cmd qq|[con_id="$first"] focus|;
33 my ($nodes, $focus) = get_ws_content($tmp);
35 is($nodes->[0]->{focused}, 0, 'split container not focused');
37 # focus the split container
39 ($nodes, $focus) = get_ws_content($tmp);
40 my $split = $focus->[0];
43 $second = open_empty_con($i3);
45 isnt($first, $second, 'different container focused');
47 ##############################################################
48 # close both windows and see if the split container still exists
49 ##############################################################
53 ($nodes, $focus) = get_ws_content($tmp);
54 isnt($nodes->[0]->{id}, $split, 'split container closed');
56 ##############################################################
57 # same thing but this time we are moving the cons away instead
59 ##############################################################
61 $tmp = fresh_workspace;
63 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
65 $first = open_empty_con($i3);
66 $second = open_empty_con($i3);
67 cmd qq|[con_id="$first"] focus|;
71 ($nodes, $focus) = get_ws_content($tmp);
73 is($nodes->[0]->{focused}, 0, 'split container not focused');
75 # focus the split container
77 ($nodes, $focus) = get_ws_content($tmp);
81 $second = open_empty_con($i3);
83 isnt($first, $second, 'different container focused');
85 ##############################################################
86 # close both windows and see if the split container still exists
87 ##############################################################
89 my $otmp = get_unused_workspace();
90 cmd "move workspace $otmp";
91 cmd "move workspace $otmp";
92 ($nodes, $focus) = get_ws_content($tmp);
93 isnt($nodes->[0]->{id}, $split, 'split container closed');