]> git.sur5r.net Git - i3/i3/blob - testcases/t/170-force_focus_wrapping.t
Merge branch 'fix-floating-pos'
[i3/i3] / testcases / t / 170-force_focus_wrapping.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 # !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3
4 #
5 # Tests if the 'force_focus_wrapping' config directive works correctly.
6 #
7 use i3test;
8 use X11::XCB qw(:all);
9 use X11::XCB::Connection;
10
11 my $x = X11::XCB::Connection->new;
12
13 #####################################################################
14 # 1: test the wrapping behaviour without force_focus_wrapping
15 #####################################################################
16
17 my $config = <<EOT;
18 # i3 config file (v4)
19 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
20 EOT
21
22 my $pid = launch_with_config($config);
23
24 my $tmp = fresh_workspace;
25
26 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
27
28 my $first = open_window($x);
29 my $second = open_window($x);
30
31 cmd 'layout tabbed';
32 cmd 'focus parent';
33
34 my $third = open_window($x);
35 is($x->input_focus, $third->id, 'third window focused');
36
37 cmd 'focus left';
38 is($x->input_focus, $second->id, 'second window focused');
39
40 cmd 'focus left';
41 is($x->input_focus, $first->id, 'first window focused');
42
43 # now test the wrapping
44 cmd 'focus left';
45 is($x->input_focus, $second->id, 'second window focused');
46
47 # but focusing right should not wrap now, but instead focus the third window
48 cmd 'focus right';
49 is($x->input_focus, $third->id, 'third window focused');
50
51 exit_gracefully($pid);
52
53 #####################################################################
54 # 2: test the wrapping behaviour with force_focus_wrapping
55 #####################################################################
56
57 $config = <<EOT;
58 # i3 config file (v4)
59 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
60 force_focus_wrapping true
61 EOT
62
63 $pid = launch_with_config($config);
64
65 $tmp = fresh_workspace;
66
67 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
68
69 $first = open_window($x);
70 $second = open_window($x);
71
72 cmd 'layout tabbed';
73 cmd 'focus parent';
74
75 $third = open_window($x);
76
77 sync_with_i3($x);
78
79 is($x->input_focus, $third->id, 'third window focused');
80
81 cmd 'focus left';
82 is($x->input_focus, $second->id, 'second window focused');
83
84 cmd 'focus left';
85 is($x->input_focus, $first->id, 'first window focused');
86
87 # now test the wrapping
88 cmd 'focus left';
89 is($x->input_focus, $second->id, 'second window focused');
90
91 # focusing right should now be forced to wrap
92 cmd 'focus right';
93 is($x->input_focus, $first->id, 'first window focused');
94
95 exit_gracefully($pid);
96
97 done_testing;