Merge branch 'fix-split-horiz'
This commit is contained in:
commit
f4a86d9eda
|
@ -130,7 +130,7 @@ state FULLSCREEN:
|
||||||
|
|
||||||
# split v|h|vertical|horizontal
|
# split v|h|vertical|horizontal
|
||||||
state SPLIT:
|
state SPLIT:
|
||||||
direction = 'v', 'h', 'vertical', 'horizontal'
|
direction = 'horizontal', 'vertical', 'v', 'h'
|
||||||
-> call cmd_split($direction)
|
-> call cmd_split($direction)
|
||||||
|
|
||||||
# floating enable|disable|toggle
|
# floating enable|disable|toggle
|
||||||
|
|
|
@ -5,45 +5,55 @@
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp;
|
||||||
|
my $ws;
|
||||||
|
|
||||||
my $ws = get_ws($tmp);
|
################################################################################
|
||||||
is($ws->{orientation}, 'horizontal', 'orientation horizontal by default');
|
|
||||||
cmd 'split v';
|
|
||||||
$ws = get_ws($tmp);
|
|
||||||
is($ws->{orientation}, 'vertical', 'split v changes workspace orientation');
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
# Open two containers, split, open another container. Then verify
|
# Open two containers, split, open another container. Then verify
|
||||||
# the layout is like we expect it to be
|
# the layout is like we expect it to be
|
||||||
######################################################################
|
################################################################################
|
||||||
cmd 'open';
|
|
||||||
cmd 'open';
|
|
||||||
my $content = get_ws_content($tmp);
|
|
||||||
|
|
||||||
is(@{$content}, 2, 'two containers on workspace level');
|
sub verify_split_layout {
|
||||||
my $first = $content->[0];
|
my (%args) = @_;
|
||||||
my $second = $content->[1];
|
|
||||||
|
|
||||||
is(@{$first->{nodes}}, 0, 'first container has no children');
|
$tmp = fresh_workspace;
|
||||||
is(@{$second->{nodes}}, 0, 'second container has no children (yet)');
|
|
||||||
my $old_name = $second->{name};
|
|
||||||
|
|
||||||
|
$ws = get_ws($tmp);
|
||||||
|
is($ws->{orientation}, 'horizontal', 'orientation horizontal by default');
|
||||||
|
cmd 'split v';
|
||||||
|
$ws = get_ws($tmp);
|
||||||
|
is($ws->{orientation}, 'vertical', 'split v changes workspace orientation');
|
||||||
|
|
||||||
cmd 'split h';
|
cmd 'open';
|
||||||
cmd 'open';
|
cmd 'open';
|
||||||
|
my $content = get_ws_content($tmp);
|
||||||
|
|
||||||
$content = get_ws_content($tmp);
|
is(@{$content}, 2, 'two containers on workspace level');
|
||||||
|
my $first = $content->[0];
|
||||||
|
my $second = $content->[1];
|
||||||
|
|
||||||
is(@{$content}, 2, 'two containers on workspace level');
|
is(@{$first->{nodes}}, 0, 'first container has no children');
|
||||||
$first = $content->[0];
|
is(@{$second->{nodes}}, 0, 'second container has no children (yet)');
|
||||||
$second = $content->[1];
|
my $old_name = $second->{name};
|
||||||
|
|
||||||
is(@{$first->{nodes}}, 0, 'first container has no children');
|
cmd $args{split_command};
|
||||||
isnt($second->{name}, $old_name, 'second container was replaced');
|
cmd 'open';
|
||||||
is($second->{orientation}, 'horizontal', 'orientation is horizontal');
|
|
||||||
is(@{$second->{nodes}}, 2, 'second container has 2 children');
|
$content = get_ws_content($tmp);
|
||||||
is($second->{nodes}->[0]->{name}, $old_name, 'found old second container');
|
|
||||||
|
is(@{$content}, 2, 'two containers on workspace level');
|
||||||
|
$first = $content->[0];
|
||||||
|
$second = $content->[1];
|
||||||
|
|
||||||
|
is(@{$first->{nodes}}, 0, 'first container has no children');
|
||||||
|
isnt($second->{name}, $old_name, 'second container was replaced');
|
||||||
|
is($second->{orientation}, 'horizontal', 'orientation is horizontal');
|
||||||
|
is(@{$second->{nodes}}, 2, 'second container has 2 children');
|
||||||
|
is($second->{nodes}->[0]->{name}, $old_name, 'found old second container');
|
||||||
|
}
|
||||||
|
|
||||||
|
verify_split_layout(split_command => 'split h');
|
||||||
|
verify_split_layout(split_command => 'split horizontal');
|
||||||
|
|
||||||
# TODO: extend this test-case (test next/prev)
|
# TODO: extend this test-case (test next/prev)
|
||||||
# - wrapping (no horizontal switch possible, goes level-up)
|
# - wrapping (no horizontal switch possible, goes level-up)
|
||||||
|
|
Loading…
Reference in New Issue