2011-01-07 22:21:41 +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:
|
|
|
|
|
# • 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)
|
|
|
|
|
#
|
2011-01-07 22:21:41 +01:00
|
|
|
|
# by moving the window in the opposite orientation that its parent has, we
|
|
|
|
|
# force i3 to create a new split container with the appropriate orientation.
|
|
|
|
|
# However, when doing that two times in a row, we end up with two split
|
|
|
|
|
# containers which are then redundant (workspace is horizontal, then v-split,
|
|
|
|
|
# then h-split – we could just append the children of the latest h-split to the
|
|
|
|
|
# workspace itself).
|
|
|
|
|
#
|
|
|
|
|
# This testcase checks that the tree is properly flattened after moving.
|
|
|
|
|
#
|
2011-03-09 20:25:17 +01:00
|
|
|
|
use i3test;
|
2011-01-07 22:21:41 +01:00
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
|
my $tmp = fresh_workspace;
|
2011-01-07 22:21:41 +01:00
|
|
|
|
|
2011-11-22 00:47:32 +01:00
|
|
|
|
my $left = open_window;
|
|
|
|
|
my $mid = open_window;
|
|
|
|
|
my $right = open_window;
|
2011-01-07 22:21:41 +01:00
|
|
|
|
|
2011-11-21 19:54:20 +01:00
|
|
|
|
cmd 'move up';
|
|
|
|
|
cmd 'move right';
|
2011-01-07 22:21:41 +01:00
|
|
|
|
my $ws = get_ws($tmp);
|
|
|
|
|
|
Introduce splith/splitv layouts, remove orientation
With this commit, the "default" layout is replaced by the splith and
splitv layouts. splith is equivalent to default with orientation
horizontal and splitv is equivalent to default with orientation
vertical.
The "split h" and "split v" commands continue to work as before, they
split the current container and you will end up in a split container
with layout splith (after "split h") or splitv (after "split v").
To change a splith container into a splitv container, use either "layout
splitv" or "layout toggle split". The latter command is used in the
default config as mod+l (previously "layout default"). In case you have
"layout default" in your config file, it is recommended to just replace
it by "layout toggle split", which will work as "layout default" did
before when pressing it once, but toggle between horizontal/vertical
when pressing it repeatedly.
The rationale behind this commit is that it’s cleaner to have all
parameters that influence how windows are rendered in the layout itself
rather than having a special parameter in combination with only one
layout. This enables us to change existing split containers in all cases
without breaking existing features (see ticket #464). Also, users should
feel more confident about whether they are actually splitting or just
changing an existing split container now.
As a nice side-effect, this commit brings back the "layout toggle"
feature we once had in i3 version 3 (see the userguide).
AFAIK, it is safe to use in-place restart to upgrade into versions
after this commit (switching to an older version will break your layout,
though).
Fixes #464
2012-08-04 03:04:00 +02:00
|
|
|
|
is($ws->{layout}, 'splith', 'workspace layout is splith');
|
2011-01-07 22:21:41 +01:00
|
|
|
|
is(@{$ws->{nodes}}, 3, 'all three windows on workspace level');
|
2011-03-09 20:25:17 +01:00
|
|
|
|
|
2013-09-01 13:35:04 +02:00
|
|
|
|
################################################################################
|
|
|
|
|
# Ticket #1053 provides a sequence of operations where the flattening does not
|
|
|
|
|
# work correctly:
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
|
|
my $tab1 = open_window;
|
|
|
|
|
my $tab2 = open_window;
|
|
|
|
|
$mid = open_window;
|
|
|
|
|
$right = open_window;
|
|
|
|
|
cmd 'focus right';
|
|
|
|
|
cmd 'split v';
|
|
|
|
|
cmd 'focus right';
|
|
|
|
|
cmd 'move left';
|
|
|
|
|
cmd 'layout tabbed';
|
|
|
|
|
cmd 'focus parent';
|
|
|
|
|
cmd 'split v';
|
|
|
|
|
|
|
|
|
|
$ws = get_ws($tmp);
|
|
|
|
|
my @nodes = @{$ws->{nodes}};
|
|
|
|
|
is(@nodes, 3, 'all three windows on workspace level');
|
|
|
|
|
is($nodes[0]->{layout}, 'splitv', 'first node is splitv');
|
|
|
|
|
is(@{$nodes[0]->{nodes}}, 1, 'one node in the first node');
|
|
|
|
|
is($nodes[0]->{nodes}->[0]->{layout}, 'tabbed', 'tabbed layout');
|
|
|
|
|
is(@{$nodes[0]->{nodes}->[0]->{nodes}}, 2, 'two nodes in that node');
|
|
|
|
|
|
|
|
|
|
cmd 'focus right';
|
|
|
|
|
cmd 'move left';
|
|
|
|
|
|
|
|
|
|
$ws = get_ws($tmp);
|
|
|
|
|
@nodes = @{$ws->{nodes}};
|
|
|
|
|
is(@nodes, 2, 'all three windows on workspace level');
|
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
|
done_testing;
|