2011-08-09 09:12:44 +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-09 09:12:44 +02:00
|
|
|
# Tests the new_window and new_float config option.
|
|
|
|
#
|
|
|
|
|
2011-11-25 17:39:19 +01:00
|
|
|
use i3test i3_autostart => 0;
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# 1: check that new windows start with 'normal' border unless configured
|
|
|
|
# otherwise
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
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-09 09:12:44 +02:00
|
|
|
|
|
|
|
my $tmp = fresh_workspace;
|
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
2011-11-22 00:47:32 +01:00
|
|
|
my $first = open_window;
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
my @content = @{get_ws_content($tmp)};
|
|
|
|
ok(@content == 1, 'one container opened');
|
|
|
|
is($content[0]->{border}, 'normal', 'border normal by default');
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
exit_gracefully($pid);
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# 2: check that new tiling windows start with '1pixel' border when
|
|
|
|
# configured
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
$config = <<EOT;
|
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
|
|
|
new_window 1pixel
|
|
|
|
EOT
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
$pid = launch_with_config($config);
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
2011-11-22 00:47:32 +01:00
|
|
|
$first = open_window;
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
ok(@content == 1, 'one container opened');
|
2012-09-24 01:14:00 +02:00
|
|
|
is($content[0]->{border}, 'pixel', 'border pixel by default');
|
2014-06-28 03:20:12 +02:00
|
|
|
is($content[0]->{current_border_width}, 1, 'border width pixels 1 (default)');
|
2011-08-09 09:12:44 +02:00
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
exit_gracefully($pid);
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# 3: check that new floating windows start with 'normal' border unless
|
|
|
|
# configured otherwise
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
$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
|
|
|
$pid = launch_with_config($config);
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
2011-11-22 01:00:54 +01:00
|
|
|
$first = open_floating_window;
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
my $wscontent = get_ws($tmp);
|
|
|
|
my @floating = @{$wscontent->{floating_nodes}};
|
|
|
|
ok(@floating == 1, 'one floating container opened');
|
|
|
|
my $floatingcon = $floating[0];
|
|
|
|
is($floatingcon->{nodes}->[0]->{border}, 'normal', 'border normal by default');
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
exit_gracefully($pid);
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# 4: check that new floating windows start with '1pixel' border when
|
|
|
|
# configured
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
$config = <<EOT;
|
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
|
|
|
new_float 1pixel
|
|
|
|
EOT
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
$pid = launch_with_config($config);
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
2011-11-22 01:00:54 +01:00
|
|
|
$first = open_floating_window;
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
$wscontent = get_ws($tmp);
|
|
|
|
@floating = @{$wscontent->{floating_nodes}};
|
|
|
|
ok(@floating == 1, 'one floating container opened');
|
|
|
|
$floatingcon = $floating[0];
|
2012-09-24 01:14:00 +02:00
|
|
|
is($floatingcon->{nodes}->[0]->{border}, 'pixel', 'border pixel by default');
|
2011-08-09 09:12:44 +02:00
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
exit_gracefully($pid);
|
2011-08-09 09:12:44 +02:00
|
|
|
|
|
|
|
done_testing;
|