]> git.sur5r.net Git - i3/i3/blob - testcases/t/519-mouse-warping.t
Fix 'rename workspace to tosomething'
[i3/i3] / testcases / t / 519-mouse-warping.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://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
12 #   (unless you are already familiar with Perl)
13
14 use i3test i3_autostart => 0;
15
16 # Ensure the pointer is at (0, 0) so that we really start on the first
17 # (the left) workspace.
18 $x->root->warp_pointer(0, 0);
19
20 my $config = <<EOT;
21 # i3 config file (v4)
22 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
23 fake-outputs 1024x768+0+0,1024x768+1024+0
24 mouse_warping none
25 EOT
26 my $pid = launch_with_config($config);
27
28 my $i3 = i3(get_socket_path());
29
30 ######################################################
31 # Open one workspace with one window on both outputs #
32 ######################################################
33
34 # Open window on workspace 1, left output
35 is(focused_ws, '1', 'starting with focus on workspace 1');
36 open_window;
37
38 # Open window on workspace 2, right output
39 cmd 'focus output right';
40 is(focused_ws, '2', 'moved focus to workspace 2');
41 open_window;
42
43 # If mouse_warping is disabled, the pointer has not moved from
44 # position (0, 0) when focus was switched to workspace 2
45 $x->root->warp_pointer(0, 0);
46
47 # Ensure focus is still on workspace 2
48 is(focused_ws, '2', 'warped mouse cursor to (0, 0), focus still in workspace 2');
49
50 # Exit gracefully
51 exit_gracefully($pid);
52 done_testing;