2010-03-27 15:25:51 +01:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
|
2010-06-02 23:53:22 +02:00
|
|
|
use i3test tests => 7;
|
2010-03-27 15:25:51 +01:00
|
|
|
use List::MoreUtils qw(all none);
|
|
|
|
|
|
|
|
my $i3 = i3("/tmp/nestedcons");
|
|
|
|
|
|
|
|
####################
|
|
|
|
# Request tree
|
|
|
|
####################
|
|
|
|
|
2010-11-21 21:42:28 +01:00
|
|
|
my $tree = $i3->get_tree->recv;
|
2010-03-27 15:25:51 +01:00
|
|
|
|
|
|
|
my $expected = {
|
|
|
|
fullscreen_mode => 0,
|
|
|
|
nodes => ignore(),
|
|
|
|
window => undef,
|
|
|
|
name => 'root',
|
|
|
|
orientation => ignore(),
|
|
|
|
type => 0,
|
|
|
|
id => ignore(),
|
2010-04-16 21:01:08 +02:00
|
|
|
rect => ignore(),
|
2010-11-28 17:29:44 +01:00
|
|
|
window_rect => ignore(),
|
2010-04-16 21:01:08 +02:00
|
|
|
layout => 0,
|
|
|
|
focus => ignore(),
|
2010-08-20 21:38:07 +02:00
|
|
|
focused => 0,
|
2010-06-02 23:53:22 +02:00
|
|
|
urgent => 0,
|
2010-11-13 14:33:58 +01:00
|
|
|
border => 0,
|
2010-11-21 16:34:45 +01:00
|
|
|
'floating_nodes' => ignore(),
|
2010-03-27 15:25:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
cmp_deeply($tree, $expected, 'root node OK');
|
|
|
|
|
|
|
|
my @nodes = @{$tree->{nodes}};
|
|
|
|
|
|
|
|
ok(@nodes > 0, 'root node has at least one leaf');
|
|
|
|
|
|
|
|
ok((all { $_->{type} == 1 } @nodes), 'all nodes are of type CT_OUTPUT');
|
|
|
|
ok((none { defined($_->{window}) } @nodes), 'no CT_OUTPUT contains a window');
|
|
|
|
ok((all { @{$_->{nodes}} > 0 } @nodes), 'all nodes have at least one leaf (workspace)');
|
|
|
|
my @workspaces;
|
|
|
|
for my $ws (map { @{$_->{nodes}} } @nodes) {
|
|
|
|
push @workspaces, $ws;
|
|
|
|
}
|
|
|
|
|
2010-06-02 23:53:22 +02:00
|
|
|
ok((all { $_->{type} == 4 } @workspaces), 'all workspaces are of type CT_WORKSPACE');
|
|
|
|
#ok((all { @{$_->{nodes}} == 0 } @workspaces), 'all workspaces are empty yet');
|
2010-03-27 15:25:51 +01:00
|
|
|
ok((none { defined($_->{window}) } @workspaces), 'no CT_OUTPUT contains a window');
|
|
|
|
|
|
|
|
# TODO: get the focused container
|
|
|
|
|
|
|
|
$i3->command('open')->recv;
|
|
|
|
|
|
|
|
# TODO: get the focused container, check if it changed.
|
|
|
|
# TODO: get the old focused container, check if there is a new child
|
|
|
|
|
2010-06-02 23:53:22 +02:00
|
|
|
#diag(Dumper(\@workspaces));
|
2010-03-27 15:25:51 +01:00
|
|
|
|
2010-06-02 23:53:22 +02:00
|
|
|
#diag(Dumper($tree));
|
2010-03-27 15:25:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
diag( "Testing i3, Perl $], $^X" );
|