]> git.sur5r.net Git - i3/i3/blob - testcases/t/524-move.t
Allow single-child non-default layout cons to be moved between outputs
[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_autostart => 0;
23
24 my $config = <<EOT;
25 # i3 config file (v4)
26 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
27
28 fake-outputs 1024x768+0+0,1024x768+1024+0,1024x768+1024+768,1024x768+0+768
29
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
34
35 workspace_layout stacked
36 EOT
37
38 my $pid = launch_with_config($config);
39
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 #####################################################################
44
45 cmd 'workspace left-top';
46
47 my $first = open_window(wm_class => 'first');
48 my $second = open_window(wm_class => 'second');
49
50 is_num_children('left-top', 1, 'one child on left-top');
51 is_num_children('right-top', 0, 'no children on right-top');
52
53 # Move the second window into its own stacked container.
54 cmd 'move right';
55 is_num_children('left-top', 2, 'two children on left-top');
56
57 # Move the second window onto the upper right workspace.
58 cmd 'move right';
59 is_num_children('left-top', 1, 'one child on left-top');
60 is_num_children('right-top', 1, 'one child on right-top');
61
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');
66
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');
71
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');
76
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');
81
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');
86
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');
91
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');
96
97 exit_gracefully($pid);
98
99 done_testing;