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 # Test for the --no-auto-back-and-forth flag.
21 my ($first, $second, $third, $con);
26 ###############################################################################
27 # Switching to another workspace when passing --no-auto-back-and-forth works
28 # as if the flag wasn't set.
29 ###############################################################################
31 cmd qq|workspace "$first"|;
32 ok(get_ws($first)->{focused}, 'first workspace is focused');
34 cmd qq|workspace --no-auto-back-and-forth "$second"|;
35 ok(get_ws($second)->{focused}, 'second workspace is focused');
37 cmd qq|workspace --no-auto-back-and-forth number "$third"|;
38 ok(get_ws($third)->{focused}, 'third workspace is focused');
40 ###############################################################################
41 # Switching to the focused workspace when passing --no-auto-back-and-forth
43 ###############################################################################
45 cmd qq|workspace "$second"|;
46 cmd qq|workspace "$first"|;
47 ok(get_ws($first)->{focused}, 'first workspace is focused');
49 cmd qq|workspace --no-auto-back-and-forth "$first"|;
50 ok(get_ws($first)->{focused}, 'first workspace is still focused');
52 cmd qq|workspace --no-auto-back-and-forth number "$first"|;
53 ok(get_ws($first)->{focused}, 'first workspace is still focused');
55 ###############################################################################
56 # Moving a window to another workspace when passing --no-auto-back-and-forth
57 # works as if the flag wasn't set.
58 ###############################################################################
60 cmd qq|workspace "$third"|;
61 cmd qq|workspace "$second"|;
62 cmd qq|workspace "$first"|;
66 cmd qq|move --no-auto-back-and-forth window to workspace "$second"|;
67 is(@{get_ws($second)->{nodes}}, 1, 'window was moved to second workspace');
68 cmd qq|[con_mark=mywindow] move window to workspace "$first"|;
70 cmd qq|move --no-auto-back-and-forth window to workspace number "$third"|;
71 is(@{get_ws($third)->{nodes}}, 1, 'window was moved to third workspace');
72 cmd qq|[con_mark=mywindow] move window to workspace "$first"|;
74 cmd '[con_mark=mywindow] kill';
76 ###############################################################################
77 # Moving a window to the same workspace when passing --no-auto-back-and-forth
79 ###############################################################################
81 cmd qq|workspace "$second"|;
82 cmd qq|workspace "$first"|;
86 cmd qq|move --no-auto-back-and-forth window to workspace "$first"|;
87 is(@{get_ws($first)->{nodes}}, 1, 'window is still on first workspace');
88 cmd qq|[con_mark=mywindow] move window to workspace "$first"|;
90 cmd qq|move --no-auto-back-and-forth window to workspace number "$first"|;
91 is(@{get_ws($first)->{nodes}}, 1, 'window is still on first workspace');
92 cmd qq|[con_mark=mywindow] move window to workspace "$first"|;
94 cmd '[con_mark=mywindow] kill';
96 ###############################################################################