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)
19 use X11::XCB qw(:all);
25 my $cookie = $x->get_property(
28 $x->atom(name => '_NET_WM_STATE')->id,
29 GET_PROPERTY_TYPE_ANY,
34 my $reply = $x->get_property_reply($cookie->{sequence});
35 my $len = $reply->{length};
36 return 0 if $len == 0;
38 my @atoms = unpack("L$len", $reply->{value});
42 my $wm_state_sticky = $x->atom(name => '_NET_WM_STATE_STICKY')->id;
43 my $wm_state_fullscreen = $x->atom(name => '_NET_WM_STATE_FULLSCREEN')->id;
45 ##########################################################################
46 # Given a sticky container, when it is fullscreened, then both wm state
47 # atoms are set. When the container is unfullscreened, then only the
48 # sticky atom is still set.
49 ##########################################################################
52 my $window = open_window;
54 is_deeply(get_wm_state($window), [ $wm_state_sticky ], 'sanity check: _NET_WM_STATE_STICKY is set');
56 cmd 'fullscreen enable';
57 is_deeply(get_wm_state($window), [ $wm_state_sticky, $wm_state_fullscreen ],
58 'both _NET_WM_STATE_FULLSCREEN and _NET_WM_STATE_STICKY are set');
61 is_deeply(get_wm_state($window), [ $wm_state_fullscreen ], 'only _NET_WM_STATE_FULLSCREEN is set');
64 cmd 'fullscreen disable';
65 is_deeply(get_wm_state($window), [ $wm_state_sticky ], 'only _NET_WM_STATE_STICKY is set');
67 ##########################################################################