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 # Verifies that windows with properties that indicate they should be floating
18 # are indeed opened floating.
20 # Bug still in: 4.7.2-97-g84fc808
22 use X11::XCB qw(PROP_MODE_REPLACE);
25 my $window_type = shift;
27 my $window = open_window(
28 window_type => $x->atom(name => $window_type),
34 my $window_state = shift;
36 my $window = open_window(
40 my $atomname = $x->atom(name => '_NET_WM_STATE');
41 my $atomtype = $x->atom(name => 'ATOM');
49 pack('L1', $x->atom(name => $window_state)->id),
57 sub open_with_fixed_size {
58 # The type of the WM_NORMAL_HINTS property is WM_SIZE_HINTS
59 # https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.2.3
60 my $XCB_ICCCM_SIZE_HINT_P_MIN_SIZE = 0x32;
61 my $XCB_ICCCM_SIZE_HINT_P_MAX_SIZE = 0x16;
63 my $flags = $XCB_ICCCM_SIZE_HINT_P_MIN_SIZE | $XCB_ICCCM_SIZE_HINT_P_MAX_SIZE;
72 my $window = open_window(
76 my $atomname = $x->atom(name => 'WM_NORMAL_HINTS');
77 my $atomtype = $x->atom(name => 'WM_SIZE_HINTS');
85 pack('C5N8', $flags, $pad, $pad, $pad, $pad, 0, 0, 0, $min_width, $min_height, $max_width, $max_height),
93 my $ws = fresh_workspace;
95 my $window = open_with_type '_NET_WM_WINDOW_TYPE_DIALOG';
96 is(get_ws($ws)->{floating_nodes}[0]->{nodes}[0]->{window}, $window->id, 'Dialog window opened floating');
99 $window = open_with_type '_NET_WM_WINDOW_TYPE_UTILITY';
100 is(get_ws($ws)->{floating_nodes}[0]->{nodes}[0]->{window}, $window->id, 'Utility window opened floating');
103 $window = open_with_type '_NET_WM_WINDOW_TYPE_TOOLBAR';
104 is(get_ws($ws)->{floating_nodes}[0]->{nodes}[0]->{window}, $window->id, 'Toolbar window opened floating');
107 $window = open_with_type '_NET_WM_WINDOW_TYPE_SPLASH';
108 is(get_ws($ws)->{floating_nodes}[0]->{nodes}[0]->{window}, $window->id, 'Splash window opened floating');
111 $window = open_with_state '_NET_WM_STATE_MODAL';
112 is(get_ws($ws)->{floating_nodes}[0]->{nodes}[0]->{window}, $window->id, 'Modal window opened floating');
115 $window = open_with_fixed_size;
116 is(get_ws($ws)->{floating_nodes}[0]->{nodes}[0]->{window}, $window->id, 'Fixed size window opened floating');
117 is(get_ws($ws)->{floating_nodes}[0]->{nodes}[0]->{window_rect}->{width}, 150, 'Fixed size window opened with minimum width');
118 is(get_ws($ws)->{floating_nodes}[0]->{nodes}[0]->{window_rect}->{height}, 100, 'Fixed size window opened with minimum height');