]> git.sur5r.net Git - i3/i3/blob - testcases/t/226-internal-workspaces.t
Add strip_workspace_name
[i3/i3] / testcases / t / 226-internal-workspaces.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 # Verifies that internal workspaces (those whose name starts with __) cannot be
18 # used in all commands that deal with workspaces.
19 # Ticket: #1209
20 # Bug still in: 4.7.2-154-g144e3fb
21 use i3test i3_autostart => 0;
22
23 sub internal_workspaces {
24     scalar grep { /^__/ } @{get_workspace_names()}
25 }
26
27 my $config = <<EOT;
28 # i3 config file (v4)
29 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
30 EOT
31
32 my $pid = launch_with_config($config);
33
34 is(internal_workspaces(), 0, 'No internal workspaces');
35
36 cmd 'workspace __foo';
37 is(internal_workspaces(), 0, 'No internal workspaces');
38
39 cmd 'move to workspace __foo';
40 is(internal_workspaces(), 0, 'No internal workspaces');
41
42 cmd 'rename workspace to __foo';
43 is(internal_workspaces(), 0, 'No internal workspaces');
44
45 exit_gracefully($pid);
46
47 ################################################################################
48 # Verify that new workspace names starting with __ are ignored.
49 ################################################################################
50
51 $config = <<EOT;
52 # i3 config file (v4)
53 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
54
55 bindsym Mod1+1 workspace __foo
56 bindsym Mod1+2 workspace bar
57 EOT
58
59 $pid = launch_with_config($config);
60
61 is_deeply(get_workspace_names(), [ 'bar' ], 'New workspace called bar, not __foo');
62
63 exit_gracefully($pid);
64
65 done_testing;