2 # vim:ts=4:sw=4:expandtab
4 # Tests the floating_{minimum,maximum}_size config options.
6 # Note that the minimum floating window size is already verified in
10 use i3test i3_autostart => 0;
12 ################################################################################
13 # 1: check floating_minimum_size (with non-default limits)
14 ################################################################################
18 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
20 # Test with different dimensions than the i3 default.
21 floating_minimum_size 60 x 40
24 my $pid = launch_with_config($config);
26 my $window = open_floating_window(rect => [ 0, 0, 20, 20 ]);
27 my $rect = $window->rect;
29 is($rect->{width}, 60, 'width = 60');
30 is($rect->{height}, 40, 'height = 40');
32 exit_gracefully($pid);
34 ################################################################################
35 # 2: check floating_minimum_size with -1 (unlimited)
36 ################################################################################
40 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
42 floating_minimum_size -1 x -1
45 $pid = launch_with_config($config);
48 $window = open_floating_window(rect => [ 0, 0, 50, 40 ]);
49 $rect = $window->rect;
51 is($rect->{width}, 50, 'width = 50');
52 is($rect->{height}, 40, 'height = 40');
54 exit_gracefully($pid);
56 ################################################################################
57 # 3: check floating_maximum_size
58 ################################################################################
62 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
64 # Test with different dimensions than the i3 default.
65 floating_maximum_size 100 x 100
68 $pid = launch_with_config($config);
70 $window = open_floating_window(rect => [ 0, 0, 150, 150 ]);
71 $rect = $window->rect;
73 is($rect->{width}, 100, 'width = 100');
74 is($rect->{height}, 100, 'height = 100');
76 exit_gracefully($pid);
78 # Test that the feature works at all (without explicit configuration) by
79 # opening a window which is bigger than the testsuite screen (1280x1024).
83 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
86 $pid = launch_with_config($config);
88 $window = open_floating_window(rect => [ 0, 0, 2048, 2048 ]);
89 $rect = $window->rect;
91 cmp_ok($rect->{width}, '<', 2048, 'width < 2048');
92 cmp_ok($rect->{height}, '<', 2048, 'height < 2048');
94 exit_gracefully($pid);
96 ################################################################################
97 # 4: check floating_maximum_size
98 ################################################################################
101 # i3 config file (v4)
102 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
104 # Test with different dimensions than the i3 default.
105 floating_maximum_size -1 x -1
108 $pid = launch_with_config($config);
110 $window = open_floating_window(rect => [ 0, 0, 2048, 2048 ]);
111 $rect = $window->rect;
113 is($rect->{width}, 2048, 'width = 2048');
114 is($rect->{height}, 2048, 'height = 2048');
116 exit_gracefully($pid);