]> git.sur5r.net Git - i3/i3/blob - testcases/t/138-floating-attach.t
Fix incorrect y-offset for text in i3bar
[i3/i3] / testcases / t / 138-floating-attach.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • http://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
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.
19
20 use i3test;
21
22 my $i3 = i3(get_socket_path());
23
24 my $tmp = fresh_workspace;
25
26 #############################################################################
27 # 1: open a floating window, get it mapped
28 #############################################################################
29
30 # Create a floating window
31 my $window = open_floating_window;
32 ok($window->mapped, 'Window is mapped');
33
34 my $ws = get_ws($tmp);
35 my ($nodes, $focus) = get_ws_content($tmp);
36
37 is(@{$ws->{floating_nodes}}, 1, 'one floating node');
38 is(@{$nodes}, 0, 'no tiling nodes');
39
40 # Create a tiling window
41 my $twindow = open_window;
42
43 ($nodes, $focus) = get_ws_content($tmp);
44
45 is(@{$nodes}, 1, 'one tiling node');
46
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 #############################################################################
51
52 $tmp = fresh_workspace;
53
54 my $first = open_window;
55 my $second = open_window;
56
57 cmd 'layout stacked';
58
59 $ws = get_ws($tmp);
60 is(@{$ws->{floating_nodes}}, 0, 'no floating nodes so far');
61 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
62
63 # Create a floating window
64 $window = open_floating_window;
65 ok($window->mapped, 'Window is mapped');
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 my $third = open_window;
72
73
74 $ws = get_ws($tmp);
75 is(@{$ws->{floating_nodes}}, 1, 'one floating nodes');
76 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
77
78 done_testing;