]> git.sur5r.net Git - i3/i3/blob - testcases/t/16-nestedcons.t
Implement dock mode, update testsuite
[i3/i3] / testcases / t / 16-nestedcons.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3
4 use i3test tests => 7;
5 use List::MoreUtils qw(all none);
6 use List::Util qw(first);
7
8 my $i3 = i3("/tmp/nestedcons");
9
10 ####################
11 # Request tree
12 ####################
13
14 my $tree = $i3->get_tree->recv;
15
16 my $expected = {
17     fullscreen_mode => 0,
18     nodes => ignore(),
19     window => undef,
20     name => 'root',
21     orientation => ignore(),
22     type => 0,
23     id => ignore(),
24     rect => ignore(),
25     window_rect => ignore(),
26     percent => 0,
27     layout => 0,
28     focus => ignore(),
29     focused => 0,
30     urgent => 0,
31     border => 0,
32     'floating_nodes' => ignore(),
33 };
34
35 cmp_deeply($tree, $expected, 'root node OK');
36
37 my @nodes = @{$tree->{nodes}};
38
39 ok(@nodes > 0, 'root node has at least one leaf');
40
41 ok((all { $_->{type} == 1 } @nodes), 'all nodes are of type CT_OUTPUT');
42 ok((none { defined($_->{window}) } @nodes), 'no CT_OUTPUT contains a window');
43 ok((all { @{$_->{nodes}} > 0 } @nodes), 'all nodes have at least one leaf (workspace)');
44 my @workspaces;
45 for my $ws (@nodes) {
46     my $content = first { $_->{type} == 2 } @{$ws->{nodes}};
47     @workspaces = (@workspaces, @{$content->{nodes}});
48 }
49
50 ok((all { $_->{type} == 4 } @workspaces), 'all workspaces are of type CT_WORKSPACE');
51 #ok((all { @{$_->{nodes}} == 0 } @workspaces), 'all workspaces are empty yet');
52 ok((none { defined($_->{window}) } @workspaces), 'no CT_OUTPUT contains a window');
53
54 # TODO: get the focused container
55
56 $i3->command('open')->recv;
57
58 # TODO: get the focused container, check if it changed.
59 # TODO: get the old focused container, check if there is a new child
60
61 #diag(Dumper(\@workspaces));
62
63 #diag(Dumper($tree));
64
65
66 diag( "Testing i3, Perl $], $^X" );