2010-11-21 10:49:59 -05:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
# Regression test: New windows were attached to the container of a floating window
|
|
|
|
# if only a floating window is present on the workspace.
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
use i3test;
|
2010-11-21 10:49:59 -05:00
|
|
|
use X11::XCB qw(:all);
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
use_ok('X11::XCB::Window');
|
|
|
|
}
|
|
|
|
|
2011-07-25 07:35:56 -04:00
|
|
|
my $i3 = i3(get_socket_path());
|
2010-11-21 10:49:59 -05:00
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
my $tmp = fresh_workspace;
|
2010-11-21 10:49:59 -05:00
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
# 1: open a floating window, get it mapped
|
|
|
|
#############################################################################
|
|
|
|
|
|
|
|
my $x = X11::XCB::Connection->new;
|
|
|
|
|
|
|
|
# Create a floating window
|
2011-09-23 15:37:45 -04:00
|
|
|
my $window = open_standard_window($x, undef, 1);
|
2010-11-21 10:49:59 -05:00
|
|
|
ok($window->mapped, 'Window is mapped');
|
|
|
|
|
|
|
|
my $ws = get_ws($tmp);
|
|
|
|
my ($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
|
|
|
|
is(@{$ws->{floating_nodes}}, 1, 'one floating node');
|
|
|
|
is(@{$nodes}, 0, 'no tiling nodes');
|
|
|
|
|
|
|
|
# Create a tiling window
|
2011-09-23 15:37:45 -04:00
|
|
|
my $twindow = open_standard_window($x);
|
2010-11-21 10:49:59 -05:00
|
|
|
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
|
|
|
|
is(@{$nodes}, 1, 'one tiling node');
|
2011-03-09 14:25:17 -05:00
|
|
|
|
2011-05-13 15:29:01 -04:00
|
|
|
#############################################################################
|
|
|
|
# 2: similar case: floating windows should be attached at the currently focused
|
|
|
|
# position in the workspace (for example a stack), not just at workspace level.
|
|
|
|
#############################################################################
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
my $first = open_standard_window($x);
|
|
|
|
my $second = open_standard_window($x);
|
|
|
|
|
|
|
|
cmd 'layout stacked';
|
|
|
|
|
|
|
|
$ws = get_ws($tmp);
|
|
|
|
is(@{$ws->{floating_nodes}}, 0, 'no floating nodes so far');
|
|
|
|
is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
|
|
|
|
|
|
|
|
# Create a floating window
|
2011-09-23 15:37:45 -04:00
|
|
|
my $window = open_standard_window($x, undef, 1);
|
2011-05-13 15:29:01 -04:00
|
|
|
ok($window->mapped, 'Window is mapped');
|
|
|
|
|
|
|
|
$ws = get_ws($tmp);
|
|
|
|
is(@{$ws->{floating_nodes}}, 1, 'one floating nodes');
|
|
|
|
is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
|
|
|
|
|
|
|
|
my $third = open_standard_window($x);
|
|
|
|
|
|
|
|
|
|
|
|
$ws = get_ws($tmp);
|
|
|
|
is(@{$ws->{floating_nodes}}, 1, 'one floating nodes');
|
|
|
|
is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
done_testing;
|