]> git.sur5r.net Git - i3/i3/blob - testcases/t/13-urgent.t
Expand testcase for urgency hint
[i3/i3] / testcases / t / 13-urgent.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 # Beware that this test uses workspace 9 to perform some tests (it expects
4 # the workspace to be empty).
5 # TODO: skip it by default?
6
7 use Test::More tests => 9;
8 use Test::Deep;
9 use X11::XCB qw(:all);
10 use Data::Dumper;
11 use Time::HiRes qw(sleep);
12 use FindBin;
13 use Digest::SHA1 qw(sha1_base64);
14 use lib "$FindBin::Bin/lib";
15 use i3test;
16
17 BEGIN {
18     use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
19     use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
20 }
21
22 my $x = X11::XCB::Connection->new;
23
24 my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
25 isa_ok($sock, 'IO::Socket::UNIX');
26
27 # Switch to the nineth workspace
28 $sock->write(i3test::format_ipc_command("9"));
29
30 sleep 0.25;
31
32 #####################################################################
33 # Create two windows and put them in stacking mode
34 #####################################################################
35
36 my $top = i3test::open_standard_window($x);
37 sleep 0.25;
38 my $bottom = i3test::open_standard_window($x);
39 sleep 0.25;
40
41 $sock->write(i3test::format_ipc_command("s"));
42 sleep 0.25;
43
44 #####################################################################
45 # Add the urgency hint, switch to a different workspace and back again
46 #####################################################################
47 $top->add_hint('urgency');
48 sleep 1;
49
50 $sock->write(i3test::format_ipc_command("1"));
51 sleep 0.25;
52 $sock->write(i3test::format_ipc_command("9"));
53 sleep 0.25;
54 $sock->write(i3test::format_ipc_command("1"));
55 sleep 0.25;
56
57 my $std = i3test::open_standard_window($x);
58 sleep 0.25;
59 $std->add_hint('urgency');
60 sleep 1;