]> git.sur5r.net Git - i3/i3/blob - testcases/t/138-floating-attach.t
Merge branch 'doc-fixes'
[i3/i3] / testcases / t / 138-floating-attach.t
1 #!perl
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.
5
6 use i3test;
7 use X11::XCB qw(:all);
8
9 BEGIN {
10     use_ok('X11::XCB::Window');
11 }
12
13 my $i3 = i3(get_socket_path());
14
15 my $tmp = fresh_workspace;
16
17 #############################################################################
18 # 1: open a floating window, get it mapped
19 #############################################################################
20
21 my $x = X11::XCB::Connection->new;
22
23 # Create a floating window
24 my $window = open_floating_window($x);
25 ok($window->mapped, 'Window is mapped');
26
27 my $ws = get_ws($tmp);
28 my ($nodes, $focus) = get_ws_content($tmp);
29
30 is(@{$ws->{floating_nodes}}, 1, 'one floating node');
31 is(@{$nodes}, 0, 'no tiling nodes');
32
33 # Create a tiling window
34 my $twindow = open_window($x);
35
36 ($nodes, $focus) = get_ws_content($tmp);
37
38 is(@{$nodes}, 1, 'one tiling node');
39
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 #############################################################################
44
45 $tmp = fresh_workspace;
46
47 my $first = open_window($x);
48 my $second = open_window($x);
49
50 cmd 'layout stacked';
51
52 $ws = get_ws($tmp);
53 is(@{$ws->{floating_nodes}}, 0, 'no floating nodes so far');
54 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
55
56 # Create a floating window
57 my $window = open_floating_window($x);
58 ok($window->mapped, 'Window is mapped');
59
60 $ws = get_ws($tmp);
61 is(@{$ws->{floating_nodes}}, 1, 'one floating nodes');
62 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
63
64 my $third = open_window($x);
65
66
67 $ws = get_ws($tmp);
68 is(@{$ws->{floating_nodes}}, 1, 'one floating nodes');
69 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
70
71 done_testing;