aboutsummaryrefslogtreecommitdiff
path: root/testcases/t/524-move.t
blob: b9ae6098e4972dbee239029c8c17a3fc1f68352c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!perl
# vim:ts=4:sw=4:expandtab
#
# Please read the following documents before working on tests:
# • https://build.i3wm.org/docs/testsuite.html
#   (or docs/testsuite)
#
# • https://build.i3wm.org/docs/lib-i3test.html
#   (alternatively: perldoc ./testcases/lib/i3test.pm)
#
# • https://build.i3wm.org/docs/ipc.html
#   (or docs/ipc)
#
# • https://i3wm.org/downloads/modern_perl_a4.pdf
#   (unless you are already familiar with Perl)
#
# Tests the behaviour of 'move <direction>' when moving containers across
# outputs on workspaces that have non-default layouts.
# Ticket: #1603
# Bug still in: 4.10.1-40-g0ad097e
use List::Util qw(first);
use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1

fake-outputs 1024x768+0+0,1024x768+1024+0,1024x768+1024+768,1024x768+0+768

workspace left-top output fake-0
workspace right-top output fake-1
workspace right-bottom output fake-2
workspace left-bottom output fake-3

workspace_layout stacked
EOT

#####################################################################
# Create two windows in the upper left workspace and move them
# clockwise around the workspaces until the end up where they began.
#####################################################################

cmd 'workspace left-top';

my $first = open_window(wm_class => 'first');
my $second = open_window(wm_class => 'second');

is_num_children('left-top', 1, 'one child on left-top');
is_num_children('right-top', 0, 'no children on right-top');

# Move the second window into its own stacked container.
cmd 'move right';
is_num_children('left-top', 2, 'two children on left-top');

# Move the second window onto the upper right workspace.
cmd 'move right';
is_num_children('left-top', 1, 'one child on left-top');
is_num_children('right-top', 1, 'one child on right-top');

# Move the first window onto the upper right workspace.
cmd '[class="first"] move right';
is_num_children('left-top', 0, 'no children on left-top');
is_num_children('right-top', 2, 'two children on right-top');

# Move the second window onto the lower right workspace.
cmd '[class="second"] move down, move down';
is_num_children('right-top', 1, 'one child on right-top');
is_num_children('right-bottom', 1, 'two children on right-bottom');

# Move the first window onto the lower right workspace.
cmd '[class="first"] move down';
is_num_children('right-top', 0, 'no children on right-top');
is_num_children('right-bottom', 2, 'two children on right-bottom');

# Move the second windo onto the lower left workspace.
cmd '[class="second"] move left, move left';
is_num_children('right-bottom', 1, 'one child on right-bottom');
is_num_children('left-bottom', 1, 'one on left-bottom');

# Move the first window onto the lower left workspace.
cmd '[class="first"] move left';
is_num_children('right-bottom', 0, 'no children on right-bottom');
is_num_children('left-bottom', 2, 'two children on left-bottom');

# Move the second window onto the upper left workspace.
cmd '[class="second"] move up, move up';
is_num_children('left-bottom', 1, 'one child on left-bottom');
is_num_children('left-top', 1, 'one child on left-top');

# Move the first window onto the upper left workspace.
cmd '[class="first"] move up';
is_num_children('left-bottom', 0, 'no children on left-bottom');
is_num_children('left-top', 2, 'two children on left-top');

done_testing;