]> git.sur5r.net Git - i3/i3/blob - testcases/t/211-regress-urgency-assign.t
Merge branch 'release-4.16.1'
[i3/i3] / testcases / t / 211-regress-urgency-assign.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 # Verifies that windows are properly recognized as urgent when they start up
18 # with the urgency hint already set (and are assigned to a non-visible
19 # workspace).
20 #
21 # Ticket: #1086
22 # Bug still in: 4.6-62-g7098ef6
23 use i3test i3_config => <<EOT;
24 # i3 config file (v4)
25 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
26
27 assign [class="special"] nonvisible
28 EOT
29
30 sub open_special {
31     my %args = @_;
32     $args{name} //= 'special window';
33
34     # We use dont_map because i3 will not map the window on the current
35     # workspace. Thus, open_window would time out in wait_for_map (2 seconds).
36     my $window = open_window(
37         %args,
38         wm_class => 'special',
39         dont_map => 1,
40     );
41     $window->add_hint('urgency');
42     $window->map;
43     return $window;
44 }
45
46 my $tmp = fresh_workspace;
47
48 ok((scalar grep { $_ eq 'nonvisible' } @{get_workspace_names()}) == 0,
49    'assignment destination workspace does not exist yet');
50
51 my $window = open_special;
52 sync_with_i3;
53
54 ok((scalar grep { $_ eq 'nonvisible' } @{get_workspace_names()}) > 0,
55    'assignment destination workspace exists');
56
57 my @urgent = grep { $_->{urgent} } @{get_ws_content('nonvisible')};
58 isnt(@urgent, 0, 'urgent window(s) found on destination workspace');
59
60 done_testing;