2011-03-06 02:38:21 +01:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
2012-09-10 14:09:01 +02:00
|
|
|
# Please read the following documents before working on tests:
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/testsuite.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (or docs/testsuite)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/lib-i3test.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/ipc.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (or docs/ipc)
|
|
|
|
#
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
#
|
2011-03-06 02:38:21 +01:00
|
|
|
# Test to see if i3 combines the geometry of all children in a split container
|
|
|
|
# when setting the split container to floating
|
|
|
|
#
|
|
|
|
use i3test;
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
my $tmp = fresh_workspace;
|
2011-03-06 02:38:21 +01:00
|
|
|
|
2016-02-11 20:54:02 +01:00
|
|
|
open_window;
|
|
|
|
cmd 'split v';
|
|
|
|
|
2011-03-06 02:38:21 +01:00
|
|
|
#####################################################################
|
|
|
|
# open a window with 200x80
|
|
|
|
#####################################################################
|
|
|
|
|
2011-11-22 00:47:32 +01:00
|
|
|
my $first = open_window({
|
2011-09-24 16:11:37 +02:00
|
|
|
rect => [ 0, 0, 200, 80],
|
|
|
|
background_color => '#FF0000',
|
|
|
|
});
|
2011-03-06 02:38:21 +01:00
|
|
|
|
2016-02-11 20:54:02 +01:00
|
|
|
cmd 'split h';
|
|
|
|
|
2011-03-06 02:38:21 +01:00
|
|
|
#####################################################################
|
|
|
|
# Open a second window with 300x90
|
|
|
|
#####################################################################
|
|
|
|
|
2011-11-22 00:47:32 +01:00
|
|
|
my $second = open_window({
|
2011-09-24 16:11:37 +02:00
|
|
|
rect => [ 0, 0, 300, 90],
|
|
|
|
background_color => '#00FF00',
|
|
|
|
});
|
2011-03-06 02:38:21 +01:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# Set the parent to floating
|
|
|
|
#####################################################################
|
|
|
|
cmd 'nop setting floating';
|
2011-06-10 01:36:33 +02:00
|
|
|
cmd 'focus parent';
|
2011-06-10 02:06:47 +02:00
|
|
|
cmd 'floating enable';
|
2011-03-06 02:38:21 +01: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;
|