2009-11-18 16:52:34 -05:00
|
|
|
|
#!perl
|
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
2012-09-10 08:09:01 -04:00
|
|
|
|
#
|
|
|
|
|
# Please read the following documents before working on tests:
|
|
|
|
|
# • http://build.i3wm.org/docs/testsuite.html
|
|
|
|
|
# (or docs/testsuite)
|
|
|
|
|
#
|
|
|
|
|
# • http://build.i3wm.org/docs/lib-i3test.html
|
|
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
|
#
|
|
|
|
|
# • http://build.i3wm.org/docs/ipc.html
|
|
|
|
|
# (or docs/ipc)
|
|
|
|
|
#
|
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
|
# (unless you are already familiar with Perl)
|
2009-11-18 16:52:34 -05:00
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
|
use i3test;
|
2009-11-18 16:52:34 -05:00
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
|
fresh_workspace;
|
2009-11-18 16:52:34 -05:00
|
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
|
# Create a floating window and see if resizing works
|
|
|
|
|
#####################################################################
|
|
|
|
|
|
2011-11-21 19:00:54 -05:00
|
|
|
|
my $window = open_floating_window;
|
2009-11-18 16:52:34 -05:00
|
|
|
|
|
2010-03-11 17:34:29 -05: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-11-21 19:13:37 -05:00
|
|
|
|
sync_with_i3;
|
2011-09-23 15:37:45 -04:00
|
|
|
|
|
2010-03-11 17:34:29 -05:00
|
|
|
|
my ($na, $nt) = $window->rect;
|
|
|
|
|
is_deeply($na, $a, 'Rects are equal after configurerequest');
|
2009-11-18 16:52:34 -05:00
|
|
|
|
|
|
|
|
|
sub test_resize {
|
|
|
|
|
$window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 100, height => 100));
|
|
|
|
|
|
2011-11-21 19:13:37 -05:00
|
|
|
|
sync_with_i3;
|
2011-09-23 15:37:45 -04:00
|
|
|
|
|
2009-11-18 16:52:34 -05: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 15:37:45 -04:00
|
|
|
|
|
2011-11-21 19:13:37 -05:00
|
|
|
|
sync_with_i3;
|
2009-11-18 16:52:34 -05: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 14:25:17 -05:00
|
|
|
|
cmd 'border none';
|
2009-11-18 16:52:34 -05:00
|
|
|
|
|
|
|
|
|
test_resize;
|
|
|
|
|
|
|
|
|
|
# Test with 1-px-border
|
2011-03-09 14:25:17 -05:00
|
|
|
|
cmd 'border 1pixel';
|
2009-11-18 16:52:34 -05:00
|
|
|
|
|
|
|
|
|
test_resize;
|
2011-03-09 14:25:17 -05:00
|
|
|
|
|
2011-12-17 12:15:52 -05:00
|
|
|
|
################################################################################
|
2014-10-01 19:26:52 -04:00
|
|
|
|
# Check if we can position a floating window out of bounds. The Xephyr screen
|
2011-12-17 12:15:52 -05:00
|
|
|
|
# is 1280x1024, so x=2864, y=893 is out of bounds.
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
($a, $t) = $window->rect;
|
|
|
|
|
$window->rect(X11::XCB::Rect->new(
|
|
|
|
|
x => 2864,
|
|
|
|
|
y => 893,
|
|
|
|
|
width => $a->width,
|
|
|
|
|
height => $a->height));
|
|
|
|
|
|
|
|
|
|
sync_with_i3;
|
|
|
|
|
|
|
|
|
|
($a, $t) = $window->rect;
|
|
|
|
|
cmp_ok($a->x, '<', 1280, 'X not moved out of bounds');
|
|
|
|
|
cmp_ok($a->y, '<', 1024, 'Y not moved out of bounds');
|
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
|
done_testing;
|