]> git.sur5r.net Git - i3/i3/blob - testcases/t/523-move-position-center.t
Merge "force_focus_wrapping" option into "focus_wrapping force"
[i3/i3] / testcases / t / 523-move-position-center.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 # Verifies that 'move position center' moves floating cons to the center of
18 # the appropriate output.
19 # Ticket: #1211
20 # Bug still in: 4.9.1-108-g037cb31
21 use i3test i3_config => <<EOT;
22 # i3 config file (v4)
23 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
24
25 fake-outputs 1024x768+0+0,1024x768+1024+0
26
27 workspace left output fake-0
28 workspace right output fake-1
29 EOT
30
31 #####################################################################
32 # Verify that 'move position center' on a floating window does not
33 # move it to another output.
34 #####################################################################
35
36 cmd 'workspace left';
37
38 # Sync in case focus switched outputs due to the workspace change.
39 sync_with_i3;
40
41 my $floating = open_floating_window;
42
43 # Center the window on the left workspace
44 cmd 'move position center';
45 sync_with_i3;
46
47 is(scalar @{get_ws('left')->{floating_nodes}}, 1, 'one floating node on left ws');
48 is(scalar @{get_ws('right')->{floating_nodes}}, 0, 'no floating nodes on right ws');
49
50 # Center the window on the right workspace
51 cmd 'move workspace right; workspace right; move position center';
52 sync_with_i3;
53
54 is(scalar @{get_ws('left')->{floating_nodes}}, 0, 'no floating nodes on left ws');
55 is(scalar @{get_ws('right')->{floating_nodes}}, 1, 'one floating node on right ws');
56
57 done_testing;