]> git.sur5r.net Git - i3/i3/blob - testcases/t/158-wm_take_focus.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 158-wm_take_focus.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Tests if the WM_TAKE_FOCUS protocol is correctly handled by i3
5 #
6 use i3test;
7
8 subtest 'Window without WM_TAKE_FOCUS', sub {
9     fresh_workspace;
10
11     my $window = open_window;
12
13     ok(!wait_for_event(1, sub { $_[0]->{response_type} == 161 }), 'did not receive ClientMessage');
14
15     done_testing;
16 };
17
18 subtest 'Window with WM_TAKE_FOCUS', sub {
19     fresh_workspace;
20
21     my $take_focus = $x->atom(name => 'WM_TAKE_FOCUS');
22
23     my $window = open_window({
24         dont_map => 1,
25         protocols => [ $take_focus ],
26     });
27
28     $window->map;
29
30     ok(wait_for_event(1, sub {
31         return 0 unless $_[0]->{response_type} == 161;
32         my ($data, $time) = unpack("L2", $_[0]->{data});
33         return ($data == $take_focus->id);
34     }), 'got ClientMessage with WM_TAKE_FOCUS atom');
35
36     done_testing;
37 };
38
39
40 done_testing;