2009-11-18 20:39:53 +01:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
use i3test;
|
2010-06-02 17:51:58 +02:00
|
|
|
use List::Util qw(first);
|
2009-11-18 20:39:53 +01:00
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
my $tmp = fresh_workspace;
|
2009-11-18 20:39:53 +01:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# Create two windows and put them in stacking mode
|
|
|
|
#####################################################################
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
cmd 'split v';
|
2010-06-02 17:51:58 +02:00
|
|
|
|
2011-11-22 00:47:32 +01:00
|
|
|
my $top = open_window;
|
|
|
|
my $bottom = open_window;
|
2009-11-18 20:39:53 +01:00
|
|
|
|
2011-07-24 14:54:30 +02:00
|
|
|
my @urgent = grep { $_->{urgent} } @{get_ws_content($tmp)};
|
2010-06-02 17:51:58 +02:00
|
|
|
is(@urgent, 0, 'no window got the urgent flag');
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
# cmd 'layout stacking';
|
2009-11-18 20:39:53 +01:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# Add the urgency hint, switch to a different workspace and back again
|
|
|
|
#####################################################################
|
|
|
|
$top->add_hint('urgency');
|
2011-11-22 01:13:37 +01:00
|
|
|
sync_with_i3;
|
2010-06-02 17:51:58 +02:00
|
|
|
|
2011-11-21 21:04:00 +01:00
|
|
|
my @content = @{get_ws_content($tmp)};
|
2011-07-24 14:54:30 +02:00
|
|
|
@urgent = grep { $_->{urgent} } @content;
|
2011-11-21 21:04:00 +01:00
|
|
|
my $top_info = first { $_->{window} == $top->id } @content;
|
|
|
|
my $bottom_info = first { $_->{window} == $bottom->id } @content;
|
2010-06-02 17:51:58 +02:00
|
|
|
|
2011-07-24 14:54:30 +02:00
|
|
|
ok($top_info->{urgent}, 'top window is marked urgent');
|
|
|
|
ok(!$bottom_info->{urgent}, 'bottom window is not marked urgent');
|
2010-06-02 17:51:58 +02:00
|
|
|
is(@urgent, 1, 'exactly one window got the urgent flag');
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
cmd '[id="' . $top->id . '"] focus';
|
2010-06-02 17:51:58 +02:00
|
|
|
|
2011-07-24 14:54:30 +02:00
|
|
|
@urgent = grep { $_->{urgent} } @{get_ws_content($tmp)};
|
2010-06-02 17:51:58 +02:00
|
|
|
is(@urgent, 0, 'no window got the urgent flag after focusing');
|
|
|
|
|
|
|
|
$top->add_hint('urgency');
|
2011-11-22 01:13:37 +01:00
|
|
|
sync_with_i3;
|
2010-06-02 17:51:58 +02:00
|
|
|
|
2011-07-24 14:54:30 +02:00
|
|
|
@urgent = grep { $_->{urgent} } @{get_ws_content($tmp)};
|
2010-06-02 17:51:58 +02:00
|
|
|
is(@urgent, 0, 'no window got the urgent flag after re-setting urgency hint');
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# Check if the workspace urgency hint gets set/cleared correctly
|
|
|
|
#####################################################################
|
|
|
|
my $ws = get_ws($tmp);
|
2011-07-24 14:54:30 +02:00
|
|
|
ok(!$ws->{urgent}, 'urgent flag not set on workspace');
|
2010-06-02 17:51:58 +02:00
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
my $otmp = fresh_workspace;
|
2010-06-02 17:51:58 +02:00
|
|
|
|
|
|
|
$top->add_hint('urgency');
|
2011-11-22 01:13:37 +01:00
|
|
|
sync_with_i3;
|
2010-06-02 17:51:58 +02:00
|
|
|
|
|
|
|
$ws = get_ws($tmp);
|
2011-07-24 14:54:30 +02:00
|
|
|
ok($ws->{urgent}, 'urgent flag set on workspace');
|
2010-06-02 17:51:58 +02:00
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
cmd "workspace $tmp";
|
2009-11-18 20:39:53 +01:00
|
|
|
|
2010-06-02 17:51:58 +02:00
|
|
|
$ws = get_ws($tmp);
|
2011-07-24 14:54:30 +02:00
|
|
|
ok(!$ws->{urgent}, 'urgent flag not set on workspace after switching');
|
2009-11-20 15:56:18 +01:00
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
done_testing;
|