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 new containers are opened after the currently focused one instead
18 # of always at the end
19 use List::Util qw(first);
22 my $i3 = i3(get_socket_path());
24 my $tmp = fresh_workspace;
26 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
28 # Open two new container
29 my $first = open_empty_con($i3);
31 ok(@{get_ws_content($tmp)} == 1, 'containers opened');
33 my $second = open_empty_con($i3);
35 isnt($first, $second, 'different container focused');
37 ##############################################################
38 # see if new containers open after the currently focused
39 ##############################################################
41 cmd qq|[con_id="$first"] focus|;
43 my $content = get_ws_content($tmp);
44 ok(@{$content} == 3, 'three containers opened');
46 is($content->[0]->{id}, $first, 'first container unmodified');
47 isnt($content->[1]->{id}, $second, 'second container replaced');
48 is($content->[2]->{id}, $second, 'third container unmodified');