]> git.sur5r.net Git - i3/i3/blob - testcases/t/112-floating-resize.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 112-floating-resize.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3
4 use i3test;
5
6 fresh_workspace;
7
8 #####################################################################
9 # Create a floating window and see if resizing works
10 #####################################################################
11
12 my $window = open_floating_window;
13
14 # See if configurerequests cause window movements (they should not)
15 my ($a, $t) = $window->rect;
16 $window->rect(X11::XCB::Rect->new(x => $a->x, y => $a->y, width => $a->width, height => $a->height));
17
18 sync_with_i3;
19
20 my ($na, $nt) = $window->rect;
21 is_deeply($na, $a, 'Rects are equal after configurerequest');
22
23 sub test_resize {
24     $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 100, height => 100));
25
26     sync_with_i3;
27
28     my ($absolute, $top) = $window->rect;
29
30     # Make sure the width/height are different from what we’re gonna test, so
31     # that the test will work.
32     isnt($absolute->width, 300, 'width != 300');
33     isnt($absolute->height, 500, 'height != 500');
34
35     $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 300, height => 500));
36
37     sync_with_i3;
38
39     ($absolute, $top) = $window->rect;
40
41     is($absolute->width, 300, 'width = 300');
42     is($absolute->height, 500, 'height = 500');
43 }
44
45 # Test with default border
46 test_resize;
47
48 # Test borderless
49 cmd 'border none';
50
51 test_resize;
52
53 # Test with 1-px-border
54 cmd 'border 1pixel';
55
56 test_resize;
57
58 ################################################################################
59 # Check if we can position a floating window out of bounds. The XDummy screen
60 # is 1280x1024, so x=2864, y=893 is out of bounds.
61 ################################################################################
62
63 ($a, $t) = $window->rect;
64 $window->rect(X11::XCB::Rect->new(
65     x => 2864,
66     y => 893,
67     width => $a->width,
68     height => $a->height));
69
70 sync_with_i3;
71
72 ($a, $t) = $window->rect;
73 cmp_ok($a->x, '<', 1280, 'X not moved out of bounds');
74 cmp_ok($a->y, '<', 1024, 'Y not moved out of bounds');
75
76 done_testing;