From 01f06f11ba07a8a622c863874fffc1c8871620eb Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 21 Aug 2009 12:32:54 +0200 Subject: [PATCH] Use ArrayRefs instead of Rects where possible, add t/10-dock.t --- testcases/t/04-floating.t | 8 ++----- testcases/t/08-focus-stack.t | 4 +--- testcases/t/10-dock.t | 41 ++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 testcases/t/10-dock.t diff --git a/testcases/t/04-floating.t b/testcases/t/04-floating.t index d910d974..79d216d0 100644 --- a/testcases/t/04-floating.t +++ b/testcases/t/04-floating.t @@ -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', ); diff --git a/testcases/t/08-focus-stack.t b/testcases/t/08-focus-stack.t index b187d9eb..1ec0f7cb 100644 --- a/testcases/t/08-focus-stack.t +++ b/testcases/t/08-focus-stack.t @@ -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', ); diff --git a/testcases/t/10-dock.t b/testcases/t/10-dock.t new file mode 100644 index 00000000..ffc383d4 --- /dev/null +++ b/testcases/t/10-dock.t @@ -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)); -- 2.39.5