From: Sascha Kruse Date: Sun, 9 Sep 2012 16:08:55 +0000 (+0200) Subject: testcase for propagating urgency X-Git-Tag: 4.4~118 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b741c492120bde20a289dc7a044d10c429f84a32;p=i3%2Fi3 testcase for propagating urgency --- diff --git a/testcases/t/113-urgent.t b/testcases/t/113-urgent.t index 58eff694..85d2035d 100644 --- a/testcases/t/113-urgent.t +++ b/testcases/t/113-urgent.t @@ -153,6 +153,66 @@ 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'); + exit_gracefully($pid); done_testing;