tests: implement sync_with_i3 and use it instead of sleep()
Also use open_standard_window() in a few more places where appropriate
This commit is contained in:
@ -4,11 +4,6 @@
|
||||
# over an unfocused tiling client and destroying the floating one again.
|
||||
|
||||
use i3test;
|
||||
use X11::XCB qw(:all);
|
||||
|
||||
BEGIN {
|
||||
use_ok('X11::XCB::Window') or BAIL_OUT('Could not load X11::XCB::Window');
|
||||
}
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
@ -19,30 +14,21 @@ cmd 'split h';
|
||||
my $tiled_left = open_standard_window($x);
|
||||
my $tiled_right = open_standard_window($x);
|
||||
|
||||
sleep 0.25;
|
||||
sync_with_i3($x);
|
||||
|
||||
# Get input focus before creating the floating window
|
||||
my $focus = $x->input_focus;
|
||||
|
||||
# Create a floating window which is smaller than the minimum enforced size of i3
|
||||
my $window = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
rect => [ 1, 1, 30, 30],
|
||||
background_color => '#C0C0C0',
|
||||
type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
|
||||
);
|
||||
my $window = open_standard_window($x, undef, 1);
|
||||
sync_with_i3($x);
|
||||
|
||||
isa_ok($window, 'X11::XCB::Window');
|
||||
|
||||
$window->map;
|
||||
|
||||
sleep 1;
|
||||
sleep 0.25;
|
||||
is($x->input_focus, $window->id, 'floating window focused');
|
||||
|
||||
$window->unmap;
|
||||
|
||||
sleep 0.25;
|
||||
# TODO: wait for unmap
|
||||
sync_with_i3($x);
|
||||
|
||||
is($x->input_focus, $focus, 'Focus correctly restored');
|
||||
|
||||
|
Reference in New Issue
Block a user