2 # vim:ts=4:sw=4:expandtab
4 # Check if stacking containers can be used independantly of
5 # the split mode (horizontal/vertical) of the underlying
9 use Time::HiRes qw(sleep);
11 my $i3 = i3("/tmp/nestedcons");
13 my $tmp = get_unused_workspace();
14 $i3->command("workspace $tmp")->recv;
16 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
18 # Enforce vertical split mode
19 $i3->command('split v')->recv;
21 $i3->command('open')->recv;
22 my ($nodes, $focus) = get_ws_content($tmp);
23 my $first = $focus->[0];
25 $i3->command('open')->recv;
26 ($nodes, $focus) = get_ws_content($tmp);
27 my $second = $focus->[0];
29 isnt($first, $second, 'two different containers opened');
31 ##############################################################
32 # change mode to stacking and cycle through the containers
33 ##############################################################
35 $i3->command('layout stacking')->recv;
36 ($nodes, $focus) = get_ws_content($tmp);
37 is($focus->[0], $second, 'second container still focused');
39 $i3->command('next v')->recv;
40 ($nodes, $focus) = get_ws_content($tmp);
41 is($focus->[0], $first, 'first container focused');
43 $i3->command('prev v')->recv;
44 ($nodes, $focus) = get_ws_content($tmp);
45 is($focus->[0], $second, 'second container focused again');
47 ##############################################################
48 # now change the orientation to horizontal and cycle
49 ##############################################################
51 $i3->command('level up')->recv;
52 $i3->command('split h')->recv;
53 $i3->command('level down')->recv;
55 $i3->command('next v')->recv;
56 ($nodes, $focus) = get_ws_content($tmp);
57 is($focus->[0], $first, 'first container focused');
59 $i3->command('prev v')->recv;
60 ($nodes, $focus) = get_ws_content($tmp);
61 is($focus->[0], $second, 'second container focused again');
64 diag( "Testing i3, Perl $], $^X" );