testcases: fix race conditions in various tests
This commit is contained in:
parent
af793c9030
commit
0f386a96e7
@ -49,8 +49,7 @@ cmd 'floating enable';
|
||||
# now kill the third one (it's floating). focus should stay unchanged
|
||||
cmd '[id="' . $third->id . '"] kill';
|
||||
|
||||
# TODO: wait for unmapnotify
|
||||
sync_with_i3($x);
|
||||
wait_for_unmap($x);
|
||||
|
||||
is($x->input_focus, $second->id, 'second con still focused after killing third');
|
||||
|
||||
@ -81,15 +80,12 @@ cmd 'floating enable';
|
||||
# now kill the second one. focus should fall back to the third one, which is
|
||||
# also floating
|
||||
cmd 'kill';
|
||||
|
||||
# TODO: wait for unmapnotify
|
||||
sync_with_i3($x);
|
||||
wait_for_unmap($x);
|
||||
|
||||
is($x->input_focus, $third->id, 'third con focused');
|
||||
|
||||
cmd 'kill';
|
||||
# TODO: wait for unmapnotify
|
||||
sync_with_i3($x);
|
||||
wait_for_unmap($x);
|
||||
|
||||
is($x->input_focus, $first->id, 'first con focused after killing all floating cons');
|
||||
|
||||
@ -122,15 +118,12 @@ sync_with_i3($x);
|
||||
# now kill the second one. focus should fall back to the third one, which is
|
||||
# also floating
|
||||
cmd 'kill';
|
||||
|
||||
# TODO: wait for unmapnotify
|
||||
sync_with_i3($x);
|
||||
wait_for_unmap($x);
|
||||
|
||||
is($x->input_focus, $third->id, 'third con focused');
|
||||
|
||||
cmd 'kill';
|
||||
# TODO: wait for unmapnotify
|
||||
sync_with_i3($x);
|
||||
wait_for_unmap($x);
|
||||
|
||||
is($x->input_focus, $first->id, 'first con focused after killing all floating cons');
|
||||
|
||||
|
@ -8,13 +8,17 @@
|
||||
#
|
||||
use i3test;
|
||||
use List::Util qw(sum);
|
||||
use X11::XCB::Connection;
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
my $tmp = fresh_workspace;
|
||||
|
||||
cmd 'exec /usr/bin/urxvt';
|
||||
sleep 0.5;
|
||||
wait_for_map $x;
|
||||
cmd 'exec /usr/bin/urxvt';
|
||||
sleep 0.5;
|
||||
wait_for_map $x;
|
||||
|
||||
my ($nodes, $focus) = get_ws_content($tmp);
|
||||
my $old_sum = sum map { $_->{rect}->{width} } @{$nodes};
|
||||
#cmd 'open';
|
||||
@ -22,12 +26,13 @@ cmd 'resize grow left 10 px or 25 ppt';
|
||||
cmd 'split v';
|
||||
#cmd 'open';
|
||||
cmd 'exec /usr/bin/urxvt';
|
||||
sleep 0.5;
|
||||
cmd 'mode toggle';
|
||||
sleep 0.5;
|
||||
cmd 'kill';
|
||||
wait_for_map $x;
|
||||
|
||||
sleep 0.5;
|
||||
cmd 'mode toggle';
|
||||
sync_with_i3 $x;
|
||||
|
||||
cmd 'kill';
|
||||
wait_for_unmap $x;
|
||||
|
||||
($nodes, $focus) = get_ws_content($tmp);
|
||||
my $new_sum = sum map { $_->{rect}->{width} } @{$nodes};
|
||||
|
@ -237,6 +237,9 @@ cmd 'kill';
|
||||
wait_for_unmap $x;
|
||||
$window->destroy;
|
||||
|
||||
# give i3 a chance to delete the window from its tree
|
||||
sync_with_i3 $x;
|
||||
|
||||
@content = @{get_ws_content($tmp)};
|
||||
cmp_ok(@content, '==', 0, 'no nodes on this workspace now');
|
||||
|
||||
|
@ -5,10 +5,20 @@
|
||||
# Tests if the 'force_focus_wrapping' config directive works correctly.
|
||||
#
|
||||
use i3test;
|
||||
use X11::XCB qw(:all);
|
||||
use X11::XCB::Connection;
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
{
|
||||
package i3test::X11;
|
||||
use parent 'X11::XCB::Connection';
|
||||
|
||||
sub input_focus {
|
||||
my $self = shift;
|
||||
i3test::sync_with_i3($self);
|
||||
|
||||
return $self->SUPER::input_focus(@_);
|
||||
}
|
||||
}
|
||||
|
||||
my $x = i3test::X11->new;
|
||||
|
||||
#####################################################################
|
||||
# 1: test the wrapping behaviour without force_focus_wrapping
|
||||
|
Loading…
Reference in New Issue
Block a user