2 # vim:ts=4:sw=4:expandtab
4 # Checks if the 'move workspace' command works correctly
8 my $i3 = i3(get_socket_path());
10 # We move the pointer out of our way to avoid a bug where the focus will
11 # be set to the window under the cursor
12 my $x = X11::XCB::Connection->new;
13 $x->root->warp_pointer(0, 0);
15 my $tmp = get_unused_workspace();
16 my $tmp2 = get_unused_workspace();
19 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
21 my $first = open_empty_con($i3);
22 my $second = open_empty_con($i3);
23 ok(@{get_ws_content($tmp)} == 2, 'two containers on first ws');
25 cmd "workspace $tmp2";
26 ok(@{get_ws_content($tmp2)} == 0, 'no containers on second ws yet');
30 cmd "move workspace $tmp2";
31 ok(@{get_ws_content($tmp)} == 1, 'one container on first ws anymore');
32 ok(@{get_ws_content($tmp2)} == 1, 'one container on second ws');
33 my ($nodes, $focus) = get_ws_content($tmp2);
35 is($focus->[0], $second, 'same container on different ws');
37 ($nodes, $focus) = get_ws_content($tmp);
38 ok($nodes->[0]->{focused}, 'first container focused on first ws');
40 ###################################################################
41 # check if floating cons are moved to new workspaces properly
42 # (that is, if they are floating on the target ws, too)
43 ###################################################################
45 $tmp = get_unused_workspace();
46 $tmp2 = get_unused_workspace();
50 cmd "floating toggle";
52 my $ws = get_ws($tmp);
53 is(@{$ws->{nodes}}, 0, 'no nodes on workspace');
54 is(@{$ws->{floating_nodes}}, 1, 'one floating node on workspace');
56 cmd "move workspace $tmp2";
59 is(@{$ws->{nodes}}, 0, 'no nodes on workspace');
60 is(@{$ws->{floating_nodes}}, 1, 'one floating node on workspace');