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);
23 my $atom = $x->atom(name => '_NET_WM_STATE_HIDDEN');
26 my $cookie = $x->get_property(
29 $x->atom(name => '_NET_WM_STATE')->id,
30 GET_PROPERTY_TYPE_ANY,
35 my $reply = $x->get_property_reply($cookie->{sequence});
36 my $len = $reply->{length};
37 return 0 if $len == 0;
39 my @atoms = unpack("L$len", $reply->{value});
43 my $wm_state_sticky = $x->atom(name => '_NET_WM_STATE_STICKY')->id;
44 my $wm_state_fullscreen = $x->atom(name => '_NET_WM_STATE_FULLSCREEN')->id;
46 ##########################################################################
47 # Given a sticky container, when it is fullscreened, then both wm state
48 # atoms are set. When the container is unfullscreened, then only the
49 # sticky atom is still set.
50 ##########################################################################
53 my $window = open_window;
55 is_deeply(get_wm_state($window), [ $wm_state_sticky ], 'sanity check: _NET_WM_STATE_STICKY is set');
57 cmd 'fullscreen enable';
58 is_deeply(get_wm_state($window), [ $wm_state_sticky, $wm_state_fullscreen ],
59 'both _NET_WM_STATE_FULLSCREEN and _NET_WM_STATE_STICKY are set');
62 is_deeply(get_wm_state($window), [ $wm_state_fullscreen ], 'only _NET_WM_STATE_FULLSCREEN is set');
65 cmd 'fullscreen disable';
66 is_deeply(get_wm_state($window), [ $wm_state_sticky ], 'only _NET_WM_STATE_STICKY is set');
68 ##########################################################################