]> git.sur5r.net Git - i3/i3/blob - testcases/t/256-no-auto-back-and-forth.t
Added --no-auto-back-and-forth to workspace commands.
[i3/i3] / testcases / t / 256-no-auto-back-and-forth.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://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 # Test for the --no-auto-back-and-forth flag.
18 # Ticket: #2028
19 use i3test;
20
21 my ($first, $second, $third);
22 $first = "1:first";
23 $second = "2:second";
24 $third = "3:third";
25
26 ###############################################################################
27 # Switching to another workspace when passing --no-auto-back-and-forth works
28 # as if the flag wasn't set.
29 ###############################################################################
30
31 cmd qq|workspace "$first"|;
32 ok(get_ws($first)->{focused}, 'first workspace is focused');
33
34 cmd qq|workspace --no-auto-back-and-forth "$second"|;
35 ok(get_ws($second)->{focused}, 'second workspace is focused');
36
37 cmd qq|workspace --no-auto-back-and-forth number "$third"|;
38 ok(get_ws($third)->{focused}, 'third workspace is focused');
39
40 ###############################################################################
41 # Switching to the focused workspace when passing --no-auto-back-and-forth
42 # is a no-op.
43 ###############################################################################
44
45 cmd qq|workspace "$second"|;
46 cmd qq|workspace "$first"|;
47 ok(get_ws($first)->{focused}, 'first workspace is focused');
48
49 cmd qq|workspace --no-auto-back-and-forth "$first"|;
50 ok(get_ws($first)->{focused}, 'first workspace is still focused');
51
52 cmd qq|workspace --no-auto-back-and-forth number "$first"|;
53 ok(get_ws($first)->{focused}, 'first  workspace is still focused');
54
55 ###############################################################################
56
57 done_testing;