2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://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_autostart => 0;
26 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
28 fake-outputs 1024x768+0+0,1024x768+1024+0,1024x768+1024+768,1024x768+0+768
30 workspace left-top output fake-0
31 workspace right-top output fake-1
32 workspace right-bottom output fake-2
33 workspace left-bottom output fake-3
35 workspace_layout stacked
38 my $pid = launch_with_config($config);
40 #####################################################################
41 # Create two windows in the upper left workspace and move them
42 # clockwise around the workspaces until the end up where they began.
43 #####################################################################
45 cmd 'workspace left-top';
47 my $first = open_window(wm_class => 'first');
48 my $second = open_window(wm_class => 'second');
50 is_num_children('left-top', 1, 'one child on left-top');
51 is_num_children('right-top', 0, 'no children on right-top');
53 # Move the second window into its own stacked container.
55 is_num_children('left-top', 2, 'two children on left-top');
57 # Move the second window onto the upper right workspace.
59 is_num_children('left-top', 1, 'one child on left-top');
60 is_num_children('right-top', 1, 'one child on right-top');
62 # Move the first window onto the upper right workspace.
63 cmd '[class="first"] move right';
64 is_num_children('left-top', 0, 'no children on left-top');
65 is_num_children('right-top', 2, 'two children on right-top');
67 # Move the second window onto the lower right workspace.
68 cmd '[class="second"] move down, move down';
69 is_num_children('right-top', 1, 'one child on right-top');
70 is_num_children('right-bottom', 1, 'two children on right-bottom');
72 # Move the first window onto the lower right workspace.
73 cmd '[class="first"] move down';
74 is_num_children('right-top', 0, 'no children on right-top');
75 is_num_children('right-bottom', 2, 'two children on right-bottom');
77 # Move the second windo onto the lower left workspace.
78 cmd '[class="second"] move left, move left';
79 is_num_children('right-bottom', 1, 'one child on right-bottom');
80 is_num_children('left-bottom', 1, 'one on left-bottom');
82 # Move the first window onto the lower left workspace.
83 cmd '[class="first"] move left';
84 is_num_children('right-bottom', 0, 'no children on right-bottom');
85 is_num_children('left-bottom', 2, 'two children on left-bottom');
87 # Move the second window onto the upper left workspace.
88 cmd '[class="second"] move up, move up';
89 is_num_children('left-bottom', 1, 'one child on left-bottom');
90 is_num_children('left-top', 1, 'one child on left-top');
92 # Move the first window onto the upper left workspace.
93 cmd '[class="first"] move up';
94 is_num_children('left-bottom', 0, 'no children on left-bottom');
95 is_num_children('left-top', 2, 'two children on left-top');
97 exit_gracefully($pid);