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 that fullscreen windows appear on the output indicated by
19 use i3test i3_config => <<EOT;
21 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
23 fake-outputs 1024x768+0+0,1024x768+1024+0
25 use List::Util qw(first);
30 $window->fullscreen(1);
34 my ($nodes, $id) = @_;
37 return $_ if ($_->{window} // 0) == $id;
38 my $node = find_window($_->{nodes}, $id);
39 return $node if $node;
44 # Create two fullscreen windows, each on different output
45 my $orig_rect1 = X11::XCB::Rect->new(x => 0, y => 0, width => 1024, height => 768);
46 my $orig_rect2 = X11::XCB::Rect->new(x => 1024, y => 0, width => 1024, height => 768);
48 my $win_on_first_output = open_window(rect => $orig_rect1,
49 before_map => \&fullscreen);
51 my $win_on_second_output = open_window(rect => $orig_rect2,
52 before_map => \&fullscreen);
56 # Check that the windows are on the correct output
57 is_deeply(scalar $win_on_first_output->rect, $orig_rect1, "first window spans the first output");
58 is_deeply(scalar $win_on_second_output->rect, $orig_rect2, "second window spans the sencond output");
60 # Check that both windows remained fullscreen
61 my $tree = i3(get_socket_path())->get_tree->recv;
63 my $node1 = find_window($tree->{nodes}, $win_on_first_output->{id});
64 my $node2 = find_window($tree->{nodes}, $win_on_second_output->{id});
66 is($node1->{fullscreen_mode}, 1, "first window is fullscreen");
67 is($node2->{fullscreen_mode}, 1, "second window is fullscreen");