]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/113-urgent.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 113-urgent.t
index 58eff694dcd23da5f91e17bb7dc3e0ffb11079fa..ff44e0ea0bc263ed52d29b0a789212c97ae1809f 100644 (file)
@@ -153,6 +153,84 @@ is($x->input_focus, $bottom->id, 'oldest urgent window focused');
 $bottom->delete_hint('urgency');
 sync_with_i3;
 
+################################################################################
+# Check if urgent flag gets propagated to parent containers
+################################################################################
+
+cmd 'split v';
+
+
+
+sub count_urgent {
+    my ($con) = @_;
+
+    my @children = (@{$con->{nodes}}, @{$con->{floating_nodes}});
+    my $urgent = grep { $_->{urgent} } @children;
+    $urgent += count_urgent($_) for @children;
+    return $urgent;
+}
+
+$tmp = fresh_workspace;
+
+my $win1 = open_window;
+my $win2 = open_window;
+cmd 'layout stacked';
+cmd 'split vertical';
+my $win3 = open_window;
+my $win4 = open_window;
+cmd 'split horizontal' ;
+my $win5 = open_window;
+my $win6 = open_window;
+
+sync_with_i3;
+
+
+my $urgent = count_urgent(get_ws($tmp));
+is($urgent, 0, 'no window got the urgent flag');
+
+cmd '[id="' . $win2->id . '"] focus';
+sync_with_i3;
+$win5->add_hint('urgency');
+$win6->add_hint('urgency');
+sync_with_i3;
+
+# we should have 5 urgent cons. win5, win6 and their 3 split parents.
+
+$urgent = count_urgent(get_ws($tmp));
+is($urgent, 5, '2 windows and 3 split containers got the urgent flag');
+
+cmd '[id="' . $win5->id . '"] focus';
+sync_with_i3;
+
+# now win5 and still the split parents should be urgent.
+$urgent = count_urgent(get_ws($tmp));
+is($urgent, 4, '1 window and 3 split containers got the urgent flag');
+
+cmd '[id="' . $win6->id . '"] focus';
+sync_with_i3;
+
+# now now window should be urgent.
+$urgent = count_urgent(get_ws($tmp));
+is($urgent, 0, 'All urgent flags got cleared');
+
+################################################################################
+# Regression test: Check that urgent floating containers work properly (ticket
+# #821)
+################################################################################
+
+$tmp = fresh_workspace;
+my $floating_win = open_floating_window;
+
+# switch away
+fresh_workspace;
+
+$floating_win->add_hint('urgency');
+sync_with_i3;
+
+cmd "workspace $tmp";
+
+does_i3_live;
+
 exit_gracefully($pid);
 
 done_testing;