]> git.sur5r.net Git - i3/i3/blob - testcases/t/164-kill-win-vs-client.t
testcases: drop open_window()s $x parameter, use global one instead
[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 sub two_windows {
10     my $tmp = fresh_workspace;
11
12     ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
13
14     my $first = open_window;
15     my $second = open_window;
16
17     sync_with_i3 $x;
18
19     is($x->input_focus, $second->id, 'second window focused');
20     ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
21
22     return $tmp;
23 }
24
25 ##############################################################
26 # 1: open two windows (in the same client), kill one and see if
27 # the other one is still there
28 ##############################################################
29
30 my $tmp = two_windows;
31
32 cmd 'kill';
33
34 sleep 0.25;
35
36 ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
37
38 ##############################################################
39 # 2: same test case as test 1, but with the explicit variant
40 # 'kill window'
41 ##############################################################
42
43 $tmp = two_windows;
44
45 cmd 'kill window';
46
47 sleep 0.25;
48
49 ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
50
51 ##############################################################
52 # 3: open two windows (in the same client), use 'kill client'
53 # and check if both are gone
54 ##############################################################
55
56 $tmp = two_windows;
57
58 cmd 'kill client';
59
60 sleep 0.25;
61
62 ok(@{get_ws_content($tmp)} == 0, 'no containers left after killing');
63
64 done_testing;