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 if a simple 'move <direction>' command will move containers across outputs.
19 use i3test i3_config => <<EOT;
21 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
23 fake-outputs 1024x768+0+0,1024x768+1024+0,1024x768+1024+768,1024x768+0+768
25 workspace left-top output fake-0
26 workspace right-top output fake-1
27 workspace right-bottom output fake-2
28 workspace left-bottom output fake-3
31 # Ensure the pointer is at (0, 0) so that we really start on the first
32 # (the left) workspace.
33 $x->root->warp_pointer(0, 0);
35 #####################################################################
36 # Try to move a single window across outputs in each direction
37 #####################################################################
39 cmd('workspace left-top');
40 my $alone_window = open_window;
43 is(scalar @{get_ws_content('right-top')}, 1, 'moved individual window to right-top workspace');
46 is(scalar @{get_ws_content('right-bottom')}, 1, 'moved individual window to right-bottom workspace');
49 is(scalar @{get_ws_content('left-bottom')}, 1, 'moved individual window to left-bottom workspace');
52 is(scalar @{get_ws_content('left-top')}, 1, 'moved individual window to left-top workspace');
57 #####################################################################
58 # Try to move a window on a workspace with two windows across outputs in each
60 #####################################################################
62 # from left-top to right-top
63 cmd('workspace left-top');
65 my $first_window = open_window;
66 my $social_window = open_window( name => 'CORRECT_WINDOW' );
68 is(scalar @{get_ws_content('right-top')}, 1, 'moved some window to right-top workspace');
69 my $compare_window = shift @{get_ws_content('right-top')};
70 is($compare_window->{window}, $social_window->id, 'moved correct window to right-top workspace');
71 # unmap the first window so we don't confuse it when we move back here
75 # from right-top to right-bottom
78 # this window opened above - we need to move down twice
79 cmd('focus up; move down; move down');
80 is(scalar @{get_ws_content('right-bottom')}, 1, 'moved some window to right-bottom workspace');
81 $compare_window = shift @{get_ws_content('right-bottom')};
82 is($compare_window->{name}, $social_window->name, 'moved correct window to right-bottom workspace');
84 # from right-bottom to left-bottom
87 cmd('focus left; move left');
88 is(scalar @{get_ws_content('left-bottom')}, 1, 'moved some window to left-bottom workspace');
89 $compare_window = shift @{get_ws_content('left-bottom')};
90 is($social_window->name, $compare_window->{name}, 'moved correct window to left-bottom workspace');
92 # from left-bottom to left-top
95 cmd('focus up; move up');
96 is(scalar @{get_ws_content('left-top')}, 1, 'moved some window to left-bottom workspace');
97 $compare_window = shift @{get_ws_content('left-top')};
98 is($social_window->name, $compare_window->{name}, 'moved correct window to left-bottom workspace');