]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/132-move-workspace.t
Merge branch 'release-4.16.1'
[i3/i3] / testcases / t / 132-move-workspace.t
index 730041a642e5449b0f473d9738cc89a905f90ac9..60705f96d4de586998724d1270f77d6c3721e4ca 100644 (file)
@@ -2,13 +2,13 @@
 # vim:ts=4:sw=4:expandtab
 #
 # Please read the following documents before working on tests:
-# • http://build.i3wm.org/docs/testsuite.html
+# • https://build.i3wm.org/docs/testsuite.html
 #   (or docs/testsuite)
 #
-# • http://build.i3wm.org/docs/lib-i3test.html
+# • https://build.i3wm.org/docs/lib-i3test.html
 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
 #
-# • http://build.i3wm.org/docs/ipc.html
+# • https://build.i3wm.org/docs/ipc.html
 #   (or docs/ipc)
 #
 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
@@ -22,7 +22,9 @@ my $i3 = i3(get_socket_path());
 
 # We move the pointer out of our way to avoid a bug where the focus will
 # be set to the window under the cursor
+sync_with_i3;
 $x->root->warp_pointer(0, 0);
+sync_with_i3;
 
 sub move_workspace_test {
     my ($movecmd) = @_;
@@ -318,4 +320,34 @@ $ws = get_ws($tmp2);
 is_num_children($tmp2, 1, 'one container on second workspace');
 is(@{$ws->{floating_nodes}}, 2, 'two floating nodes on second workspace');
 
+###################################################################
+# same as the above, but with only floating children
+###################################################################
+$tmp2 = get_unused_workspace();
+$tmp = fresh_workspace();
+cmd 'open';
+cmd 'floating toggle';
+
+$ws = get_ws($tmp);
+is_num_children($tmp, 0, 'no regular nodes on first workspace');
+is(@{$ws->{floating_nodes}}, 1, 'one floating node on first workspace');
+
+cmd 'focus parent';
+cmd "move workspace $tmp2";
+
+$ws = get_ws($tmp2);
+is_num_children($tmp2, 0, 'no regular nodes on second workspace');
+is(@{$ws->{floating_nodes}}, 1, 'one floating node on second workspace');
+
+###################################################################
+# Check that moving an empty workspace using criteria doesn't
+# create unfocused empty workspace.
+###################################################################
+$tmp2 = get_unused_workspace();
+$tmp = fresh_workspace();
+cmd 'mark a';
+cmd "[con_mark=a] move to workspace $tmp2";
+
+is (get_ws($tmp2), undef, 'No empty workspace created');
+
 done_testing;