Add regression tests for #2846

1). Add one regression test in 167-workspace_layout.t:
    - Get a fresh workspace
    - Set the layout to something
    - Create windows
    - Try to switch to another layout
    - Check if successful
    - Repeat for all 12 possible transitions
2). Add another regression test in 167-workspace_layout.t:
    - Check that the command 'layout toggle split' works regardless of
      what layout we're using
next
hwangcc23 2017-08-06 23:08:05 +08:00 committed by Dan Elkouby
parent c028f0cb17
commit a34a0048a1
1 changed files with 67 additions and 0 deletions

View File

@ -375,7 +375,74 @@ ok(@content == 2, 'two containers opened');
isnt($content[0]->{layout}, 'tabbed', 'layout not tabbed');
isnt($content[1]->{layout}, 'tabbed', 'layout not tabbed');
exit_gracefully($pid);
#####################################################################
# 16: Check that the command 'layout toggle split' works regardless
# of what layout we're using.
#####################################################################
$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
workspace_layout default
EOT
$pid = launch_with_config($config);
$tmp = fresh_workspace;
my @layouts = ('splith', 'splitv', 'tabbed', 'stacked');
my $first_layout;
foreach $first_layout (@layouts) {
cmd 'layout ' . $first_layout;
$first = open_window;
$second = open_window;
cmd 'layout toggle split';
@content = @{get_ws_content($tmp)};
if ($first_layout eq 'splith') {
is($content[0]->{layout}, 'splitv', 'layout toggles to splitv');
} else {
is($content[0]->{layout}, 'splith', 'layout toggles to splith');
}
cmd '[id="' . $first->id . '"] kill';
cmd '[id="' . $second->id . '"] kill';
sync_with_i3;
}
exit_gracefully($pid);
#####################################################################
# 17: Check about setting a new layout.
#####################################################################
$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
workspace_layout default
EOT
$pid = launch_with_config($config);
$tmp = fresh_workspace;
my $second_layout;
foreach $first_layout (@layouts) {
foreach $second_layout (@layouts) {
cmd 'layout ' . $first_layout;
$first = open_window;
$second = open_window;
cmd 'layout ' . $second_layout;
@content = @{get_ws_content($tmp)};
is($content[0]->{layout}, $second_layout, 'layout changes to ' . $second_layout);
cmd '[id="' . $first->id . '"] kill';
cmd '[id="' . $second->id . '"] kill';
sync_with_i3;
}
}
done_testing;