2011-12-17 12:18:43 +01: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:
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/testsuite.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (or docs/testsuite)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/lib-i3test.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/ipc.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (or docs/ipc)
|
|
|
|
#
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
#
|
2011-12-17 12:18:43 +01:00
|
|
|
# Checks that variables are parsed correctly by using for_window rules with
|
|
|
|
# variables in it.
|
|
|
|
#
|
|
|
|
|
|
|
|
use i3test i3_autostart => 0;
|
|
|
|
|
|
|
|
# starts i3 with the given config, opens a window, returns its border style
|
|
|
|
sub launch_get_border {
|
|
|
|
my ($config) = @_;
|
|
|
|
|
|
|
|
my $pid = launch_with_config($config);
|
|
|
|
|
|
|
|
my $i3 = i3(get_socket_path(0));
|
|
|
|
my $tmp = fresh_workspace;
|
|
|
|
|
|
|
|
my $window = open_window(name => 'special title');
|
|
|
|
|
|
|
|
my @content = @{get_ws_content($tmp)};
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
my $border = $content[0]->{border};
|
|
|
|
|
|
|
|
exit_gracefully($pid);
|
|
|
|
|
|
|
|
return $border;
|
|
|
|
}
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# test thet windows get the default border
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
my $config = <<EOT;
|
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
EOT
|
|
|
|
|
|
|
|
is(launch_get_border($config), 'normal', 'normal border');
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# now use a variable and for_window
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
$config = <<'EOT';
|
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
|
|
|
set $vartest special title
|
|
|
|
for_window [title="$vartest"] border none
|
|
|
|
EOT
|
|
|
|
|
|
|
|
is(launch_get_border($config), 'none', 'no border');
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# check that whitespaces and tabs are ignored
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
$config = <<'EOT';
|
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
|
|
|
set $vartest special title
|
|
|
|
for_window [title="$vartest"] border none
|
|
|
|
EOT
|
|
|
|
|
|
|
|
is(launch_get_border($config), 'none', 'no border');
|
|
|
|
|
2016-04-26 09:20:42 +02:00
|
|
|
#####################################################################
|
|
|
|
# test that longest matching variable name is substituted
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
$config = <<'EOT';
|
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
|
|
|
set $var normal title
|
|
|
|
set $vartest special title
|
|
|
|
set $vart mundane title
|
|
|
|
for_window [title="$vartest"] border none
|
|
|
|
EOT
|
|
|
|
|
|
|
|
is(launch_get_border($config), 'none', 'no border');
|
|
|
|
|
2011-12-17 12:18:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
done_testing;
|
|
|
|
|