Merge branch 'testsuite' into next
This commit is contained in:
commit
cef2eb9e9a
|
@ -11,36 +11,29 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use EV;
|
|
||||||
use AnyEvent;
|
|
||||||
use IO::Scalar; # not in core :\
|
|
||||||
use File::Temp qw(tempfile tempdir);
|
|
||||||
use v5.10;
|
use v5.10;
|
||||||
use DateTime;
|
# the following are modules which ship with Perl (>= 5.10):
|
||||||
use Data::Dumper;
|
|
||||||
use Cwd qw(abs_path);
|
use Cwd qw(abs_path);
|
||||||
use Proc::Background;
|
use File::Basename qw(basename);
|
||||||
|
use File::Temp qw(tempfile tempdir);
|
||||||
|
use Getopt::Long;
|
||||||
|
use IO::Socket::UNIX;
|
||||||
|
use POSIX;
|
||||||
|
use Time::HiRes qw(sleep gettimeofday tv_interval);
|
||||||
use TAP::Harness;
|
use TAP::Harness;
|
||||||
use TAP::Parser;
|
use TAP::Parser;
|
||||||
use TAP::Parser::Aggregator;
|
use TAP::Parser::Aggregator;
|
||||||
use File::Basename qw(basename);
|
# these are shipped with the testsuite
|
||||||
use AnyEvent::I3 qw(:all);
|
use lib qw(lib);
|
||||||
use Try::Tiny;
|
use SocketActivation;
|
||||||
use Getopt::Long;
|
# the following modules are not shipped with Perl
|
||||||
use Time::HiRes qw(sleep gettimeofday tv_interval);
|
use EV;
|
||||||
use X11::XCB;
|
use AnyEvent;
|
||||||
use IO::Socket::UNIX; # core
|
|
||||||
use POSIX; # core
|
|
||||||
use AnyEvent::Handle;
|
use AnyEvent::Handle;
|
||||||
|
use AnyEvent::I3 qw(:all);
|
||||||
# open a file so that we get file descriptor 3. we will later close it in the
|
use IO::Scalar; # not in core :\
|
||||||
# child and dup() the listening socket file descriptor to 3 to pass it to i3
|
use Try::Tiny; # not in core
|
||||||
open(my $reserved, '<', '/dev/null');
|
use X11::XCB;
|
||||||
if (fileno($reserved) != 3) {
|
|
||||||
warn "Socket file descriptor is not 3.";
|
|
||||||
warn "Please don't start this script within a subshell of vim or something.";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# install a dummy CHLD handler to overwrite the CHLD handler of AnyEvent / EV
|
# install a dummy CHLD handler to overwrite the CHLD handler of AnyEvent / EV
|
||||||
# XXX: we could maybe also use a different loop than the default loop in EV?
|
# XXX: we could maybe also use a different loop than the default loop in EV?
|
||||||
|
@ -95,7 +88,7 @@ my @testfiles = @ARGV;
|
||||||
|
|
||||||
# 2: create an output directory for this test-run
|
# 2: create an output directory for this test-run
|
||||||
my $outdir = "testsuite-";
|
my $outdir = "testsuite-";
|
||||||
$outdir .= DateTime->now->strftime("%Y-%m-%d-%H-%M-%S-");
|
$outdir .= POSIX::strftime("%Y-%m-%d-%H-%M-%S-", localtime());
|
||||||
$outdir .= `git describe --tags`;
|
$outdir .= `git describe --tags`;
|
||||||
chomp($outdir);
|
chomp($outdir);
|
||||||
mkdir($outdir) or die "Could not create $outdir";
|
mkdir($outdir) or die "Could not create $outdir";
|
||||||
|
@ -141,73 +134,23 @@ sub take_job {
|
||||||
|
|
||||||
my $activate_cv = AnyEvent->condvar;
|
my $activate_cv = AnyEvent->condvar;
|
||||||
my $time_before_start = [gettimeofday];
|
my $time_before_start = [gettimeofday];
|
||||||
my $start_i3 = sub {
|
|
||||||
# remove the old unix socket
|
|
||||||
unlink("/tmp/nested-$display-activation");
|
|
||||||
|
|
||||||
# pass all file descriptors up to three to the children.
|
my $pid;
|
||||||
# we need to set this flag before opening the socket.
|
if (!$dont_start) {
|
||||||
open(my $fdtest, '<', '/dev/null');
|
$pid = activate_i3(
|
||||||
$^F = fileno($fdtest);
|
unix_socket_path => "/tmp/nested-$display-activation",
|
||||||
close($fdtest);
|
display => $display,
|
||||||
my $socket = IO::Socket::UNIX->new(
|
configfile => $tmpfile,
|
||||||
Listen => 1,
|
logpath => $logpath,
|
||||||
Local => "/tmp/nested-$display-activation",
|
cv => $activate_cv
|
||||||
);
|
);
|
||||||
|
|
||||||
my $pid = fork;
|
|
||||||
if (!defined($pid)) {
|
|
||||||
die "could not fork()";
|
|
||||||
}
|
|
||||||
if ($pid == 0) {
|
|
||||||
$ENV{LISTEN_PID} = $$;
|
|
||||||
$ENV{LISTEN_FDS} = 1;
|
|
||||||
$ENV{DISPLAY} = $display;
|
|
||||||
$^F = 3;
|
|
||||||
|
|
||||||
close($reserved);
|
|
||||||
POSIX::dup2(fileno($socket), 3);
|
|
||||||
|
|
||||||
# now execute i3
|
|
||||||
my $i3cmd = abs_path("../i3") . " -V -d all --disable-signalhandler";
|
|
||||||
my $cmd = "exec $i3cmd -c $tmpfile >$logpath 2>&1";
|
|
||||||
exec "/bin/sh", '-c', $cmd;
|
|
||||||
|
|
||||||
# if we are still here, i3 could not be found or exec failed. bail out.
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $child_watcher;
|
my $child_watcher;
|
||||||
$child_watcher = AnyEvent->child(pid => $pid, cb => sub {
|
$child_watcher = AnyEvent->child(pid => $pid, cb => sub {
|
||||||
say "child died. pid = $pid";
|
say "child died. pid = $pid";
|
||||||
undef $child_watcher;
|
undef $child_watcher;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
# close the socket, the child process should be the only one which keeps a file
|
|
||||||
# descriptor on the listening socket.
|
|
||||||
$socket->close;
|
|
||||||
|
|
||||||
# We now connect (will succeed immediately) and send a request afterwards.
|
|
||||||
# As soon as the reply is there, i3 is considered ready.
|
|
||||||
my $cl = IO::Socket::UNIX->new(Peer => "/tmp/nested-$display-activation");
|
|
||||||
my $hdl;
|
|
||||||
$hdl = AnyEvent::Handle->new(fh => $cl, on_error => sub { $activate_cv->send(0) });
|
|
||||||
|
|
||||||
# send a get_tree message without payload
|
|
||||||
$hdl->push_write('i3-ipc' . pack("LL", 0, 4));
|
|
||||||
|
|
||||||
# wait for the reply
|
|
||||||
$hdl->push_read(chunk => 1, => sub {
|
|
||||||
my ($h, $line) = @_;
|
|
||||||
$activate_cv->send(1);
|
|
||||||
undef $hdl;
|
|
||||||
});
|
|
||||||
|
|
||||||
return $pid;
|
|
||||||
};
|
|
||||||
|
|
||||||
my $pid;
|
|
||||||
$pid = $start_i3->() unless $dont_start;
|
|
||||||
|
|
||||||
my $kill_i3 = sub {
|
my $kill_i3 = sub {
|
||||||
# Don’t bother killing i3 when we haven’t started it
|
# Don’t bother killing i3 when we haven’t started it
|
||||||
|
@ -245,7 +188,7 @@ sub take_job {
|
||||||
|
|
||||||
my $output;
|
my $output;
|
||||||
my $parser = TAP::Parser->new({
|
my $parser = TAP::Parser->new({
|
||||||
exec => [ 'sh', '-c', qq|DISPLAY=$display LOGPATH="$logpath" /usr/bin/perl -It/lib $test| ],
|
exec => [ 'sh', '-c', qq|DISPLAY=$display LOGPATH="$logpath" /usr/bin/perl -Ilib $test| ],
|
||||||
spool => IO::Scalar->new(\$output),
|
spool => IO::Scalar->new(\$output),
|
||||||
merge => 1,
|
merge => 1,
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
package SocketActivation;
|
||||||
|
# vim:ts=4:sw=4:expandtab
|
||||||
|
|
||||||
|
use IO::Socket::UNIX; # core
|
||||||
|
use Cwd qw(abs_path); # core
|
||||||
|
use POSIX; # core
|
||||||
|
use AnyEvent::Handle; # not core
|
||||||
|
use Exporter 'import';
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
|
our @EXPORT = qw(activate_i3);
|
||||||
|
|
||||||
|
#
|
||||||
|
# Starts i3 using socket activation. Creates a listening socket (with bind +
|
||||||
|
# listen) which is then passed to i3, who in turn calls accept and handles the
|
||||||
|
# requests.
|
||||||
|
#
|
||||||
|
# Since the kernel buffers the connect, the parent process can connect to the
|
||||||
|
# socket immediately after forking. It then sends a request and waits until it
|
||||||
|
# gets an answer. Obviously, i3 has to be initialized to actually answer the
|
||||||
|
# request.
|
||||||
|
#
|
||||||
|
# This way, we can wait *precisely* the amount of time which i3 waits to get
|
||||||
|
# ready, which is a *HUGE* speed gain (and a lot more robust) in comparison to
|
||||||
|
# using sleep() with a fixed amount of time.
|
||||||
|
#
|
||||||
|
# unix_socket_path: Location of the socket to use for the activation
|
||||||
|
# display: X11 $ENV{DISPLAY}
|
||||||
|
# configfile: path to the configuration file to use
|
||||||
|
# logpath: path to the logfile to which i3 will append
|
||||||
|
# cv: an AnyEvent->condvar which will be triggered once i3 is ready
|
||||||
|
#
|
||||||
|
sub activate_i3 {
|
||||||
|
my %args = @_;
|
||||||
|
|
||||||
|
# remove the old unix socket
|
||||||
|
unlink($args{unix_socket_path});
|
||||||
|
|
||||||
|
# pass all file descriptors up to three to the children.
|
||||||
|
# we need to set this flag before opening the socket.
|
||||||
|
open(my $fdtest, '<', '/dev/null');
|
||||||
|
$^F = fileno($fdtest);
|
||||||
|
close($fdtest);
|
||||||
|
my $socket = IO::Socket::UNIX->new(
|
||||||
|
Listen => 1,
|
||||||
|
Local => $args{unix_socket_path},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $pid = fork;
|
||||||
|
if (!defined($pid)) {
|
||||||
|
die "could not fork()";
|
||||||
|
}
|
||||||
|
if ($pid == 0) {
|
||||||
|
$ENV{LISTEN_PID} = $$;
|
||||||
|
$ENV{LISTEN_FDS} = 1;
|
||||||
|
$ENV{DISPLAY} = $args{display};
|
||||||
|
# Only pass file descriptors 0 (stdin), 1 (stdout), 2 (stderr) and
|
||||||
|
# 3 (socket) to the child.
|
||||||
|
$^F = 3;
|
||||||
|
|
||||||
|
# If the socket does not use file descriptor 3 by chance already, we
|
||||||
|
# close fd 3 and dup2() the socket to 3.
|
||||||
|
if (fileno($socket) != 3) {
|
||||||
|
POSIX::close(3);
|
||||||
|
POSIX::dup2(fileno($socket), 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Construct the command to launch i3. Use maximum debug level, disable
|
||||||
|
# the interactive signalhandler to make it crash immediately instead.
|
||||||
|
my $i3cmd = abs_path("../i3") . " -V -d all --disable-signalhandler";
|
||||||
|
|
||||||
|
# Append to $args{logpath} instead of overwriting because i3 might be
|
||||||
|
# run multiple times in one testcase.
|
||||||
|
my $cmd = "exec $i3cmd -c $args{configfile} >>$args{logpath} 2>&1";
|
||||||
|
|
||||||
|
# We need to use the shell due to using output redirections.
|
||||||
|
exec "/bin/sh", '-c', $cmd;
|
||||||
|
|
||||||
|
# if we are still here, i3 could not be found or exec failed. bail out.
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# close the socket, the child process should be the only one which keeps a file
|
||||||
|
# descriptor on the listening socket.
|
||||||
|
$socket->close;
|
||||||
|
|
||||||
|
# We now connect (will succeed immediately) and send a request afterwards.
|
||||||
|
# As soon as the reply is there, i3 is considered ready.
|
||||||
|
my $cl = IO::Socket::UNIX->new(Peer => $args{unix_socket_path});
|
||||||
|
my $hdl;
|
||||||
|
$hdl = AnyEvent::Handle->new(
|
||||||
|
fh => $cl,
|
||||||
|
on_error => sub {
|
||||||
|
$hdl->destroy;
|
||||||
|
$args{cv}->send(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
# send a get_tree message without payload
|
||||||
|
$hdl->push_write('i3-ipc' . pack("LL", 0, 4));
|
||||||
|
|
||||||
|
# wait for the reply
|
||||||
|
$hdl->push_read(chunk => 1, => sub {
|
||||||
|
my ($h, $line) = @_;
|
||||||
|
$args{cv}->send(1);
|
||||||
|
undef $hdl;
|
||||||
|
});
|
||||||
|
|
||||||
|
return $pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
1
|
|
@ -14,6 +14,7 @@ use Time::HiRes qw(sleep);
|
||||||
use Try::Tiny;
|
use Try::Tiny;
|
||||||
use Cwd qw(abs_path);
|
use Cwd qw(abs_path);
|
||||||
use Proc::Background;
|
use Proc::Background;
|
||||||
|
use SocketActivation;
|
||||||
|
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|
||||||
|
@ -103,9 +104,10 @@ sub wait_for_event {
|
||||||
};
|
};
|
||||||
|
|
||||||
# Trigger timeout after $timeout seconds (can be fractional)
|
# Trigger timeout after $timeout seconds (can be fractional)
|
||||||
my $timeout = AE::timer $timeout, 0, sub { warn "timeout"; $cv->send(0) };
|
my $t = AE::timer $timeout, 0, sub { warn "timeout ($timeout secs)"; $cv->send(0) };
|
||||||
|
|
||||||
my $result = $cv->recv;
|
my $result = $cv->recv;
|
||||||
|
undef $t;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +115,7 @@ sub wait_for_event {
|
||||||
# make sure to include 'structure_notify' in the window’s event_mask attribute
|
# make sure to include 'structure_notify' in the window’s event_mask attribute
|
||||||
sub wait_for_map {
|
sub wait_for_map {
|
||||||
my ($x) = @_;
|
my ($x) = @_;
|
||||||
wait_for_event $x, 1, sub { $_[0]->{response_type} == MAP_NOTIFY };
|
wait_for_event $x, 2, sub { $_[0]->{response_type} == MAP_NOTIFY };
|
||||||
}
|
}
|
||||||
|
|
||||||
# Wrapper around wait_for_event which waits for UNMAP_NOTIFY. Also calls
|
# Wrapper around wait_for_event which waits for UNMAP_NOTIFY. Also calls
|
||||||
|
@ -121,7 +123,7 @@ sub wait_for_map {
|
||||||
# event.
|
# event.
|
||||||
sub wait_for_unmap {
|
sub wait_for_unmap {
|
||||||
my ($x) = @_;
|
my ($x) = @_;
|
||||||
wait_for_event $x, 1, sub { $_[0]->{response_type} == UNMAP_NOTIFY };
|
wait_for_event $x, 2, sub { $_[0]->{response_type} == UNMAP_NOTIFY };
|
||||||
sync_with_i3($x);
|
sync_with_i3($x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +325,7 @@ sub sync_with_i3 {
|
||||||
|
|
||||||
$_sync_window->map;
|
$_sync_window->map;
|
||||||
|
|
||||||
wait_for_event $x, 0.5, sub { $_[0]->{response_type} == MAP_NOTIFY };
|
wait_for_event $x, 2, sub { $_[0]->{response_type} == MAP_NOTIFY };
|
||||||
}
|
}
|
||||||
|
|
||||||
my $root = $x->get_root_window();
|
my $root = $x->get_root_window();
|
||||||
|
@ -349,7 +351,7 @@ sub sync_with_i3 {
|
||||||
$x->send_event(0, $root, EVENT_MASK_SUBSTRUCTURE_REDIRECT, $msg);
|
$x->send_event(0, $root, EVENT_MASK_SUBSTRUCTURE_REDIRECT, $msg);
|
||||||
|
|
||||||
# now wait until the reply is here
|
# now wait until the reply is here
|
||||||
return wait_for_event $x, 1, sub {
|
return wait_for_event $x, 2, sub {
|
||||||
my ($event) = @_;
|
my ($event) = @_;
|
||||||
# TODO: const
|
# TODO: const
|
||||||
return 0 unless $event->{response_type} == 161;
|
return 0 unless $event->{response_type} == 161;
|
||||||
|
@ -414,7 +416,9 @@ sub get_socket_path {
|
||||||
# complete-run.pl that it should not create an instance of i3
|
# complete-run.pl that it should not create an instance of i3
|
||||||
#
|
#
|
||||||
sub launch_with_config {
|
sub launch_with_config {
|
||||||
my ($config) = @_;
|
my ($config, $dont_add_socket_path) = @_;
|
||||||
|
|
||||||
|
$dont_add_socket_path //= 0;
|
||||||
|
|
||||||
if (!defined($tmp_socket_path)) {
|
if (!defined($tmp_socket_path)) {
|
||||||
$tmp_socket_path = File::Temp::tempnam('/tmp', 'i3-test-socket-');
|
$tmp_socket_path = File::Temp::tempnam('/tmp', 'i3-test-socket-');
|
||||||
|
@ -422,20 +426,25 @@ sub launch_with_config {
|
||||||
|
|
||||||
my ($fh, $tmpfile) = tempfile('i3-test-config-XXXXX', UNLINK => 1);
|
my ($fh, $tmpfile) = tempfile('i3-test-config-XXXXX', UNLINK => 1);
|
||||||
say $fh $config;
|
say $fh $config;
|
||||||
say $fh "ipc-socket $tmp_socket_path";
|
say $fh "ipc-socket $tmp_socket_path" unless $dont_add_socket_path;
|
||||||
close($fh);
|
close($fh);
|
||||||
|
|
||||||
# Use $ENV{LOGPATH}, gets set in complete-run.pl. We append instead of
|
my $cv = AnyEvent->condvar;
|
||||||
# overwrite because there might be multiple instances of i3 running during
|
my $pid = activate_i3(
|
||||||
# one test case.
|
unix_socket_path => "$tmp_socket_path-activation",
|
||||||
my $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $tmpfile >>$ENV{LOGPATH} 2>&1";
|
display => $ENV{DISPLAY},
|
||||||
my $process = Proc::Background->new($i3cmd);
|
configfile => $tmpfile,
|
||||||
sleep 1.25;
|
logpath => $ENV{LOGPATH},
|
||||||
|
cv => $cv,
|
||||||
|
);
|
||||||
|
|
||||||
|
# blockingly wait until i3 is ready
|
||||||
|
$cv->recv;
|
||||||
|
|
||||||
# force update of the cached socket path in lib/i3test
|
# force update of the cached socket path in lib/i3test
|
||||||
get_socket_path(0);
|
get_socket_path(0);
|
||||||
|
|
||||||
return $process;
|
return $pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
1
|
1
|
|
@ -18,26 +18,21 @@ my $i3_path = abs_path("../i3");
|
||||||
# default case: socket will be created in /tmp/i3-<username>/ipc-socket.<pid>
|
# default case: socket will be created in /tmp/i3-<username>/ipc-socket.<pid>
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
my ($fh, $tmpfile) = tempfile('/tmp/i3-test-config.XXXXXX', UNLINK => 1);
|
my $config = <<EOT;
|
||||||
say $fh "# i3 config file (v4)";
|
# i3 config file (v4)
|
||||||
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
close($fh);
|
EOT
|
||||||
|
|
||||||
diag("Starting i3");
|
# ensure XDG_RUNTIME_DIR is not set
|
||||||
my $i3cmd = "unset XDG_RUNTIME_DIR; exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $tmpfile >/dev/null 2>/dev/null";
|
delete $ENV{XDG_RUNTIME_DIR};
|
||||||
my $process = Proc::Background->new($i3cmd);
|
my $pid = launch_with_config($config, 1);
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
diag("pid = " . $process->pid);
|
|
||||||
|
|
||||||
my $folder = "/tmp/i3-" . getpwuid(getuid());
|
my $folder = "/tmp/i3-" . getpwuid(getuid());
|
||||||
ok(-d $folder, "folder $folder exists");
|
ok(-d $folder, "folder $folder exists");
|
||||||
my $socketpath = "$folder/ipc-socket." . $process->pid;
|
my $socketpath = "$folder/ipc-socket." . $pid;
|
||||||
ok(-S $socketpath, "file $socketpath exists and is a socket");
|
ok(-S $socketpath, "file $socketpath exists and is a socket");
|
||||||
|
|
||||||
exit_gracefully($process->pid, $socketpath);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
sleep 0.25;
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# XDG_RUNTIME_DIR case: socket gets created in $XDG_RUNTIME_DIR/i3/ipc-socket.<pid>
|
# XDG_RUNTIME_DIR case: socket gets created in $XDG_RUNTIME_DIR/i3/ipc-socket.<pid>
|
||||||
|
@ -47,17 +42,15 @@ my $rtdir = tempdir(CLEANUP => 1);
|
||||||
|
|
||||||
ok(! -e "$rtdir/i3", "$rtdir/i3 does not exist yet");
|
ok(! -e "$rtdir/i3", "$rtdir/i3 does not exist yet");
|
||||||
|
|
||||||
$i3cmd = "export XDG_RUNTIME_DIR=$rtdir; exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $tmpfile >/dev/null 2>/dev/null";
|
$ENV{XDG_RUNTIME_DIR} = $rtdir;
|
||||||
$process = Proc::Background->new($i3cmd);
|
|
||||||
sleep 1;
|
$pid = launch_with_config($config, 1);
|
||||||
|
|
||||||
ok(-d "$rtdir/i3", "$rtdir/i3 exists and is a directory");
|
ok(-d "$rtdir/i3", "$rtdir/i3 exists and is a directory");
|
||||||
$socketpath = "$rtdir/i3/ipc-socket." . $process->pid;
|
$socketpath = "$rtdir/i3/ipc-socket." . $pid;
|
||||||
ok(-S $socketpath, "file $socketpath exists and is a socket");
|
ok(-S $socketpath, "file $socketpath exists and is a socket");
|
||||||
|
|
||||||
exit_gracefully($process->pid, $socketpath);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
sleep 0.25;
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# configuration file case: socket gets placed whereever we specify
|
# configuration file case: socket gets placed whereever we specify
|
||||||
|
@ -67,18 +60,16 @@ my $tmpdir = tempdir(CLEANUP => 1);
|
||||||
$socketpath = $tmpdir . "/config.sock";
|
$socketpath = $tmpdir . "/config.sock";
|
||||||
ok(! -e $socketpath, "$socketpath does not exist yet");
|
ok(! -e $socketpath, "$socketpath does not exist yet");
|
||||||
|
|
||||||
($fh, $tmpfile) = tempfile('/tmp/i3-test-config.XXXXXX', UNLINK => 1);
|
$config = <<EOT;
|
||||||
say $fh "# i3 config file (v4)";
|
# i3 config file (v4)
|
||||||
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
say $fh "ipc-socket $socketpath";
|
ipc-socket $socketpath
|
||||||
close($fh);
|
EOT
|
||||||
|
|
||||||
$i3cmd = "export XDG_RUNTIME_DIR=$rtdir; exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $tmpfile >/dev/null 2>/dev/null";
|
$pid = launch_with_config($config, 1);
|
||||||
$process = Proc::Background->new($i3cmd);
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
ok(-S $socketpath, "file $socketpath exists and is a socket");
|
ok(-S $socketpath, "file $socketpath exists and is a socket");
|
||||||
|
|
||||||
exit_gracefully($process->pid, $socketpath);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
|
@ -24,7 +24,7 @@ for_window [class="borderless"] border none
|
||||||
for_window [title="special borderless title"] border none
|
for_window [title="special borderless title"] border none
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
my $process = launch_with_config($config);
|
my $pid = launch_with_config($config);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ wait_for_unmap $x;
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 0, 'no more nodes');
|
cmp_ok(@content, '==', 0, 'no more nodes');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 2: match on the title, check if for_window is really executed
|
# 2: match on the title, check if for_window is really executed
|
||||||
|
@ -107,7 +107,7 @@ for_window [class="borderless"] border none
|
||||||
for_window [title="special borderless title"] border none
|
for_window [title="special borderless title"] border none
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ wait_for_unmap $x;
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 0, 'no more nodes');
|
cmp_ok(@content, '==', 0, 'no more nodes');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 3: match on the title, set border style *and* a mark
|
# 3: match on the title, set border style *and* a mark
|
||||||
|
@ -167,7 +167,7 @@ for_window [title="special borderless title"] border none
|
||||||
for_window [title="special mark title"] border none, mark bleh
|
for_window [title="special mark title"] border none, mark bleh
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ cmd qq|[con_mark="bleh"] focus|;
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
ok($content[0]->{focused}, 'first node focused');
|
ok($content[0]->{focused}, 'first node focused');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 4: multiple criteria for the for_window command
|
# 4: multiple criteria for the for_window command
|
||||||
|
@ -211,7 +211,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
for_window [class="borderless" title="usethis"] border none
|
for_window [class="borderless" title="usethis"] border none
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -233,12 +233,15 @@ wait_for_map $x;
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'none', 'no border');
|
is($content[0]->{border}, 'none', 'no border');
|
||||||
|
|
||||||
$window->unmap;
|
cmd 'kill';
|
||||||
wait_for_unmap $x;
|
wait_for_unmap $x;
|
||||||
|
$window->destroy;
|
||||||
|
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 0, 'no nodes on this workspace now');
|
cmp_ok(@content, '==', 0, 'no nodes on this workspace now');
|
||||||
|
|
||||||
|
$window->_create;
|
||||||
|
|
||||||
set_wm_class($window->id, 'borderless', 'borderless');
|
set_wm_class($window->id, 'borderless', 'borderless');
|
||||||
$window->name('notthis');
|
$window->name('notthis');
|
||||||
$window->map;
|
$window->map;
|
||||||
|
@ -249,7 +252,7 @@ cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'normal', 'no border');
|
is($content[0]->{border}, 'normal', 'no border');
|
||||||
|
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 5: check that a class criterion does not match the instance
|
# 5: check that a class criterion does not match the instance
|
||||||
|
@ -261,7 +264,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
for_window [class="foo"] border 1pixel
|
for_window [class="foo"] border 1pixel
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -283,7 +286,7 @@ wait_for_map $x;
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'normal', 'normal border, not matched');
|
is($content[0]->{border}, 'normal', 'normal border, not matched');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 6: check that the 'instance' criterion works
|
# 6: check that the 'instance' criterion works
|
||||||
|
@ -296,7 +299,7 @@ for_window [class="foo"] border 1pixel
|
||||||
for_window [instance="foo"] border none
|
for_window [instance="foo"] border none
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -318,7 +321,7 @@ wait_for_map $x;
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'none', 'no border');
|
is($content[0]->{border}, 'none', 'no border');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 7: check that invalid criteria don’t end up matching all windows
|
# 7: check that invalid criteria don’t end up matching all windows
|
||||||
|
@ -333,7 +336,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
for_window [id="asdf"] border none
|
for_window [id="asdf"] border none
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -355,7 +358,7 @@ wait_for_map $x;
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'normal', 'normal border');
|
is($content[0]->{border}, 'normal', 'normal border');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 8: check that the role criterion works properly
|
# 8: check that the role criterion works properly
|
||||||
|
@ -370,7 +373,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
for_window [window_role="i3test"] border none
|
for_window [window_role="i3test"] border none
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -403,7 +406,7 @@ wait_for_map $x;
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'none', 'no border (window_role)');
|
is($content[0]->{border}, 'none', 'no border (window_role)');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 9: another test for the window_role, but this time it changes
|
# 9: another test for the window_role, but this time it changes
|
||||||
|
@ -419,7 +422,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
for_window [window_role="i3test"] border none
|
for_window [window_role="i3test"] border none
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -460,7 +463,7 @@ sync_with_i3 $x;
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'none', 'no border (window_role 2)');
|
is($content[0]->{border}, 'none', 'no border (window_role 2)');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
|
@ -40,7 +40,7 @@ my $config = <<EOT;
|
||||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
my $process = launch_with_config($config);
|
my $pid = launch_with_config($config);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ wait_for_map $x;
|
||||||
|
|
||||||
ok(@{get_ws_content($tmp)} == 1, 'special window got managed to current (random) workspace');
|
ok(@{get_ws_content($tmp)} == 1, 'special window got managed to current (random) workspace');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
$window->destroy;
|
$window->destroy;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
assign "special" → targetws
|
assign "special" → targetws
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ ok("targetws" ~~ @{get_workspace_names()}, 'targetws exists');
|
||||||
|
|
||||||
$window->destroy;
|
$window->destroy;
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
sleep 0.25;
|
sleep 0.25;
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ sleep 0.25;
|
||||||
# already, next to the existing node.
|
# already, next to the existing node.
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
# initialize the target workspace, then go to a fresh one
|
# initialize the target workspace, then go to a fresh one
|
||||||
ok(!("targetws" ~~ @{get_workspace_names()}), 'targetws does not exist yet');
|
ok(!("targetws" ~~ @{get_workspace_names()}), 'targetws does not exist yet');
|
||||||
|
@ -144,7 +144,7 @@ sync_with_i3 $x;
|
||||||
ok(@{get_ws_content($tmp)} == 0, 'still no containers');
|
ok(@{get_ws_content($tmp)} == 0, 'still no containers');
|
||||||
ok(@{get_ws_content('targetws')} == 2, 'two containers on targetws');
|
ok(@{get_ws_content('targetws')} == 2, 'two containers on targetws');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# start a window and see that it gets assigned to a workspace which has content
|
# start a window and see that it gets assigned to a workspace which has content
|
||||||
|
@ -157,7 +157,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
assign "special" → ~
|
assign "special" → ~
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ ok(@{$content->{floating_nodes}} == 1, 'one floating con');
|
||||||
|
|
||||||
$window->destroy;
|
$window->destroy;
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
sleep 0.25;
|
sleep 0.25;
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
assign "special" → ~
|
assign "special" → ~
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ ok(@{$content->{floating_nodes}} == 1, 'one floating con');
|
||||||
|
|
||||||
$window->destroy;
|
$window->destroy;
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
sleep 0.25;
|
sleep 0.25;
|
||||||
|
|
||||||
|
@ -241,7 +241,11 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
assign "special" → ~
|
assign "special" → ~
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
|
# TODO: replace this with checking the process hierarchy
|
||||||
|
# XXX: give i3-nagbar some time to start up
|
||||||
|
sleep 1;
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -275,7 +279,7 @@ $window->destroy;
|
||||||
|
|
||||||
does_i3_live;
|
does_i3_live;
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
sleep 0.25;
|
sleep 0.25;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ my $config = <<EOT;
|
||||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
my $process = launch_with_config($config);
|
my $pid = launch_with_config($config);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
|
||||||
isnt($content[0]->{layout}, 'stacked', 'layout not stacked');
|
isnt($content[0]->{layout}, 'stacked', 'layout not stacked');
|
||||||
isnt($content[1]->{layout}, 'stacked', 'layout not stacked');
|
isnt($content[1]->{layout}, 'stacked', 'layout not stacked');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# 2: set workspace_layout stacked, check that when opening two cons,
|
# 2: set workspace_layout stacked, check that when opening two cons,
|
||||||
|
@ -50,7 +50,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
workspace_layout stacked
|
workspace_layout stacked
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -122,6 +122,6 @@ is($content[1]->{layout}, 'stacked', 'layout stacked');
|
||||||
is(@content, 1, 'one con on target workspace');
|
is(@content, 1, 'one con on target workspace');
|
||||||
is($content[0]->{layout}, 'stacked', 'layout stacked');
|
is($content[0]->{layout}, 'stacked', 'layout stacked');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
|
@ -19,7 +19,7 @@ my $config = <<EOT;
|
||||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
my $process = launch_with_config($config);
|
my $pid = launch_with_config($config);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ is($x->input_focus, $second->id, 'second window focused');
|
||||||
cmd 'focus right';
|
cmd 'focus right';
|
||||||
is($x->input_focus, $third->id, 'third window focused');
|
is($x->input_focus, $third->id, 'third window focused');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# 2: test the wrapping behaviour with force_focus_wrapping
|
# 2: test the wrapping behaviour with force_focus_wrapping
|
||||||
|
@ -60,7 +60,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
force_focus_wrapping true
|
force_focus_wrapping true
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -92,6 +92,6 @@ is($x->input_focus, $second->id, 'second window focused');
|
||||||
cmd 'focus right';
|
cmd 'focus right';
|
||||||
is($x->input_focus, $first->id, 'first window focused');
|
is($x->input_focus, $first->id, 'first window focused');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
|
@ -19,12 +19,12 @@ my $config = <<EOT;
|
||||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
my $process = launch_with_config($config);
|
my $pid = launch_with_config($config);
|
||||||
|
|
||||||
my @names = @{get_workspace_names()};
|
my @names = @{get_workspace_names()};
|
||||||
cmp_deeply(\@names, [ '1' ], 'i3 starts on workspace 1 without any configuration');
|
cmp_deeply(\@names, [ '1' ], 'i3 starts on workspace 1 without any configuration');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 2: with named workspaces, i3 should start on the first named one
|
# 2: with named workspaces, i3 should start on the first named one
|
||||||
|
@ -37,12 +37,12 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
bindsym Mod1+1 workspace foobar
|
bindsym Mod1+1 workspace foobar
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
my @names = @{get_workspace_names()};
|
my @names = @{get_workspace_names()};
|
||||||
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 3: the same test as 2, but with a quoted workspace name
|
# 3: the same test as 2, but with a quoted workspace name
|
||||||
|
@ -55,11 +55,11 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
bindsym Mod1+1 workspace "foobar"
|
bindsym Mod1+1 workspace "foobar"
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
my @names = @{get_workspace_names()};
|
my @names = @{get_workspace_names()};
|
||||||
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
|
@ -42,7 +42,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
assign "special" → targetws
|
assign "special" → targetws
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
my $process = launch_with_config($config);
|
my $pid = launch_with_config($config);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
|
||||||
ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
|
ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
|
||||||
ok(get_ws($tmp)->{focused}, 'current workspace still focused');
|
ok(get_ws($tmp)->{focused}, 'current workspace still focused');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
$window->destroy;
|
$window->destroy;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ my $config = <<EOT;
|
||||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
my $process = launch_with_config($config);
|
my $pid = launch_with_config($config);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ my @content = @{get_ws_content($tmp)};
|
||||||
ok(@content == 1, 'one container opened');
|
ok(@content == 1, 'one container opened');
|
||||||
is($content[0]->{border}, 'normal', 'border normal by default');
|
is($content[0]->{border}, 'normal', 'border normal by default');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# 2: check that new tiling windows start with '1pixel' border when
|
# 2: check that new tiling windows start with '1pixel' border when
|
||||||
|
@ -45,7 +45,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
new_window 1pixel
|
new_window 1pixel
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ $first = open_window($x);
|
||||||
ok(@content == 1, 'one container opened');
|
ok(@content == 1, 'one container opened');
|
||||||
is($content[0]->{border}, '1pixel', 'border normal by default');
|
is($content[0]->{border}, '1pixel', 'border normal by default');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# 3: check that new floating windows start with 'normal' border unless
|
# 3: check that new floating windows start with 'normal' border unless
|
||||||
|
@ -69,7 +69,7 @@ $config = <<EOT;
|
||||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ ok(@floating == 1, 'one floating container opened');
|
||||||
my $floatingcon = $floating[0];
|
my $floatingcon = $floating[0];
|
||||||
is($floatingcon->{nodes}->[0]->{border}, 'normal', 'border normal by default');
|
is($floatingcon->{nodes}->[0]->{border}, 'normal', 'border normal by default');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# 4: check that new floating windows start with '1pixel' border when
|
# 4: check that new floating windows start with '1pixel' border when
|
||||||
|
@ -97,7 +97,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
new_float 1pixel
|
new_float 1pixel
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$process = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -111,6 +111,6 @@ ok(@floating == 1, 'one floating container opened');
|
||||||
$floatingcon = $floating[0];
|
$floatingcon = $floating[0];
|
||||||
is($floatingcon->{nodes}->[0]->{border}, '1pixel', 'border normal by default');
|
is($floatingcon->{nodes}->[0]->{border}, '1pixel', 'border normal by default');
|
||||||
|
|
||||||
exit_gracefully($process->pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in New Issue