2011-03-05 20:38:21 -05:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
|
|
|
# Test to see if i3 combines the geometry of all children in a split container
|
|
|
|
# when setting the split container to floating
|
|
|
|
#
|
|
|
|
use X11::XCB qw(:all);
|
|
|
|
use i3test;
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
use_ok('X11::XCB::Window');
|
|
|
|
}
|
|
|
|
|
|
|
|
my $x = X11::XCB::Connection->new;
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
my $tmp = fresh_workspace;
|
2011-03-05 20:38:21 -05:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# open a window with 200x80
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
my $first = $x->root->create_child(
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
rect => [ 0, 0, 200, 80],
|
|
|
|
background_color => '#FF0000',
|
2011-09-24 08:08:02 -04:00
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-03-05 20:38:21 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
$first->map;
|
|
|
|
|
2011-09-24 08:08:02 -04:00
|
|
|
wait_for_map $x;
|
2011-03-05 20:38:21 -05:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# Open a second window with 300x90
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
my $second = $x->root->create_child(
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
rect => [ 0, 0, 300, 90],
|
|
|
|
background_color => '#00FF00',
|
2011-09-24 08:08:02 -04:00
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-03-05 20:38:21 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
$second->map;
|
|
|
|
|
2011-09-24 08:08:02 -04:00
|
|
|
wait_for_map $x;
|
2011-03-05 20:38:21 -05:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# Set the parent to floating
|
|
|
|
#####################################################################
|
|
|
|
cmd 'nop setting floating';
|
2011-06-09 19:36:33 -04:00
|
|
|
cmd 'focus parent';
|
2011-06-09 20:06:47 -04:00
|
|
|
cmd 'floating enable';
|
2011-03-05 20:38:21 -05:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# Get geometry of the first floating node (the split container)
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
my @nodes = @{get_ws($tmp)->{floating_nodes}};
|
|
|
|
my $rect = $nodes[0]->{rect};
|
|
|
|
|
|
|
|
# we compare the width with ± 20 pixels for borders
|
|
|
|
cmp_ok($rect->{width}, '>', 500-20, 'width now > 480');
|
|
|
|
cmp_ok($rect->{width}, '<', 500+20, 'width now < 520');
|
|
|
|
# we compare the height with ± 40 pixels for decorations
|
|
|
|
cmp_ok($rect->{height}, '>', 90-40, 'width now > 50');
|
|
|
|
cmp_ok($rect->{height}, '<', 90+40, 'width now < 130');
|
|
|
|
|
|
|
|
done_testing;
|