2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • https://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Test behavior of "resize <width> <height>" command.
19 # Bug still in: 4.10.2-1-gc0dbc5d
20 use i3test i3_config => <<EOT;
22 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
24 fake-outputs 1333x999+0+0
25 workspace ws output fake-0
28 ################################################################################
29 # Init variables used for all tests.
30 ################################################################################
32 my $tmp = fresh_workspace;
34 my @content = @{get_ws($tmp)->{floating_nodes}};
35 is(@content, 1, 'one floating node on this ws');
36 my $oldrect = $content[0]->{rect};
39 my ($width, $height) = @_;
41 cmp_ok($content[0]->{rect}->{x}, '==', $oldrect->{x}, 'x unchanged');
42 cmp_ok($content[0]->{rect}->{y}, '==', $oldrect->{y}, 'y unchanged');
44 @content = @{get_ws($tmp)->{floating_nodes}};
46 cmp_ok($content[0]->{rect}->{width}, '==', $width, "width changed to $width px");
48 cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'width unchanged');
51 cmp_ok($content[0]->{rect}->{height}, '==', $height, "height changed to $height px");
53 cmp_ok($content[0]->{rect}->{height}, '==', $oldrect->{height}, 'height unchanged');
55 $oldrect = $content[0]->{rect};
58 ################################################################################
59 # Check that setting floating windows size works
60 ################################################################################
62 cmd 'resize set 100 px 250 px';
65 ################################################################################
66 # Same but with ppt instead of px
67 ################################################################################
69 cmd 'resize set 33 ppt 20 ppt';
70 do_test(int(0.33 * 1333), int(0.2 * 999));
72 ################################################################################
73 # Mix ppt and px in a single resize set command
74 ################################################################################
76 cmd 'resize set 44 ppt 111 px';
77 do_test(int(0.44 * 1333), 111);
79 cmd 'resize set 222 px 100 ppt';
82 ################################################################################
83 # Zero is interpreted as no change.
85 ################################################################################
87 cmd 'resize set 0 px 333 px';
90 cmd 'resize set 333 px 0 ppt';
93 cmd 'resize set 0 px 0 ppt';
96 cmd 'resize set 100 ppt 0 px';
99 ################################################################################
100 # Use 'width' and 'height' keywords.
102 ################################################################################
104 cmd 'resize set width 200 px';
107 cmd 'resize set height 200 px';
110 cmd 'resize set width 300 px height 300 px';
113 # ppt + keyword used only for height
114 cmd 'resize set 100 ppt height 100 px';