Implement tests in t/10-dock.t

This commit is contained in:
Michael Stapelberg 2009-08-21 15:01:20 +02:00
parent 01f06f11ba
commit 4a83bd26f8
1 changed files with 11 additions and 4 deletions

View File

@ -9,6 +9,7 @@ use Time::HiRes qw(sleep);
use FindBin; use FindBin;
use lib "$FindBin::Bin/lib"; use lib "$FindBin::Bin/lib";
use i3test; use i3test;
use List::Util qw(first);
BEGIN { BEGIN {
#use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX'); #use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
@ -21,6 +22,13 @@ X11::XCB::Connection->connect(':0');
# Create a dock window and see if it gets managed # Create a dock window and see if it gets managed
##################################################################### #####################################################################
my $screens = X11::XCB::Connection->screens;
# Get the primary screen
my $primary = first { $_->primary } @{$screens};
# TODO: focus the primary screen before
my $window = X11::XCB::Window->new( my $window = X11::XCB::Window->new(
class => WINDOW_CLASS_INPUT_OUTPUT, class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30], rect => [ 0, 0, 30, 30],
@ -32,10 +40,9 @@ my $window = X11::XCB::Window->new(
$window->create; $window->create;
$window->map; $window->map;
diag("dimensions before sleep: " . Dumper($window->rect));
sleep 0.25; sleep 0.25;
# TODO: check if it is as wide as the screen is my $rect = $window->rect;
is($rect->width, $primary->rect->width, 'dock client is as wide as the screen');
diag("dimensions after sleep: " . Dumper($window->rect)); diag( "Testing i3, Perl $], $^X" );