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 _NET_WM_DESKTOP.
19 use i3test i3_config => <<EOT;
21 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
23 workspace "0" output "fake-0"
24 workspace "1" output "fake-0"
25 workspace "2" output "fake-0"
26 workspace "10" output "fake-1"
27 workspace "11" output "fake-1"
28 workspace "12" output "fake-1"
30 fake-outputs 1024x768+0+0,1024x768+1024+0
32 use X11::XCB qw(:all);
34 sub get_net_wm_desktop {
38 my $cookie = $x->get_property(
41 $x->atom(name => '_NET_WM_DESKTOP')->id,
42 $x->atom(name => 'CARDINAL')->id,
47 my $reply = $x->get_property_reply($cookie->{sequence});
48 return undef if $reply->{length} != 1;
50 return unpack("L", $reply->{value});
53 ###############################################################################
54 # _NET_WM_DESKTOP is updated when the window is moved to another workspace
56 ###############################################################################
63 my $con = open_window;
65 cmd 'move window to workspace 10';
67 is(get_net_wm_desktop($con), 1, '_NET_WM_DESKTOP is updated when moving the window');