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;
20 orientation => ignore(),
28 'floating-nodes' => ignore(),
31 cmp_deeply($tree, $expected, 'root node OK');
33 my @nodes = @{$tree->{nodes}};
35 ok(@nodes > 0, 'root node has at least one leaf');
37 ok((all { $_->{type} == 1 } @nodes), 'all nodes are of type CT_OUTPUT');
38 ok((none { defined($_->{window}) } @nodes), 'no CT_OUTPUT contains a window');
39 ok((all { @{$_->{nodes}} > 0 } @nodes), 'all nodes have at least one leaf (workspace)');
41 for my $ws (map { @{$_->{nodes}} } @nodes) {
42 push @workspaces, $ws;
45 ok((all { $_->{type} == 4 } @workspaces), 'all workspaces are of type CT_WORKSPACE');
46 #ok((all { @{$_->{nodes}} == 0 } @workspaces), 'all workspaces are empty yet');
47 ok((none { defined($_->{window}) } @workspaces), 'no CT_OUTPUT contains a window');
49 # TODO: get the focused container
51 $i3->command('open')->recv;
53 # TODO: get the focused container, check if it changed.
54 # TODO: get the old focused container, check if there is a new child
56 #diag(Dumper(\@workspaces));
61 diag( "Testing i3, Perl $], $^X" );