]> git.sur5r.net Git - i3/i3/blob - testcases/t/172-start-on-named-ws.t
Merge branch 'fix-ws-con'
[i3/i3] / testcases / t / 172-start-on-named-ws.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 # checks if i3 starts up on workspace '1' or the first configured named workspace
18 #
19 use i3test i3_autostart => 0;
20
21 ##############################################################
22 # 1: i3 should start with workspace '1'
23 ##############################################################
24
25 my $config = <<EOT;
26 # i3 config file (v4)
27 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
28 EOT
29
30 my $pid = launch_with_config($config);
31
32 my @names = @{get_workspace_names()};
33 is_deeply(\@names, [ '1' ], 'i3 starts on workspace 1 without any configuration');
34
35 exit_gracefully($pid);
36
37 ##############################################################
38 # 2: with named workspaces, i3 should start on the first named one
39 ##############################################################
40
41 $config = <<EOT;
42 # i3 config file (v4)
43 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
44
45 bindsym Mod1+1 workspace foobar
46 EOT
47
48 $pid = launch_with_config($config);
49
50 @names = @{get_workspace_names()};
51 is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
52
53 exit_gracefully($pid);
54
55 ##############################################################
56 # 3: the same test as 2, but with a quoted workspace name
57 ##############################################################
58
59 $config = <<EOT;
60 # i3 config file (v4)
61 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
62
63 bindsym Mod1+1 workspace "foobar"
64 EOT
65
66 $pid = launch_with_config($config);
67
68 @names = @{get_workspace_names()};
69 is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
70
71 exit_gracefully($pid);
72
73 ################################################################################
74 # 4: now with whitespace in front of the workspace number
75 ################################################################################
76
77 $config = <<EOT;
78 # i3 config file (v4)
79 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
80
81 bindsym Mod1+1 workspace   3
82 EOT
83
84 $pid = launch_with_config($config);
85
86 @names = @{get_workspace_names()};
87 is_deeply(\@names, [ '3' ], 'i3 starts on workspace 3 without whitespace');
88
89 exit_gracefully($pid);
90
91 done_testing;