2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • https://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Tests the behaviour of 'move <direction>' when moving containers across
18 # outputs on workspaces that have non-default layouts.
20 # Bug still in: 4.10.1-40-g0ad097e
21 use List::Util qw(first);
22 use i3test i3_config => <<EOT;
24 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
26 fake-outputs 1024x768+0+0,1024x768+1024+0,1024x768+1024+768,1024x768+0+768
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
33 workspace_layout stacked
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 #####################################################################
41 cmd 'workspace left-top';
43 my $first = open_window(wm_class => 'first');
44 my $second = open_window(wm_class => 'second');
46 is_num_children('left-top', 1, 'one child on left-top');
47 is_num_children('right-top', 0, 'no children on right-top');
49 # Move the second window into its own stacked container.
51 is_num_children('left-top', 2, 'two children on left-top');
53 # Move the second window onto the upper right workspace.
55 is_num_children('left-top', 1, 'one child on left-top');
56 is_num_children('right-top', 1, 'one child on right-top');
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');
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');
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');
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');
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');
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');
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');