]> git.sur5r.net Git - i3/i3/blob - testcases/t/176-workspace-baf.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 176-workspace-baf.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 # Checks if the 'workspace back_and_forth' command and the
4 # 'workspace_auto_back_and_forth' config directive work correctly.
5 #
6
7 use i3test i3_autostart => 0;
8
9 my $config = <<EOT;
10 # i3 config file (v4)
11 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
12 EOT
13
14 my $pid = launch_with_config($config);
15
16 my $first_ws = fresh_workspace;
17 ok(get_ws($first_ws)->{focused}, 'first workspace focused');
18
19 my $second_ws = fresh_workspace;
20 ok(get_ws($second_ws)->{focused}, 'second workspace focused');
21
22 my $third_ws = fresh_workspace;
23 ok(get_ws($third_ws)->{focused}, 'third workspace focused');
24
25 cmd 'workspace back_and_forth';
26 ok(get_ws($second_ws)->{focused}, 'second workspace focused');
27
28 #####################################################################
29 # test that without workspace_auto_back_and_forth switching to the same
30 # workspace that is currently focused is a no-op
31 #####################################################################
32
33 cmd qq|workspace "$second_ws"|;
34 ok(get_ws($second_ws)->{focused}, 'second workspace still focused');
35
36 exit_gracefully($pid);
37
38 #####################################################################
39 # the same test, but with workspace_auto_back_and_forth
40 #####################################################################
41
42 $config = <<EOT;
43 # i3 config file (v4)
44 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
45 workspace_auto_back_and_forth yes
46 EOT
47
48 $pid = launch_with_config($config);
49
50 $first_ws = fresh_workspace;
51 ok(get_ws($first_ws)->{focused}, 'first workspace focused');
52
53 $second_ws = fresh_workspace;
54 ok(get_ws($second_ws)->{focused}, 'second workspace focused');
55
56 $third_ws = fresh_workspace;
57 ok(get_ws($third_ws)->{focused}, 'third workspace focused');
58
59 cmd qq|workspace "$third_ws"|;
60 ok(get_ws($second_ws)->{focused}, 'second workspace focused');
61
62 exit_gracefully($pid);
63
64 done_testing;