]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/518-interpret-workspace-numbers.t
Merge branch 'next' into master
[i3/i3] / testcases / t / 518-interpret-workspace-numbers.t
index e9ea76c4f674d46699d66c45a8cb9f515f29e693..c7ab8367c0dd9285110491ba718f4251a6bc6251 100644 (file)
@@ -26,25 +26,12 @@ workspace 1:override output fake-0
 workspace 2 output fake-0
 workspace 1 output fake-1
 workspace 2:override output fake-1
+workspace 3 output fake-0
+workspace 3:override output doesnotexist fake-1
 
 fake-outputs 1024x768+0+0,1024x768+1024+0
 EOT
 
-my $i3 = i3(get_socket_path());
-$i3->connect->recv;
-
-# Returns the name of the output on which this workspace resides
-sub get_output_for_workspace {
-    my $ws_name = shift @_;
-
-    foreach (grep { not $_->{name} =~ /^__/ } @{$i3->get_tree->recv->{nodes}}) {
-        my $output = $_->{name};
-        foreach (grep { $_->{name} =~ "content" } @{$_->{nodes}}) {
-            return $output if $_->{nodes}[0]->{name} =~ $ws_name;
-        }
-    }
-}
-
 ################################################################################
 # Workspace assignments with bare numbers should be interpreted as `workspace
 # number` config directives. Any workspace beginning with that number should be
@@ -69,4 +56,10 @@ is(get_output_for_workspace('1:override'), 'fake-0',
     'Assignment rules should not be affected by the order assignments are declared')
     or diag 'Since workspace "1:override" is assigned by name to fake-0, it should open on fake-0';
 
+cmd 'focus output fake-1';
+cmd 'workspace "3:override"';
+is(get_output_for_workspace('3:override'), 'fake-1',
+   'Assignment rules should not be affected by multiple output assignments')
+    or diag 'Since workspace "3:override" is assigned by name to fake-1, it should open on fake-1';
+
 done_testing;