2010-07-17 07:27:34 -04:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
|
|
|
# Checks if the 'move workspace' command works correctly
|
|
|
|
#
|
2011-03-09 14:25:17 -05:00
|
|
|
use i3test;
|
2010-07-17 07:27:34 -04:00
|
|
|
|
2011-07-25 07:35:56 -04:00
|
|
|
my $i3 = i3(get_socket_path());
|
2010-07-17 07:27:34 -04:00
|
|
|
|
|
|
|
# We move the pointer out of our way to avoid a bug where the focus will
|
|
|
|
# be set to the window under the cursor
|
|
|
|
my $x = X11::XCB::Connection->new;
|
|
|
|
$x->root->warp_pointer(0, 0);
|
|
|
|
|
|
|
|
my $tmp = get_unused_workspace();
|
|
|
|
my $tmp2 = get_unused_workspace();
|
2010-11-29 14:24:13 -05:00
|
|
|
cmd "workspace $tmp";
|
2010-07-17 07:27:34 -04:00
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
2010-07-17 09:52:22 -04:00
|
|
|
my $first = open_empty_con($i3);
|
|
|
|
my $second = open_empty_con($i3);
|
2010-07-17 07:27:34 -04:00
|
|
|
ok(@{get_ws_content($tmp)} == 2, 'two containers on first ws');
|
|
|
|
|
2010-11-29 14:24:13 -05:00
|
|
|
cmd "workspace $tmp2";
|
2010-07-17 07:27:34 -04:00
|
|
|
ok(@{get_ws_content($tmp2)} == 0, 'no containers on second ws yet');
|
|
|
|
|
2010-11-29 14:24:13 -05:00
|
|
|
cmd "workspace $tmp";
|
2010-07-17 07:27:34 -04:00
|
|
|
|
2010-11-29 14:24:13 -05:00
|
|
|
cmd "move workspace $tmp2";
|
2010-07-17 07:27:34 -04:00
|
|
|
ok(@{get_ws_content($tmp)} == 1, 'one container on first ws anymore');
|
|
|
|
ok(@{get_ws_content($tmp2)} == 1, 'one container on second ws');
|
2010-07-17 09:52:22 -04:00
|
|
|
my ($nodes, $focus) = get_ws_content($tmp2);
|
2010-07-17 07:27:34 -04:00
|
|
|
|
|
|
|
is($focus->[0], $second, 'same container on different ws');
|
|
|
|
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
2011-07-24 09:00:09 -04:00
|
|
|
ok($nodes->[0]->{focused}, 'first container focused on first ws');
|
2010-07-17 07:27:34 -04:00
|
|
|
|
2010-11-29 14:39:56 -05:00
|
|
|
###################################################################
|
|
|
|
# check if floating cons are moved to new workspaces properly
|
|
|
|
# (that is, if they are floating on the target ws, too)
|
|
|
|
###################################################################
|
|
|
|
|
|
|
|
$tmp = get_unused_workspace();
|
|
|
|
$tmp2 = get_unused_workspace();
|
|
|
|
cmd "workspace $tmp";
|
|
|
|
|
|
|
|
cmd "open";
|
2011-06-09 20:06:47 -04:00
|
|
|
cmd "floating toggle";
|
2010-11-29 14:39:56 -05:00
|
|
|
|
|
|
|
my $ws = get_ws($tmp);
|
|
|
|
is(@{$ws->{nodes}}, 0, 'no nodes on workspace');
|
|
|
|
is(@{$ws->{floating_nodes}}, 1, 'one floating node on workspace');
|
|
|
|
|
|
|
|
cmd "move workspace $tmp2";
|
|
|
|
|
|
|
|
$ws = get_ws($tmp2);
|
|
|
|
is(@{$ws->{nodes}}, 0, 'no nodes on workspace');
|
|
|
|
is(@{$ws->{floating_nodes}}, 1, 'one floating node on workspace');
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
done_testing;
|