2011-08-09 03:12:44 -04:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
# !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3
|
|
|
|
#
|
|
|
|
# Tests the new_window and new_float config option.
|
|
|
|
#
|
|
|
|
|
|
|
|
use i3test;
|
|
|
|
|
|
|
|
my $x = X11::XCB::Connection->new;
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# 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-04 18:34:23 -04:00
|
|
|
my $pid = launch_with_config($config);
|
2011-08-09 03:12:44 -04:00
|
|
|
|
|
|
|
my $tmp = fresh_workspace;
|
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
2011-09-24 10:11:37 -04:00
|
|
|
my $first = open_window($x);
|
2011-08-09 03:12:44 -04:00
|
|
|
|
|
|
|
my @content = @{get_ws_content($tmp)};
|
|
|
|
ok(@content == 1, 'one container opened');
|
|
|
|
is($content[0]->{border}, 'normal', 'border normal by default');
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
exit_gracefully($pid);
|
2011-08-09 03:12:44 -04: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-04 18:34:23 -04:00
|
|
|
$pid = launch_with_config($config);
|
2011-08-09 03:12:44 -04:00
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
2011-09-24 10:11:37 -04:00
|
|
|
$first = open_window($x);
|
2011-08-09 03:12:44 -04:00
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
ok(@content == 1, 'one container opened');
|
|
|
|
is($content[0]->{border}, '1pixel', 'border normal by default');
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
exit_gracefully($pid);
|
2011-08-09 03:12:44 -04: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-04 18:34:23 -04:00
|
|
|
$pid = launch_with_config($config);
|
2011-08-09 03:12:44 -04:00
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
2011-09-24 10:11:37 -04:00
|
|
|
$first = open_floating_window($x);
|
2011-08-09 03:12:44 -04: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-04 18:34:23 -04:00
|
|
|
exit_gracefully($pid);
|
2011-08-09 03:12:44 -04: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-04 18:34:23 -04:00
|
|
|
$pid = launch_with_config($config);
|
2011-08-09 03:12:44 -04:00
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
2011-09-24 10:11:37 -04:00
|
|
|
$first = open_floating_window($x);
|
2011-08-09 03:12:44 -04:00
|
|
|
|
|
|
|
$wscontent = get_ws($tmp);
|
|
|
|
@floating = @{$wscontent->{floating_nodes}};
|
|
|
|
ok(@floating == 1, 'one floating container opened');
|
|
|
|
$floatingcon = $floating[0];
|
|
|
|
is($floatingcon->{nodes}->[0]->{border}, '1pixel', 'border normal by default');
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
exit_gracefully($pid);
|
2011-08-09 03:12:44 -04:00
|
|
|
|
|
|
|
done_testing;
|