]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/156-fullscreen-focus.t
Restrict "move to workspace" commands in fullscreen.
[i3/i3] / testcases / t / 156-fullscreen-focus.t
index f76588f9fa0faa60ac5d137bcb946037222e1717..b779ce7d8490286a95088aacd2b4d2619b640c5b 100644 (file)
@@ -111,7 +111,6 @@ $left = open_window;
 my $right1 = open_window;
 cmd 'split v';
 my $right2 = open_window;
-$nodes = get_ws_content($tmp);
 
 cmd 'focus parent';
 cmd 'fullscreen global';
@@ -234,4 +233,63 @@ is($x->input_focus, $right2->id, 'focus did not leave parent container (3)');
 cmd 'focus up';
 is($x->input_focus, $right22->id, 'focus did not leave parent container (4)');
 
+################################################################################
+# Ensure that moving in a direction doesn't violate the focus restrictions.
+################################################################################
+
+sub verify_move {
+    my $num = shift;
+    my $msg = shift;
+    my $nodes = get_ws_content($tmp2);
+    my $split = $nodes->[1];
+    my $fs = $split->{nodes}->[1];
+    is(scalar @{$fs->{nodes}}, $num, $msg);
+}
+
+cmd 'move left';
+verify_move(2, 'prevented move left');
+cmd 'move right';
+verify_move(2, 'prevented move right');
+cmd 'move down';
+verify_move(2, 'prevented move down');
+cmd 'move up';
+cmd 'move up';
+verify_move(2, 'prevented move up');
+
+################################################################################
+# Moving to a different workspace is allowed with per-output fullscreen
+# containers.
+################################################################################
+
+cmd "move to workspace $tmp";
+verify_move(1, 'did not prevent move to workspace by name');
+
+cmd "workspace $tmp";
+cmd "move to workspace $tmp2";
+cmd "workspace $tmp2";
+
+cmd "move to workspace prev";
+verify_move(1, 'did not prevent move to workspace by position');
+
+################################################################################
+# Ensure that is not allowed with global fullscreen containers.
+################################################################################
+
+cmd "workspace $tmp";
+cmd "move to workspace $tmp2";
+cmd "workspace $tmp2";
+
+cmd 'focus parent';
+cmd 'fullscreen';
+cmd 'fullscreen global';
+cmd 'focus child';
+
+cmd "move to workspace $tmp";
+verify_move(2, 'prevented move to workspace by name');
+
+cmd "move to workspace prev";
+verify_move(2, 'prevented move to workspace by position');
+
+# TODO: Tests for "move to output" and "move workspace to output".
+
 done_testing;