]> git.sur5r.net Git - i3/i3/blob - testcases/t/518-interpret-workspace-numbers.t
7fd86d724053c92c0a8bc6636a018478cc0c416b
[i3/i3] / testcases / t / 518-interpret-workspace-numbers.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://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 # Tests that workspace assignment config directives for plain numbers will
18 # assign any workspace of that number to the specified output.
19 # Ticket: #1238
20 # Bug still in: 4.7.2-147-g3760a48
21 use i3test i3_config => <<EOT;
22 # i3 config file (v4)
23 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
24
25 workspace 1:override output fake-0
26 workspace 2 output fake-0
27 workspace 1 output fake-1
28 workspace 2:override output fake-1
29
30 fake-outputs 1024x768+0+0,1024x768+1024+0
31 EOT
32
33 ################################################################################
34 # Workspace assignments with bare numbers should be interpreted as `workspace
35 # number` config directives. Any workspace beginning with that number should be
36 # assigned to the specified output.
37 ################################################################################
38
39 cmd 'focus output fake-1';
40 cmd 'workspace "2:foo"';
41 is(get_output_for_workspace('2:foo'), 'fake-0',
42     'Workspaces should be assigned by number when the assignment is a plain number')
43     or diag 'Since workspace number 2 is assigned to fake-0, 2:foo should open on fake-0';
44
45 cmd 'focus output fake-0';
46 cmd 'workspace "2:override"';
47 is(get_output_for_workspace('2:override'), 'fake-1',
48     'Workspace assignments by name should override numbered assignments')
49     or diag 'Since workspace "2:override" is assigned by name to fake-1, it should open on fake-1';
50
51 cmd 'focus output fake-1';
52 cmd 'workspace "1:override"';
53 is(get_output_for_workspace('1:override'), 'fake-0',
54     'Assignment rules should not be affected by the order assignments are declared')
55     or diag 'Since workspace "1:override" is assigned by name to fake-0, it should open on fake-0';
56
57 done_testing;