]> git.sur5r.net Git - i3/i3/blob - testcases/t/522-rename-assigned-workspace.t
f6319729873209ed2d765ccf044c195f4b254a92
[i3/i3] / testcases / t / 522-rename-assigned-workspace.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 #
18 # Tests that workspaces are moved to the assigned output if they
19 # are renamed to an assigned name.
20 # Ticket: #1473
21
22 use i3test i3_config => <<EOT;
23 # i3 config file (v4)
24 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
25 fake-outputs 1024x768+0+0,1024x768+1024+0
26
27 workspace 1 output fake-0
28 workspace 2 output fake-1
29 workspace 3:foo output fake-1
30 workspace baz output fake-1
31 workspace 5 output left
32 EOT
33
34 ##########################################################################
35 # Renaming the workspace to an unassigned name does not move the workspace
36 # (regression test)
37 ##########################################################################
38
39 cmd 'focus output fake-0';
40 cmd 'rename workspace to unassigned';
41 is(get_output_for_workspace('unassigned'), 'fake-0',
42     'Unassigned workspace should stay on its output when being renamed');
43
44 ##########################################################################
45 # Renaming a workspace by number only triggers the assignment
46 ##########################################################################
47
48 cmd 'focus output fake-0';
49 cmd 'rename workspace to 2';
50 is(get_output_for_workspace('2'), 'fake-1',
51     'Renaming the workspace to a number should move it to the assigned output');
52
53 ##########################################################################
54 # Renaming a workspace by number and name triggers the assignment
55 ##########################################################################
56
57 cmd 'focus output fake-0';
58 cmd 'rename workspace to "2:foo"';
59 is(get_output_for_workspace('2:foo'), 'fake-1',
60     'Renaming the workspace to a number and name should move it to the assigned output');
61
62 ##########################################################################
63 # Renaming a workspace by name only triggers the assignment
64 ##########################################################################
65
66 cmd 'focus output fake-0';
67 cmd 'rename workspace to baz';
68 is(get_output_for_workspace('baz'), 'fake-1',
69     'Renaming the workspace to a number and name should move it to the assigned output');
70
71 ##########################################################################
72 # Renaming a workspace so that it is assigned a directional output does
73 # not move the workspace or crash
74 ##########################################################################
75
76 cmd 'focus output fake-0';
77 cmd 'workspace bar';
78 cmd 'rename workspace to 5';
79 is(get_output_for_workspace('5'), 'fake-0',
80     'Renaming the workspace to a workspace assigned to a directional output should not move the workspace');
81
82 ##########################################################################
83 # Renaming a workspace, so that it becomes assigned to the focused
84 # output's workspace (and the focused output is empty) should
85 # result in the original workspace replacing the originally
86 # focused workspace.
87 ##########################################################################
88
89 cmd 'workspace baz';
90 cmd 'rename workspace 5 to 2';
91 is(get_output_for_workspace('2'), 'fake-1',
92     'Renaming a workspace so that it moves to the focused output which contains only an empty workspace should replace the empty workspace');
93
94 done_testing;