Check if con_id exists in cmd_swap (#2898)

Also adds some testcases for swap using con_id.

Fixes #2895
This commit is contained in:
Orestis
2017-09-06 08:34:14 +03:00
committed by Michael Stapelberg
parent 85eb097677
commit 66f2148236
4 changed files with 56 additions and 1 deletions

View File

@ -32,6 +32,38 @@ my ($nodes, $expected_focus, $A, $B, $F);
my ($result);
my @urgent;
###############################################################################
# Invalid con_id should not crash i3
# See issue #2895.
###############################################################################
$pid = launch_with_config($config);
$ws = fresh_workspace;
open_window;
cmd "swap container with con_id 1";
does_i3_live;
exit_gracefully($pid);
###############################################################################
# Swap 2 windows in different workspaces using con_id
###############################################################################
$pid = launch_with_config($config);
$ws = fresh_workspace;
open_window;
$A = get_focused($ws);
$ws = fresh_workspace;
open_window;
cmd "swap container with con_id $A";
is(get_focused($ws), $A, 'A is now focused');
exit_gracefully($pid);
###############################################################################
# Swap two containers next to each other.
# Focus should stay on B because both windows are on the focused workspace.