2 # vim:ts=4:sw=4:expandtab
5 use List::Util qw(first);
7 my $tmp = fresh_workspace;
9 #####################################################################
10 # Create two windows and put them in stacking mode
11 #####################################################################
15 my $top = open_window;
16 my $bottom = open_window;
18 my @urgent = grep { $_->{urgent} } @{get_ws_content($tmp)};
19 is(@urgent, 0, 'no window got the urgent flag');
21 # cmd 'layout stacking';
23 #####################################################################
24 # Add the urgency hint, switch to a different workspace and back again
25 #####################################################################
26 $top->add_hint('urgency');
29 my @content = @{get_ws_content($tmp)};
30 @urgent = grep { $_->{urgent} } @content;
31 my $top_info = first { $_->{window} == $top->id } @content;
32 my $bottom_info = first { $_->{window} == $bottom->id } @content;
34 ok($top_info->{urgent}, 'top window is marked urgent');
35 ok(!$bottom_info->{urgent}, 'bottom window is not marked urgent');
36 is(@urgent, 1, 'exactly one window got the urgent flag');
38 cmd '[id="' . $top->id . '"] focus';
40 @urgent = grep { $_->{urgent} } @{get_ws_content($tmp)};
41 is(@urgent, 0, 'no window got the urgent flag after focusing');
43 $top->add_hint('urgency');
46 @urgent = grep { $_->{urgent} } @{get_ws_content($tmp)};
47 is(@urgent, 0, 'no window got the urgent flag after re-setting urgency hint');
49 #####################################################################
50 # Check if the workspace urgency hint gets set/cleared correctly
51 #####################################################################
52 my $ws = get_ws($tmp);
53 ok(!$ws->{urgent}, 'urgent flag not set on workspace');
55 my $otmp = fresh_workspace;
57 $top->add_hint('urgency');
61 ok($ws->{urgent}, 'urgent flag set on workspace');
66 ok(!$ws->{urgent}, 'urgent flag not set on workspace after switching');