]> git.sur5r.net Git - i3/i3/blob - testcases/t/518-interpret-workspace-numbers.t
c7ab8367c0dd9285110491ba718f4251a6bc6251
[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 workspace 3 output fake-0
30 workspace 3:override output doesnotexist fake-1
31
32 fake-outputs 1024x768+0+0,1024x768+1024+0
33 EOT
34
35 ################################################################################
36 # Workspace assignments with bare numbers should be interpreted as `workspace
37 # number` config directives. Any workspace beginning with that number should be
38 # assigned to the specified output.
39 ################################################################################
40
41 cmd 'focus output fake-1';
42 cmd 'workspace "2:foo"';
43 is(get_output_for_workspace('2:foo'), 'fake-0',
44     'Workspaces should be assigned by number when the assignment is a plain number')
45     or diag 'Since workspace number 2 is assigned to fake-0, 2:foo should open on fake-0';
46
47 cmd 'focus output fake-0';
48 cmd 'workspace "2:override"';
49 is(get_output_for_workspace('2:override'), 'fake-1',
50     'Workspace assignments by name should override numbered assignments')
51     or diag 'Since workspace "2:override" is assigned by name to fake-1, it should open on fake-1';
52
53 cmd 'focus output fake-1';
54 cmd 'workspace "1:override"';
55 is(get_output_for_workspace('1:override'), 'fake-0',
56     'Assignment rules should not be affected by the order assignments are declared')
57     or diag 'Since workspace "1:override" is assigned by name to fake-0, it should open on fake-0';
58
59 cmd 'focus output fake-1';
60 cmd 'workspace "3:override"';
61 is(get_output_for_workspace('3:override'), 'fake-1',
62    'Assignment rules should not be affected by multiple output assignments')
63     or diag 'Since workspace "3:override" is assigned by name to fake-1, it should open on fake-1';
64
65 done_testing;