#!perl # vim:ts=4:sw=4:expandtab # # Please read the following documents before working on tests: # • http://build.i3wm.org/docs/testsuite.html # (or docs/testsuite) # # • http://build.i3wm.org/docs/lib-i3test.html # (alternatively: perldoc ./testcases/lib/i3test.pm) # # • http://build.i3wm.org/docs/ipc.html # (or docs/ipc) # # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf # (unless you are already familiar with Perl) # # Test that the EWMH specified property _NET_DESKTOP_VIEWPORT is updated # properly on the root window. We interpret this as a list of x/y coordinate # pairs for the upper left corner of the respective outputs of the workspaces # Ticket: #1241 use i3test i3_config => <get_property( 0, $x->get_root_window(), $x->atom(name => '_NET_DESKTOP_VIEWPORT')->id, $x->atom(name => 'CARDINAL')->id, 0, 4096 ); my $reply = $x->get_property_reply($cookie->{sequence}); return 0 if $reply->{value_len} == 0; my $len = $reply->{length}; return unpack ("L$len", $reply->{value}); } # initialize the workspaces cmd 'workspace 1'; cmd 'workspace 0'; my @expected_viewport = (0, 0, 1024, 0); my @desktop_viewport = get_desktop_viewport; is_deeply(\@desktop_viewport, \@expected_viewport, '_NET_DESKTOP_VIEWPORT should be an array of x/y coordinate pairs for the upper left corner of the respective outputs of the workspaces'); cmd 'workspace 0'; open_window; cmd 'workspace 3'; @expected_viewport = (0, 0, 0, 0, 1024, 0); @desktop_viewport = get_desktop_viewport; is_deeply(\@desktop_viewport, \@expected_viewport, 'it should be updated when a new workspace appears'); cmd 'rename workspace 3 to 2'; @expected_viewport = (0, 0, 0, 0, 1024, 0); @desktop_viewport = get_desktop_viewport; is_deeply(\@desktop_viewport, \@expected_viewport, 'it should stay up to date when a workspace is renamed'); cmd 'workspace 0'; @expected_viewport = (0, 0, 1024, 0); @desktop_viewport = get_desktop_viewport; is_deeply(\@desktop_viewport, \@expected_viewport, 'it should be updated when a workspace is emptied'); done_testing;