2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Test that _NET_CLIENT_LIST is properly updated on the root window as windows
18 # are mapped and unmapped.
20 # Information on this property can be found here:
21 # http://standards.freedesktop.org/wm-spec/latest/ar01s03.html
23 # > These arrays contain all X Windows managed by the Window Manager.
24 # > _NET_CLIENT_LIST has initial mapping order, starting with the oldest window.
27 # Bug still in: 4.7.2-8-ge6cce92
31 my $cookie = $x->get_property(
33 $x->get_root_window(),
34 $x->atom(name => '_NET_CLIENT_LIST')->id,
35 $x->atom(name => 'WINDOW')->id,
39 my $reply = $x->get_property_reply($cookie->{sequence});
40 my $len = $reply->{length};
42 return () if $len == 0;
43 return unpack("L$len", $reply->{value});
46 # Mapping a window should give us one client in _NET_CLIENT_LIST
47 my $win1 = open_window;
49 my @clients = get_client_list;
51 is(@clients, 1, 'One client in _NET_CLIENT_LIST');
52 is($clients[0], $win1->{id}, 'Correct client in position one');
54 # Mapping another window should give us two clients in the list with the last
55 # client mapped in the last position
56 my $win2 = open_window;
58 @clients = get_client_list;
59 is(@clients, 2, 'Added mapped client to list (2)');
60 is($clients[0], $win1->{id}, 'Correct client in position one');
61 is($clients[1], $win2->{id}, 'Correct client in position two');
63 # Mapping another window should give us three clients in the list in the order
65 my $win3 = open_window;
67 @clients = get_client_list;
68 is(@clients, 3, 'Added mapped client to list (3)');
69 is($clients[0], $win1->{id}, 'Correct client in position one');
70 is($clients[1], $win2->{id}, 'Correct client in position two');
71 is($clients[2], $win3->{id}, 'Correct client in position three');
73 # Unmapping the second window should give us the two remaining clients in the
74 # order they were mapped
76 wait_for_unmap($win2);
78 @clients = get_client_list;
79 is(@clients, 2, 'Removed unmapped client from list (2)');
80 is($clients[0], $win1->{id}, 'Correct client in position one');
81 is($clients[1], $win3->{id}, 'Correct client in position two');
83 # Unmapping the first window should give us only the remaining mapped window in
86 wait_for_unmap($win1);
88 @clients = get_client_list;
89 is(@clients, 1, 'Removed unmapped client from list (1)');
90 is($clients[0], $win3->{id}, 'Correct client in position one');
92 # Unmapping the last window should give us an empty list
94 wait_for_unmap($win3);
96 @clients = get_client_list;
97 is(@clients, 0, 'Removed unmapped client from list (0)');
99 # Dock clients should not be included in this list
101 my $dock_win = open_window({
102 window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
105 @clients = get_client_list;
106 is(@clients, 0, 'Dock clients are not included in the list');