2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • https://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 # Tests for our proprietary atom I3_FLOATING_WINDOW to allow
18 # identifying floating windows.
21 use X11::XCB qw(:all);
25 sub has_i3_floating_window {
29 my $cookie = $x->get_property(
32 $x->atom(name => 'I3_FLOATING_WINDOW')->id,
33 $x->atom(name => 'CARDINAL')->id,
38 my $reply = $x->get_property_reply($cookie->{sequence});
39 return 0 if $reply->{length} != 1;
41 return unpack("L", $reply->{value});
44 ###############################################################################
45 # Toggling floating on a container adds / removes I3_FLOATING_WINDOW.
46 ###############################################################################
51 is(has_i3_floating_window($con), 0, 'I3_FLOATING_WINDOW is not set');
53 cmd 'floating enable';
54 is(has_i3_floating_window($con), 1, 'I3_FLOATING_WINDOW is set');
56 cmd 'floating disable';
57 is(has_i3_floating_window($con), 0, 'I3_FLOATING_WINDOW is not set');
59 ###############################################################################
60 # A window that is floated when managed has I3_FLOATING_WINDOW set.
61 ###############################################################################
65 $con = open_floating_window;
66 is(has_i3_floating_window($con), 1, 'I3_FLOATING_WINDOW is set');
68 ###############################################################################