implement support for WM_TRANSIENT_FOR, expand testcase
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#!perl
|
||||
# vim:ts=4:sw=4:expandtab
|
||||
|
||||
use i3test tests => 3;
|
||||
use i3test tests => 7;
|
||||
use X11::XCB qw(:all);
|
||||
use Time::HiRes qw(sleep);
|
||||
|
||||
@ -15,6 +15,89 @@ my $i3 = i3("/tmp/nestedcons");
|
||||
my $tmp = get_unused_workspace();
|
||||
$i3->command("workspace $tmp")->recv;
|
||||
|
||||
####################################################################################
|
||||
# first part: test if a floating window will be correctly positioned above its leader
|
||||
#
|
||||
# This is verified by opening two windows, then opening a floating window above the
|
||||
# right one, then above the left one. If the floating windows are all positioned alike,
|
||||
# one of both (depending on your screen resolution) will be positioned wrong.
|
||||
####################################################################################
|
||||
|
||||
my $left = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
rect => [0, 0, 30, 30],
|
||||
background_color => '#FF0000',
|
||||
);
|
||||
|
||||
$left->name('Left');
|
||||
$left->map;
|
||||
|
||||
my $right = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
rect => [0, 0, 30, 30],
|
||||
background_color => '#FF0000',
|
||||
);
|
||||
|
||||
$right->name('Right');
|
||||
$right->map;
|
||||
|
||||
sleep 0.25;
|
||||
|
||||
my ($abs, $rgeom) = $right->rect;
|
||||
|
||||
my $child = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
rect => [ 0, 0, 30, 30 ],
|
||||
background_color => '#C0C0C0',
|
||||
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
|
||||
);
|
||||
|
||||
$child->name('Child window');
|
||||
$child->client_leader($right);
|
||||
$child->map;
|
||||
|
||||
sleep 0.25;
|
||||
|
||||
my $cgeom;
|
||||
($abs, $cgeom) = $child->rect;
|
||||
cmp_ok($cgeom->x, '>=', $rgeom->x, 'Child X >= right container X');
|
||||
|
||||
my $child2 = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
rect => [ 0, 0, 30, 30 ],
|
||||
background_color => '#C0C0C0',
|
||||
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
|
||||
);
|
||||
|
||||
$child2->name('Child window 2');
|
||||
$child2->client_leader($left);
|
||||
$child2->map;
|
||||
|
||||
sleep 0.25;
|
||||
|
||||
($abs, $cgeom) = $child2->rect;
|
||||
cmp_ok(($cgeom->x + $cgeom->width), '<', $rgeom->x, 'child above left window');
|
||||
|
||||
# check wm_transient_for
|
||||
|
||||
|
||||
my $fwindow = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
rect => [ 0, 0, 30, 30],
|
||||
background_color => '#FF0000',
|
||||
);
|
||||
|
||||
$fwindow->transient_for($right);
|
||||
$fwindow->map;
|
||||
|
||||
sleep 0.25;
|
||||
|
||||
my ($absolute, $top) = $fwindow->rect;
|
||||
ok($absolute->{x} != 0 && $absolute->{y} != 0, 'i3 did not map it to (0x0)');
|
||||
|
||||
SKIP: {
|
||||
skip "(workspace placement by client_leader not yet implemented)", 3;
|
||||
|
||||
#####################################################################
|
||||
# Create a parent window
|
||||
#####################################################################
|
||||
@ -55,3 +138,5 @@ isnt($x->input_focus, $child->id, "Child window focused");
|
||||
$i3->command("workspace $tmp")->recv;
|
||||
|
||||
is($x->input_focus, $child->id, "Child window focused");
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user