From b741c492120bde20a289dc7a044d10c429f84a32 Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Sun, 9 Sep 2012 18:08:55 +0200 Subject: [PATCH] testcase for propagating urgency --- testcases/t/113-urgent.t | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) 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; -- 2.39.5