2 # vim:ts=4:sw=4:expandtab
3 # Regression test: New windows were attached to the container of a floating window
4 # if only a floating window is present on the workspace.
10 use_ok('X11::XCB::Window');
13 my $i3 = i3(get_socket_path());
15 my $tmp = fresh_workspace;
17 #############################################################################
18 # 1: open a floating window, get it mapped
19 #############################################################################
21 my $x = X11::XCB::Connection->new;
23 # Create a floating window
24 my $window = open_floating_window($x);
25 ok($window->mapped, 'Window is mapped');
27 my $ws = get_ws($tmp);
28 my ($nodes, $focus) = get_ws_content($tmp);
30 is(@{$ws->{floating_nodes}}, 1, 'one floating node');
31 is(@{$nodes}, 0, 'no tiling nodes');
33 # Create a tiling window
34 my $twindow = open_window($x);
36 ($nodes, $focus) = get_ws_content($tmp);
38 is(@{$nodes}, 1, 'one tiling node');
40 #############################################################################
41 # 2: similar case: floating windows should be attached at the currently focused
42 # position in the workspace (for example a stack), not just at workspace level.
43 #############################################################################
45 $tmp = fresh_workspace;
47 my $first = open_window($x);
48 my $second = open_window($x);
53 is(@{$ws->{floating_nodes}}, 0, 'no floating nodes so far');
54 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
56 # Create a floating window
57 my $window = open_floating_window($x);
58 ok($window->mapped, 'Window is mapped');
61 is(@{$ws->{floating_nodes}}, 1, 'one floating nodes');
62 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
64 my $third = open_window($x);
68 is(@{$ws->{floating_nodes}}, 1, 'one floating nodes');
69 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');