i3/testcases/t/18-openkill.t

46 lines
1.2 KiB
Perl
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!perl
# vim:ts=4:sw=4:expandtab
#
# Tests whether opening an empty container and killing it again works
#
use i3test tests => 6;
use v5.10;
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');
##############################################################
# 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);
# TODO: get the focused window, dont assume that it is
# the latest one
my $id = $content->[0]->{id};
diag('id of not focused = ' . $id);
$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');
diag( "Testing i3, Perl $], $^X" );