]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/504-move-workspace-to-output.t
Implement special value 'current' for output. (#2483)
[i3/i3] / testcases / t / 504-move-workspace-to-output.t
index c087f9f5ad117946b493383a5bbd893bf84922e3..c43b8b407a39523336e0cacbb821e4508e699b75 100644 (file)
@@ -19,9 +19,6 @@
 use List::Util qw(first);
 use i3test i3_autostart => 0;
 
-# TODO:
-# introduce 'move workspace 3 to output <output>' with synonym 'move workspace 3 to <output>'
-
 # Ensure the pointer is at (0, 0) so that we really start on the first
 # (the left) workspace.
 $x->root->warp_pointer(0, 0);
@@ -77,10 +74,10 @@ sub workspaces_per_screen {
     my @outputs = @{$tree->{nodes}};
 
     my $fake0 = first { $_->{name} eq 'fake-0' } @outputs;
-    my $fake0_content = first { $_->{type} == 2 } @{$fake0->{nodes}};
+    my $fake0_content = first { $_->{type} eq 'con' } @{$fake0->{nodes}};
 
     my $fake1 = first { $_->{name} eq 'fake-1' } @outputs;
-    my $fake1_content = first { $_->{type} == 2 } @{$fake1->{nodes}};
+    my $fake1_content = first { $_->{type} eq 'con' } @{$fake1->{nodes}};
 
     my @fake0_workspaces = map { $_->{name} } @{$fake0_content->{nodes}};
     my @fake1_workspaces = map { $_->{name} } @{$fake1_content->{nodes}};
@@ -114,6 +111,16 @@ cmd 'move workspace to output left';
 ($x0, $x1) = workspaces_per_screen();
 ok('5' ~~ @$x0, 'workspace 5 back on fake-0');
 
+# Verify that wrapping works
+cmd 'move workspace to output left';
+($x0, $x1) = workspaces_per_screen();
+ok('5' ~~ @$x1, 'workspace 5 on fake-1');
+
+# Put workspace 5 where it should
+cmd 'move workspace to output left';
+($x0, $x1) = workspaces_per_screen();
+ok('5' ~~ @$x0, 'workspace 5 on fake-0 again');
+
 ################################################################################
 # Verify that coordinates of floating windows are fixed correctly when moving a
 # workspace to a different output.
@@ -153,6 +160,26 @@ ok(!($empty_ws ~~ @$x0), 'empty_ws not on fake-0');
 ok(!($empty_ws ~~ @$x1), 'empty_ws not on fake-1');
 ok($other_output_ws ~~ @$x0, 'other_output_ws on fake-0');
 
-exit_gracefully($pid);
+################################################################################
+# Verify that the special word 'current' can be used for the output.
+################################################################################
 
+my $ws1 = fresh_workspace(output => 1);
+open_window;
+cmd 'mark marked';
+
+my $ws0 = fresh_workspace(output => 0);
+
+($x0, $x1) = workspaces_per_screen();
+ok($ws0 ~~ @$x0, 'ws0 on fake-0');
+ok($ws1 ~~ @$x1, 'ws1 on fake-1');
+
+cmd '[con_mark=marked] move workspace to output current';
+
+($x0, $x1) = workspaces_per_screen();
+ok($ws1 ~~ @$x0, 'ws1 on fake-0');
+
+################################################################################
+
+exit_gracefully($pid);
 done_testing;