Re-implement support for the urgency hint, extend t/13-urgent.t
The actual rendering will follow
This commit is contained in:
@ -1,12 +1,10 @@
|
||||
#!perl
|
||||
# vim:ts=4:sw=4:expandtab
|
||||
# Beware that this test uses workspace 9 to perform some tests (it expects
|
||||
# the workspace to be empty).
|
||||
# TODO: skip it by default?
|
||||
|
||||
use i3test tests => 7;
|
||||
use i3test tests => 10;
|
||||
use X11::XCB qw(:all);
|
||||
use Time::HiRes qw(sleep);
|
||||
use List::Util qw(first);
|
||||
|
||||
BEGIN {
|
||||
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
|
||||
@ -14,33 +12,68 @@ BEGIN {
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
my $i3 = i3;
|
||||
|
||||
# Switch to the nineth workspace
|
||||
$i3->command('9')->recv;
|
||||
my $i3 = i3("/tmp/nestedcons");
|
||||
my $tmp = get_unused_workspace();
|
||||
$i3->command("workspace $tmp")->recv;
|
||||
|
||||
#####################################################################
|
||||
# Create two windows and put them in stacking mode
|
||||
#####################################################################
|
||||
|
||||
my $top = i3test::open_standard_window($x);
|
||||
sleep 0.25;
|
||||
my $bottom = i3test::open_standard_window($x);
|
||||
sleep 0.25;
|
||||
$i3->command('split v')->recv;
|
||||
|
||||
$i3->command('s')->recv;
|
||||
my $top = i3test::open_standard_window($x);
|
||||
my $bottom = i3test::open_standard_window($x);
|
||||
|
||||
my @urgent = grep { $_->{urgent} == 1 } @{get_ws_content($tmp)};
|
||||
is(@urgent, 0, 'no window got the urgent flag');
|
||||
|
||||
#$i3->command('layout stacking')->recv;
|
||||
|
||||
#####################################################################
|
||||
# Add the urgency hint, switch to a different workspace and back again
|
||||
#####################################################################
|
||||
$top->add_hint('urgency');
|
||||
sleep 1;
|
||||
sleep 0.5;
|
||||
|
||||
$i3->command('1')->recv;
|
||||
$i3->command('9')->recv;
|
||||
$i3->command('1')->recv;
|
||||
@content = @{get_ws_content($tmp)};
|
||||
@urgent = grep { $_->{urgent} == 1 } @content;
|
||||
$top_info = first { $_->{window} == $top->id } @content;
|
||||
$bottom_info = first { $_->{window} == $bottom->id } @content;
|
||||
|
||||
my $std = i3test::open_standard_window($x);
|
||||
sleep 0.25;
|
||||
$std->add_hint('urgency');
|
||||
sleep 1;
|
||||
is($top_info->{urgent}, 1, 'top window is marked urgent');
|
||||
is($bottom_info->{urgent}, 0, 'bottom window is not marked urgent');
|
||||
is(@urgent, 1, 'exactly one window got the urgent flag');
|
||||
|
||||
$i3->command('[id="' . $top->id . '"] focus')->recv;
|
||||
|
||||
@urgent = grep { $_->{urgent} == 1 } @{get_ws_content($tmp)};
|
||||
is(@urgent, 0, 'no window got the urgent flag after focusing');
|
||||
|
||||
$top->add_hint('urgency');
|
||||
sleep 0.5;
|
||||
|
||||
@urgent = grep { $_->{urgent} == 1 } @{get_ws_content($tmp)};
|
||||
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);
|
||||
is($ws->{urgent}, 0, 'urgent flag not set on workspace');
|
||||
|
||||
my $otmp = get_unused_workspace();
|
||||
$i3->command("workspace $otmp")->recv;
|
||||
|
||||
$top->add_hint('urgency');
|
||||
sleep 0.5;
|
||||
|
||||
$ws = get_ws($tmp);
|
||||
is($ws->{urgent}, 1, 'urgent flag set on workspace');
|
||||
|
||||
$i3->command("workspace $tmp")->recv;
|
||||
|
||||
$ws = get_ws($tmp);
|
||||
is($ws->{urgent}, 0, 'urgent flag not set on workspace after switching');
|
||||
|
||||
diag( "Testing i3, Perl $], $^X" );
|
||||
|
Reference in New Issue
Block a user