]> git.sur5r.net Git - i3/i3/blob - testcases/t/005-floating.t
2a0d91025592dfe01a10733ddad1b655f2c36008
[i3/i3] / testcases / t / 005-floating.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • http://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16
17 use i3test;
18
19 # Create a floating window which is smaller than the minimum enforced size of i3
20 my $window = open_floating_window;
21
22 isa_ok($window, 'X11::XCB::Window');
23
24 my ($absolute, $top) = $window->rect;
25
26 ok($window->mapped, 'Window is mapped');
27 cmp_ok($absolute->{width}, '>=', 75, 'i3 raised the width to 75');
28 cmp_ok($absolute->{height}, '>=', 50, 'i3 raised the height to 50');
29
30 ok($absolute->{x} != 0 && $absolute->{y} != 0, 'i3 did not map it to (0x0)');
31
32 $window->unmap;
33
34 $window = open_floating_window(rect => [ 20, 20, 80, 90 ]);
35
36 isa_ok($window, 'X11::XCB::Window');
37
38 ($absolute, $top) = $window->rect;
39
40 cmp_ok($absolute->{width}, '==', 80, "i3 let the width at 80");
41 cmp_ok($absolute->{height}, '==', 90, "i3 let the height at 90");
42
43 cmp_ok($top->{x}, '==', 20, 'i3 mapped it to x=20');
44 cmp_ok($top->{y}, '==', 20, 'i3 mapped it to y=20');
45
46 $window->unmap;
47
48 #####################################################################
49 # check that a tiling window which is then made floating still has
50 # at least the size of its initial geometry
51 #####################################################################
52
53 $window = open_window(rect => [ 1, 1, 80, 90 ]);
54
55 isa_ok($window, 'X11::XCB::Window');
56
57 cmd 'floating enable';
58 sync_with_i3;
59
60 ($absolute, $top) = $window->rect;
61
62 cmp_ok($absolute->{width}, '==', 80, "i3 let the width at 80");
63 cmp_ok($absolute->{height}, '==', 90, "i3 let the height at 90");
64
65 $window->unmap;
66
67 done_testing;