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_autostart => 0;
21 # Ensure the pointer is at (0, 0) so that we really start on the first
22 # (the left) workspace.
23 $x->root->warp_pointer(0, 0);
27 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
29 fake-outputs 1024x768+0+0,1024x768+1024+0,1024x768+1024+768,1024x768+0+768
31 workspace left-top output fake-0
32 workspace right-top output fake-1
33 workspace right-bottom output fake-2
34 workspace left-bottom output fake-3
37 my $pid = launch_with_config($config);
39 #####################################################################
40 # Try to move a single window across outputs in each direction
41 #####################################################################
43 cmd('workspace left-top');
44 my $alone_window = open_window;
47 is(scalar @{get_ws_content('right-top')}, 1, 'moved individual window to right-top workspace');
50 is(scalar @{get_ws_content('right-bottom')}, 1, 'moved individual window to right-bottom workspace');
53 is(scalar @{get_ws_content('left-bottom')}, 1, 'moved individual window to left-bottom workspace');
56 is(scalar @{get_ws_content('left-top')}, 1, 'moved individual window to left-top workspace');
61 #####################################################################
62 # Try to move a window on a workspace with two windows across outputs in each
64 #####################################################################
66 # from left-top to right-top
67 cmd('workspace left-top');
69 my $first_window = open_window;
70 my $social_window = open_window( name => 'CORRECT_WINDOW' );
72 is(scalar @{get_ws_content('right-top')}, 1, 'moved some window to right-top workspace');
73 my $compare_window = shift @{get_ws_content('right-top')};
74 is($compare_window->{window}, $social_window->id, 'moved correct window to right-top workspace');
75 # unmap the first window so we don't confuse it when we move back here
79 # from right-top to right-bottom
82 # this window opened above - we need to move down twice
83 cmd('focus up; move down; move down');
84 is(scalar @{get_ws_content('right-bottom')}, 1, 'moved some window to right-bottom workspace');
85 $compare_window = shift @{get_ws_content('right-bottom')};
86 is($compare_window->{name}, $social_window->name, 'moved correct window to right-bottom workspace');
88 # from right-bottom to left-bottom
91 cmd('focus left; move left');
92 is(scalar @{get_ws_content('left-bottom')}, 1, 'moved some window to left-bottom workspace');
93 $compare_window = shift @{get_ws_content('left-bottom')};
94 is($social_window->name, $compare_window->{name}, 'moved correct window to left-bottom workspace');
96 # from left-bottom to left-top
99 cmd('focus up; move up');
100 is(scalar @{get_ws_content('left-top')}, 1, 'moved some window to left-bottom workspace');
101 $compare_window = shift @{get_ws_content('left-top')};
102 is($social_window->name, $compare_window->{name}, 'moved correct window to left-bottom workspace');
104 exit_gracefully($pid);