Use ArrayRefs instead of Rects where possible, add t/10-dock.t

This commit is contained in:
Michael Stapelberg 2009-08-21 12:32:54 +02:00
parent 012f618c85
commit 01f06f11ba
3 changed files with 44 additions and 9 deletions

View File

@ -17,11 +17,9 @@ BEGIN {
X11::XCB::Connection->connect(':0');
# Create a floating window which is smaller than the minimum enforced size of i3
my $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
my $window = X11::XCB::Window->new(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => $original_rect,
rect => [ 0, 0, 30, 30],
background_color => 12632256,
type => 'utility',
);
@ -42,11 +40,9 @@ ok($absolute->{x} != 0 && $absolute->{y} != 0, "i3 did not map it to (0x0)");
$window->unmap;
$original_rect = X11::XCB::Rect->new(x => 1, y => 1, width => 80, height => 90);
$window = X11::XCB::Window->new(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => $original_rect,
rect => [ 1, 1, 80, 90],
background_color => 12632256,
type => 'utility',
);

View File

@ -39,11 +39,9 @@ $sock->write(i3test::format_ipc_command("ml"));
my $focus = X11::XCB::Connection->input_focus;
# Create a floating window which is smaller than the minimum enforced size of i3
my $original_rect = X11::XCB::Rect->new(x => 1, y => 1, width => 30, height => 30);
my $window = X11::XCB::Window->new(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => $original_rect,
rect => [ 1, 1, 30, 30],
background_color => 12632256,
type => 'utility',
);

41
testcases/t/10-dock.t Normal file
View File

@ -0,0 +1,41 @@
#!perl
# vim:ts=4:sw=4:expandtab
use Test::More tests => 2;
use Test::Deep;
use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep);
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
BEGIN {
#use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
}
X11::XCB::Connection->connect(':0');
#####################################################################
# Create a dock window and see if it gets managed
#####################################################################
my $window = X11::XCB::Window->new(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30],
#override_redirect => 1,
background_color => 12632256,
type => 'dock',
);
$window->create;
$window->map;
diag("dimensions before sleep: " . Dumper($window->rect));
sleep 0.25;
# TODO: check if it is as wide as the screen is
diag("dimensions after sleep: " . Dumper($window->rect));