]> git.sur5r.net Git - i3/i3/blob - testcases/t/181-regress-float-border.t
Merge branch 'release-4.16.1'
[i3/i3] / testcases / t / 181-regress-float-border.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://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 # Regression test: Changing border style should not have an impact on the size
18 # (geometry) of the child window. See ticket https://bugs.i3wm.org/561
19 # Wrong behaviour manifested itself up to (including) commit
20 # d805d1bbeaf89e11f67c981f94c9f55bbb4b89d9
21 #
22 use i3test;
23
24 my $tmp = fresh_workspace;
25
26 my $win = open_floating_window(rect => [10, 10, 200, 100]);
27
28 my $geometry = $win->rect;
29 is($geometry->{width}, 200, 'width correct');
30 is($geometry->{height}, 100, 'height correct');
31
32 cmd 'border 1pixel';
33
34 $geometry = $win->rect;
35 is($geometry->{width}, 200, 'width correct');
36 is($geometry->{height}, 100, 'height correct');
37
38 ################################################################################
39 # When in fullscreen mode, the original position must not be overwritten.
40 ################################################################################
41
42 sub get_floating_con_rect {
43     my ($nodes, $focus) = get_ws($tmp);
44     my $floating_con = $nodes->{floating_nodes}->[0];
45     return $floating_con->{rect};
46 }
47 my $old_rect = get_floating_con_rect();
48
49 cmd 'fullscreen';
50
51 is_deeply(get_floating_con_rect(), $old_rect, 'Rect the same after going into fullscreen');
52
53 cmd 'border pixel 2';
54
55 is_deeply(get_floating_con_rect(), $old_rect, 'Rect the same after changing border style');
56
57 done_testing;