2009-11-18 22:52:34 +01:00
|
|
|
|
#!perl
|
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
|
use i3test;
|
2009-11-18 22:52:34 +01:00
|
|
|
|
use X11::XCB qw(:all);
|
|
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
|
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-02 23:53:22 +02:00
|
|
|
|
my $x = X11::XCB::Connection->new;
|
2009-11-18 22:52:34 +01:00
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
|
fresh_workspace;
|
2009-11-18 22:52:34 +01:00
|
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
|
# Create a floating window and see if resizing works
|
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
|
|
# Create a floating window
|
2011-09-23 21:37:45 +02:00
|
|
|
|
my $window = open_standard_window($x, undef, 1);
|
2009-11-18 22:52:34 +01:00
|
|
|
|
|
2010-03-11 23:34:29 +01:00
|
|
|
|
# See if configurerequests cause window movements (they should not)
|
|
|
|
|
my ($a, $t) = $window->rect;
|
|
|
|
|
$window->rect(X11::XCB::Rect->new(x => $a->x, y => $a->y, width => $a->width, height => $a->height));
|
|
|
|
|
|
2011-09-23 21:37:45 +02:00
|
|
|
|
sync_with_i3($x);
|
|
|
|
|
|
2010-03-11 23:34:29 +01:00
|
|
|
|
my ($na, $nt) = $window->rect;
|
|
|
|
|
is_deeply($na, $a, 'Rects are equal after configurerequest');
|
2009-11-18 22:52:34 +01:00
|
|
|
|
|
|
|
|
|
sub test_resize {
|
|
|
|
|
$window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 100, height => 100));
|
|
|
|
|
|
2011-09-23 21:37:45 +02:00
|
|
|
|
sync_with_i3($x);
|
|
|
|
|
|
2009-11-18 22:52:34 +01:00
|
|
|
|
my ($absolute, $top) = $window->rect;
|
|
|
|
|
|
|
|
|
|
# Make sure the width/height are different from what we’re gonna test, so
|
|
|
|
|
# that the test will work.
|
|
|
|
|
isnt($absolute->width, 300, 'width != 300');
|
|
|
|
|
isnt($absolute->height, 500, 'height != 500');
|
|
|
|
|
|
|
|
|
|
$window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 300, height => 500));
|
2011-09-23 21:37:45 +02:00
|
|
|
|
|
|
|
|
|
sync_with_i3($x);
|
2009-11-18 22:52:34 +01:00
|
|
|
|
|
|
|
|
|
($absolute, $top) = $window->rect;
|
|
|
|
|
|
|
|
|
|
is($absolute->width, 300, 'width = 300');
|
|
|
|
|
is($absolute->height, 500, 'height = 500');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Test with default border
|
|
|
|
|
test_resize;
|
|
|
|
|
|
|
|
|
|
# Test borderless
|
2011-03-09 20:25:17 +01:00
|
|
|
|
cmd 'border none';
|
2009-11-18 22:52:34 +01:00
|
|
|
|
|
|
|
|
|
test_resize;
|
|
|
|
|
|
|
|
|
|
# Test with 1-px-border
|
2011-03-09 20:25:17 +01:00
|
|
|
|
cmd 'border 1pixel';
|
2009-11-18 22:52:34 +01:00
|
|
|
|
|
|
|
|
|
test_resize;
|
2011-03-09 20:25:17 +01:00
|
|
|
|
|
|
|
|
|
done_testing;
|