2011-08-03 02:56:24 +02:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
2012-09-10 14:09:01 +02:00
|
|
|
#
|
|
|
|
# Please read the following documents before working on tests:
|
|
|
|
# • http://build.i3wm.org/docs/testsuite.html
|
|
|
|
# (or docs/testsuite)
|
|
|
|
#
|
|
|
|
# • http://build.i3wm.org/docs/lib-i3test.html
|
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
#
|
|
|
|
# • http://build.i3wm.org/docs/ipc.html
|
|
|
|
# (or docs/ipc)
|
|
|
|
#
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
#
|
2011-08-03 02:56:24 +02:00
|
|
|
# checks if i3 starts up on workspace '1' or the first configured named workspace
|
|
|
|
#
|
2011-11-25 17:39:19 +01:00
|
|
|
use i3test i3_autostart => 0;
|
2011-08-03 02:56:24 +02:00
|
|
|
|
|
|
|
##############################################################
|
|
|
|
# 1: i3 should start with workspace '1'
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
my $config = <<EOT;
|
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
EOT
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
my $pid = launch_with_config($config);
|
2011-08-03 02:56:24 +02:00
|
|
|
|
|
|
|
my @names = @{get_workspace_names()};
|
2011-11-22 02:21:47 +01:00
|
|
|
is_deeply(\@names, [ '1' ], 'i3 starts on workspace 1 without any configuration');
|
2011-08-03 02:56:24 +02:00
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
exit_gracefully($pid);
|
2011-08-03 02:56:24 +02:00
|
|
|
|
|
|
|
##############################################################
|
|
|
|
# 2: with named workspaces, i3 should start on the first named one
|
|
|
|
##############################################################
|
|
|
|
|
2011-08-03 03:33:12 +02:00
|
|
|
$config = <<EOT;
|
2011-08-03 02:56:24 +02:00
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
|
|
|
bindsym Mod1+1 workspace foobar
|
|
|
|
EOT
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
$pid = launch_with_config($config);
|
2011-08-03 03:33:12 +02:00
|
|
|
|
2011-11-21 21:04:00 +01:00
|
|
|
@names = @{get_workspace_names()};
|
2011-11-22 02:21:47 +01:00
|
|
|
is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
2011-08-03 03:33:12 +02:00
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
exit_gracefully($pid);
|
2011-08-03 03:33:12 +02:00
|
|
|
|
|
|
|
##############################################################
|
|
|
|
# 3: the same test as 2, but with a quoted workspace name
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
$config = <<EOT;
|
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
|
|
|
bindsym Mod1+1 workspace "foobar"
|
|
|
|
EOT
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
$pid = launch_with_config($config);
|
2011-08-03 02:56:24 +02:00
|
|
|
|
2011-11-21 21:04:00 +01:00
|
|
|
@names = @{get_workspace_names()};
|
2011-11-22 02:21:47 +01:00
|
|
|
is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
2011-08-03 02:56:24 +02:00
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
exit_gracefully($pid);
|
2011-08-03 02:56:24 +02:00
|
|
|
|
2013-06-29 20:58:33 +02:00
|
|
|
################################################################################
|
|
|
|
# 4: now with whitespace in front of the workspace number
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
$config = <<EOT;
|
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
|
|
|
bindsym Mod1+1 workspace 3
|
|
|
|
EOT
|
|
|
|
|
|
|
|
$pid = launch_with_config($config);
|
|
|
|
|
|
|
|
@names = @{get_workspace_names()};
|
|
|
|
is_deeply(\@names, [ '3' ], 'i3 starts on workspace 3 without whitespace');
|
|
|
|
|
|
|
|
exit_gracefully($pid);
|
|
|
|
|
2014-10-01 22:50:48 +02:00
|
|
|
################################################################################
|
|
|
|
# 5: now with a binding that contains multiple commands
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
$config = <<EOT;
|
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
|
|
|
bindsym Mod1+1 workspace 3; exec foo
|
|
|
|
EOT
|
|
|
|
|
|
|
|
$pid = launch_with_config($config);
|
|
|
|
|
|
|
|
@names = @{get_workspace_names()};
|
|
|
|
is_deeply(\@names, [ '3' ], 'i3 starts on workspace 3 without ;exec foo');
|
|
|
|
|
|
|
|
exit_gracefully($pid);
|
|
|
|
|
2011-08-03 02:56:24 +02:00
|
|
|
done_testing;
|