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)
17 # Tests that fullscreen windows appear on the output indicated by
19 use i3test i3_autostart => 0;
20 use List::Util qw(first);
24 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
26 fake-outputs 1024x768+0+0,1024x768+1024+0
29 my $pid = launch_with_config($config);
34 $window->fullscreen(1);
38 my ($nodes, $id) = @_;
41 return $_ if ($_->{window} // 0) == $id;
42 my $node = find_window($_->{nodes}, $id);
43 return $node if $node;
48 # Create two fullscreen windows, each on different output
49 my $orig_rect1 = X11::XCB::Rect->new(x => 0, y => 0, width => 1024, height => 768);
50 my $orig_rect2 = X11::XCB::Rect->new(x => 1024, y => 0, width => 1024, height => 768);
52 my $win_on_first_output = open_window(rect => $orig_rect1,
53 before_map => \&fullscreen);
55 my $win_on_second_output = open_window(rect => $orig_rect2,
56 before_map => \&fullscreen);
60 # Check that the windows are on the correct output
61 is_deeply(scalar $win_on_first_output->rect, $orig_rect1, "first window spans the first output");
62 is_deeply(scalar $win_on_second_output->rect, $orig_rect2, "second window spans the sencond output");
64 # Check that both windows remained fullscreen
65 my $tree = i3(get_socket_path())->get_tree->recv;
67 my $node1 = find_window($tree->{nodes}, $win_on_first_output->{id});
68 my $node2 = find_window($tree->{nodes}, $win_on_second_output->{id});
70 is($node1->{fullscreen_mode}, 1, "first window is fullscreen");
71 is($node2->{fullscreen_mode}, 1, "second window is fullscreen");
73 exit_gracefully($pid);