i3/testcases/t/155-floating-split-size.t
Ingo Bürk 9431ef16f6 Don't allow floating workspaces anymore.
This is essentially a revert of daf00a9 which introduced a mechanism
to float workspace containers by wrapping all children into a new
container and floating it.

This caused a bug and there's no good reason (anymore) to allow doing
this in the first place as we don't support floating nested containers.

fixes #2166
2016-02-11 21:25:50 +01:00

69 lines
2.1 KiB
Perl

#!perl
# vim:ts=4:sw=4:expandtab
#
# Please read the following documents before working on tests:
# • http://build.i3wm.org/docs/testsuite.html
# (or docs/testsuite)
#
# • http://build.i3wm.org/docs/lib-i3test.html
# (alternatively: perldoc ./testcases/lib/i3test.pm)
#
# • http://build.i3wm.org/docs/ipc.html
# (or docs/ipc)
#
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
# (unless you are already familiar with Perl)
#
# Test to see if i3 combines the geometry of all children in a split container
# when setting the split container to floating
#
use i3test;
my $tmp = fresh_workspace;
open_window;
cmd 'split v';
#####################################################################
# open a window with 200x80
#####################################################################
my $first = open_window({
rect => [ 0, 0, 200, 80],
background_color => '#FF0000',
});
cmd 'split h';
#####################################################################
# Open a second window with 300x90
#####################################################################
my $second = open_window({
rect => [ 0, 0, 300, 90],
background_color => '#00FF00',
});
#####################################################################
# Set the parent to floating
#####################################################################
cmd 'nop setting floating';
cmd 'focus parent';
cmd 'floating enable';
#####################################################################
# 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;