2 # vim:ts=4:sw=4:expandtab
5 use List::MoreUtils qw(all none);
7 my $i3 = i3("/tmp/nestedcons");
13 my $tree = $i3->get_workspaces->recv;
15 # 'fullscreen_mode' => 0,
18 # 'fullscreen_mode' => 0,
21 # 'fullscreen_mode' => 0,
46 orientation => ignore(),
54 cmp_deeply($tree, $expected, 'root node OK');
56 my @nodes = @{$tree->{nodes}};
58 ok(@nodes > 0, 'root node has at least one leaf');
60 ok((all { $_->{type} == 1 } @nodes), 'all nodes are of type CT_OUTPUT');
61 ok((none { defined($_->{window}) } @nodes), 'no CT_OUTPUT contains a window');
62 ok((all { @{$_->{nodes}} > 0 } @nodes), 'all nodes have at least one leaf (workspace)');
64 for my $ws (map { @{$_->{nodes}} } @nodes) {
65 push @workspaces, $ws;
68 ok((all { $_->{type} == 2 } @workspaces), 'all workspaces are of type CT_CON');
69 ok((all { @{$_->{nodes}} == 0 } @workspaces), 'all workspaces are empty yet');
70 ok((none { defined($_->{window}) } @workspaces), 'no CT_OUTPUT contains a window');
72 # TODO: get the focused container
74 $i3->command('open')->recv;
76 # TODO: get the focused container, check if it changed.
77 # TODO: get the old focused container, check if there is a new child
79 diag(Dumper(\@workspaces));
84 diag( "Testing i3, Perl $], $^X" );