]> git.sur5r.net Git - i3/i3/blob - testcases/t/31-stacking-order.t
Treat stacking containers as if they are in vertical orientation, add testcase
[i3/i3] / testcases / t / 31-stacking-order.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Check if stacking containers can be used independantly of
5 # the split mode (horizontal/vertical) of the underlying
6 # container.
7 #
8 use i3test tests => 7;
9 use Time::HiRes qw(sleep);
10
11 my $i3 = i3("/tmp/nestedcons");
12
13 my $tmp = get_unused_workspace();
14 $i3->command("workspace $tmp")->recv;
15
16 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
17
18 # Enforce vertical split mode
19 $i3->command('split v')->recv;
20
21 $i3->command('open')->recv;
22 my ($nodes, $focus) = get_ws_content($tmp);
23 my $first = $focus->[0];
24
25 $i3->command('open')->recv;
26 ($nodes, $focus) = get_ws_content($tmp);
27 my $second = $focus->[0];
28
29 isnt($first, $second, 'two different containers opened');
30
31 ##############################################################
32 # change mode to stacking and cycle through the containers
33 ##############################################################
34
35 $i3->command('layout stacking')->recv;
36 ($nodes, $focus) = get_ws_content($tmp);
37 is($focus->[0], $second, 'second container still focused');
38
39 $i3->command('next v')->recv;
40 ($nodes, $focus) = get_ws_content($tmp);
41 is($focus->[0], $first, 'first container focused');
42
43 $i3->command('prev v')->recv;
44 ($nodes, $focus) = get_ws_content($tmp);
45 is($focus->[0], $second, 'second container focused again');
46
47 ##############################################################
48 # now change the orientation to horizontal and cycle
49 ##############################################################
50
51 $i3->command('level up')->recv;
52 $i3->command('split h')->recv;
53 $i3->command('level down')->recv;
54
55 $i3->command('next v')->recv;
56 ($nodes, $focus) = get_ws_content($tmp);
57 is($focus->[0], $first, 'first container focused');
58
59 $i3->command('prev v')->recv;
60 ($nodes, $focus) = get_ws_content($tmp);
61 is($focus->[0], $second, 'second container focused again');
62
63
64 diag( "Testing i3, Perl $], $^X" );