2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # checks if i3 starts up on workspace '1' or the first configured named workspace
19 use i3test i3_autostart => 0;
21 ##############################################################
22 # 1: i3 should start with workspace '1'
23 ##############################################################
27 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
30 my $pid = launch_with_config($config);
32 my @names = @{get_workspace_names()};
33 is_deeply(\@names, [ '1' ], 'i3 starts on workspace 1 without any configuration');
35 exit_gracefully($pid);
37 ##############################################################
38 # 2: with named workspaces, i3 should start on the first named one
39 ##############################################################
43 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
45 bindsym Mod1+1 workspace foobar
48 $pid = launch_with_config($config);
50 @names = @{get_workspace_names()};
51 is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
53 exit_gracefully($pid);
55 ##############################################################
56 # 3: the same test as 2, but with a quoted workspace name
57 ##############################################################
61 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
63 bindsym Mod1+1 workspace "foobar"
66 $pid = launch_with_config($config);
68 @names = @{get_workspace_names()};
69 is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
71 exit_gracefully($pid);
73 ################################################################################
74 # 4: now with whitespace in front of the workspace number
75 ################################################################################
79 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
81 bindsym Mod1+1 workspace 3
84 $pid = launch_with_config($config);
86 @names = @{get_workspace_names()};
87 is_deeply(\@names, [ '3' ], 'i3 starts on workspace 3 without whitespace');
89 exit_gracefully($pid);
91 ################################################################################
92 # 5: now with a binding that contains multiple commands
93 ################################################################################
97 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
99 bindsym Mod1+1 workspace 3; exec foo
102 $pid = launch_with_config($config);
104 @names = @{get_workspace_names()};
105 is_deeply(\@names, [ '3' ], 'i3 starts on workspace 3 without ;exec foo');
107 exit_gracefully($pid);
109 ################################################################################
110 # 6: verify internal binding reordering does not affect startup workspace
111 ################################################################################
114 # i3 config file (v4)
115 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
117 bindsym Mod1+1 workspace 3
118 bindsym Shift+Mod1+1 workspace 4
121 $pid = launch_with_config($config);
123 @names = @{get_workspace_names()};
124 is_deeply(\@names, [ '3' ], 'i3 starts on workspace 3');
126 exit_gracefully($pid);