]> git.sur5r.net Git - i3/i3/blob - testcases/t/524-move.t
tests: use i3_config arg instead of precisely one launch_with_config
[i3/i3] / testcases / t / 524-move.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 # Tests the behaviour of 'move <direction>' when moving containers across
18 # outputs on workspaces that have non-default layouts.
19 # Ticket: #1603
20 # Bug still in: 4.10.1-40-g0ad097e
21 use List::Util qw(first);
22 use i3test i3_config => <<EOT;
23 # i3 config file (v4)
24 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
25
26 fake-outputs 1024x768+0+0,1024x768+1024+0,1024x768+1024+768,1024x768+0+768
27
28 workspace left-top output fake-0
29 workspace right-top output fake-1
30 workspace right-bottom output fake-2
31 workspace left-bottom output fake-3
32
33 workspace_layout stacked
34 EOT
35
36 #####################################################################
37 # Create two windows in the upper left workspace and move them
38 # clockwise around the workspaces until the end up where they began.
39 #####################################################################
40
41 cmd 'workspace left-top';
42
43 my $first = open_window(wm_class => 'first');
44 my $second = open_window(wm_class => 'second');
45
46 is_num_children('left-top', 1, 'one child on left-top');
47 is_num_children('right-top', 0, 'no children on right-top');
48
49 # Move the second window into its own stacked container.
50 cmd 'move right';
51 is_num_children('left-top', 2, 'two children on left-top');
52
53 # Move the second window onto the upper right workspace.
54 cmd 'move right';
55 is_num_children('left-top', 1, 'one child on left-top');
56 is_num_children('right-top', 1, 'one child on right-top');
57
58 # Move the first window onto the upper right workspace.
59 cmd '[class="first"] move right';
60 is_num_children('left-top', 0, 'no children on left-top');
61 is_num_children('right-top', 2, 'two children on right-top');
62
63 # Move the second window onto the lower right workspace.
64 cmd '[class="second"] move down, move down';
65 is_num_children('right-top', 1, 'one child on right-top');
66 is_num_children('right-bottom', 1, 'two children on right-bottom');
67
68 # Move the first window onto the lower right workspace.
69 cmd '[class="first"] move down';
70 is_num_children('right-top', 0, 'no children on right-top');
71 is_num_children('right-bottom', 2, 'two children on right-bottom');
72
73 # Move the second windo onto the lower left workspace.
74 cmd '[class="second"] move left, move left';
75 is_num_children('right-bottom', 1, 'one child on right-bottom');
76 is_num_children('left-bottom', 1, 'one on left-bottom');
77
78 # Move the first window onto the lower left workspace.
79 cmd '[class="first"] move left';
80 is_num_children('right-bottom', 0, 'no children on right-bottom');
81 is_num_children('left-bottom', 2, 'two children on left-bottom');
82
83 # Move the second window onto the upper left workspace.
84 cmd '[class="second"] move up, move up';
85 is_num_children('left-bottom', 1, 'one child on left-bottom');
86 is_num_children('left-top', 1, 'one child on left-top');
87
88 # Move the first window onto the upper left workspace.
89 cmd '[class="first"] move up';
90 is_num_children('left-bottom', 0, 'no children on left-bottom');
91 is_num_children('left-top', 2, 'two children on left-top');
92
93 done_testing;