]> git.sur5r.net Git - i3/i3/blob - testcases/t/232-cmd-workspace-number-selection.t
Always explicitly set border widths on manage
[i3/i3] / testcases / t / 232-cmd-workspace-number-selection.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 that `workspace {N}` acts like `workspace number {N}` when N is a plain
18 # digit, and likewise for `move to workspace {N}`.
19 # Ticket: #1238
20 # Bug still in: 4.8-16-g3f5a0f0
21 use i3test;
22
23 cmd 'workspace 5:foo';
24 open_window;
25 fresh_workspace;
26 cmd 'workspace 5';
27
28 is(focused_ws, '5:foo',
29     'a command to switch to a workspace with a bare number should switch to a workspace of that number');
30
31 fresh_workspace;
32 my $win = open_window;
33 cmd '[id="' . $win->{id} . '"] move to workspace 5';
34
35 is(@{get_ws('5:foo')->{nodes}}, 2,
36     'a command to move a container to a workspace with a bare number should move that container to a workspace of that number');
37
38 fresh_workspace;
39 cmd 'workspace 7';
40 open_window;
41 cmd 'workspace 7:foo';
42 $win = open_window;
43
44 cmd 'workspace 7';
45 is(focused_ws, '7',
46     'a workspace with a name that is a matching plain number should be preferred when switching');
47
48 cmd '[id="' . $win->{id} . '"] move to workspace 7';
49 is(@{get_ws('7')->{nodes}}, 2,
50     'a workspace with a name that is a matching plain number should be preferred when moving');
51
52 done_testing;