]> git.sur5r.net Git - i3/i3/blob - testcases/t/164-kill-win-vs-client.t
Merge branch 'displayversion'
[i3/i3] / testcases / t / 164-kill-win-vs-client.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Tests if WM_STATE is WM_STATE_NORMAL when mapped and WM_STATE_WITHDRAWN when
5 # unmapped.
6 #
7 use i3test;
8
9 my $x = X11::XCB::Connection->new;
10
11 sub two_windows {
12     my $tmp = fresh_workspace;
13
14     ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
15
16     my $first = open_window($x);
17     my $second = open_window($x);
18
19     sync_with_i3 $x;
20
21     is($x->input_focus, $second->id, 'second window focused');
22     ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
23
24     return $tmp;
25 }
26
27 ##############################################################
28 # 1: open two windows (in the same client), kill one and see if
29 # the other one is still there
30 ##############################################################
31
32 my $tmp = two_windows;
33
34 cmd 'kill';
35
36 sleep 0.25;
37
38 ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
39
40 ##############################################################
41 # 2: same test case as test 1, but with the explicit variant
42 # 'kill window'
43 ##############################################################
44
45 my $tmp = two_windows;
46
47 cmd 'kill window';
48
49 sleep 0.25;
50
51 ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
52
53 ##############################################################
54 # 3: open two windows (in the same client), use 'kill client'
55 # and check if both are gone
56 ##############################################################
57
58 my $tmp = two_windows;
59
60 cmd 'kill client';
61
62 sleep 0.25;
63
64 ok(@{get_ws_content($tmp)} == 0, 'no containers left after killing');
65
66 done_testing;