2010-04-16 08:52:31 -04:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
|
|
|
# Tests whether opening an empty container and killing it again works
|
|
|
|
#
|
2010-07-03 09:29:44 -04:00
|
|
|
use List::Util qw(first);
|
2010-04-17 16:49:26 -04:00
|
|
|
use i3test tests => 6;
|
2010-04-16 08:52:31 -04:00
|
|
|
|
|
|
|
my $i3 = i3("/tmp/nestedcons");
|
|
|
|
|
|
|
|
my $tmp = get_unused_workspace();
|
|
|
|
$i3->command("workspace $tmp")->recv;
|
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|
|
|
|
|
|
|
# Open a new container
|
|
|
|
$i3->command("open")->recv;
|
|
|
|
|
|
|
|
ok(@{get_ws_content($tmp)} == 1, 'container opened');
|
|
|
|
|
|
|
|
$i3->command("kill")->recv;
|
|
|
|
ok(@{get_ws_content($tmp)} == 0, 'container killed');
|
|
|
|
|
2010-04-16 09:30:07 -04:00
|
|
|
##############################################################
|
|
|
|
# open two containers and kill the one which is not focused
|
|
|
|
# by its ID to test if the parser correctly matches the window
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
$i3->command('open')->recv;
|
|
|
|
$i3->command('open')->recv;
|
|
|
|
ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
|
|
|
|
|
|
|
|
my $content = get_ws_content($tmp);
|
2010-07-03 09:29:44 -04:00
|
|
|
my $not_focused = first { !$_->{focused} } @{$content};
|
|
|
|
my $id = $not_focused->{id};
|
2010-04-16 09:30:07 -04:00
|
|
|
|
|
|
|
$i3->command("[con_id=\"$id\"] kill")->recv;
|
|
|
|
|
|
|
|
$content = get_ws_content($tmp);
|
|
|
|
ok(@{$content} == 1, 'one container killed');
|
|
|
|
ok($content->[0]->{id} != $id, 'correct window killed');
|
|
|
|
|
2010-04-16 08:52:31 -04:00
|
|
|
diag( "Testing i3, Perl $], $^X" );
|