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 # Regression test: New windows were attached to the container of a floating window
18 # if only a floating window is present on the workspace.
22 my $i3 = i3(get_socket_path());
24 my $tmp = fresh_workspace;
26 #############################################################################
27 # 1: open a floating window, get it mapped
28 #############################################################################
30 # Create a floating window
31 my $window = open_floating_window;
32 ok($window->mapped, 'Window is mapped');
34 my $ws = get_ws($tmp);
35 my ($nodes, $focus) = get_ws_content($tmp);
37 is(@{$ws->{floating_nodes}}, 1, 'one floating node');
38 is(@{$nodes}, 0, 'no tiling nodes');
40 # Create a tiling window
41 my $twindow = open_window;
43 ($nodes, $focus) = get_ws_content($tmp);
45 is(@{$nodes}, 1, 'one tiling node');
47 #############################################################################
48 # 2: similar case: floating windows should be attached at the currently focused
49 # position in the workspace (for example a stack), not just at workspace level.
50 #############################################################################
52 $tmp = fresh_workspace;
54 my $first = open_window;
55 my $second = open_window;
60 is(@{$ws->{floating_nodes}}, 0, 'no floating nodes so far');
61 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
63 # Create a floating window
64 $window = open_floating_window;
65 ok($window->mapped, 'Window is mapped');
68 is(@{$ws->{floating_nodes}}, 1, 'one floating nodes');
69 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
71 my $third = open_window;
75 is(@{$ws->{floating_nodes}}, 1, 'one floating nodes');
76 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');