]> git.sur5r.net Git - i3/i3/blob - testcases/t/523-move-position-center.t
Merge pull request #1805 from lasers/next
[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_autostart => 0;
22
23 my $config = <<EOT;
24 # i3 config file (v4)
25 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
26
27 fake-outputs 1024x768+0+0,1024x768+1024+0
28
29 workspace left output fake-0
30 workspace right output fake-1
31 EOT
32
33 my $pid = launch_with_config($config);
34
35 #####################################################################
36 # Verify that 'move position center' on a floating window does not
37 # move it to another output.
38 #####################################################################
39
40 cmd 'workspace left';
41
42 # Sync in case focus switched outputs due to the workspace change.
43 sync_with_i3;
44
45 my $floating = open_floating_window;
46
47 # Center the window on the left workspace
48 cmd 'move position center';
49 sync_with_i3;
50
51 is(scalar @{get_ws('left')->{floating_nodes}}, 1, 'one floating node on left ws');
52 is(scalar @{get_ws('right')->{floating_nodes}}, 0, 'no floating nodes on right ws');
53
54 # Center the window on the right workspace
55 cmd 'move workspace right; workspace right; move position center';
56 sync_with_i3;
57
58 is(scalar @{get_ws('left')->{floating_nodes}}, 0, 'no floating nodes on left ws');
59 is(scalar @{get_ws('right')->{floating_nodes}}, 1, 'one floating node on right ws');
60
61 exit_gracefully($pid);
62
63 done_testing;