From: Michael Stapelberg Date: Sat, 3 Jul 2010 13:29:44 +0000 (+0200) Subject: t/18-openkill.t: search not focused container instead of using the first one X-Git-Tag: tree-pr1~167 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f7842e4c71d1fee3d3015ec2f49e4fc0a3161bb7;p=i3%2Fi3 t/18-openkill.t: search not focused container instead of using the first one --- diff --git a/testcases/t/18-openkill.t b/testcases/t/18-openkill.t index 1d9d705d..9749c1da 100644 --- a/testcases/t/18-openkill.t +++ b/testcases/t/18-openkill.t @@ -3,6 +3,7 @@ # # Tests whether opening an empty container and killing it again works # +use List::Util qw(first); use i3test tests => 6; use v5.10; @@ -31,10 +32,8 @@ $i3->command('open')->recv; ok(@{get_ws_content($tmp)} == 2, 'two containers opened'); my $content = get_ws_content($tmp); -# TODO: get the focused window, don’t assume that it is -# the latest one -my $id = $content->[0]->{id}; -diag('id of not focused = ' . $id); +my $not_focused = first { !$_->{focused} } @{$content}; +my $id = $not_focused->{id}; $i3->command("[con_id=\"$id\"] kill")->recv;