]> git.sur5r.net Git - i3/i3/blob - testcases/t/189-floating-constraints.t
Merge branch 'fix-fullscreen-scratch'
[i3/i3] / testcases / t / 189-floating-constraints.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Tests the floating_{minimum,maximum}_size config options.
5 #
6 # Note that the minimum floating window size is already verified in
7 # t/005-floating.t.
8 #
9
10 use i3test i3_autostart => 0;
11
12 ################################################################################
13 # 1: check floating_minimum_size (with non-default limits)
14 ################################################################################
15
16 my $config = <<EOT;
17 # i3 config file (v4)
18 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
19
20 # Test with different dimensions than the i3 default.
21 floating_minimum_size 60 x 40
22 EOT
23
24 my $pid = launch_with_config($config);
25
26 my $window = open_floating_window(rect => [ 0, 0, 20, 20 ]);
27 my $rect = $window->rect;
28
29 is($rect->{width}, 60, 'width = 60');
30 is($rect->{height}, 40, 'height = 40');
31
32 exit_gracefully($pid);
33
34 ################################################################################
35 # 2: check floating_minimum_size with -1 (unlimited)
36 ################################################################################
37
38 $config = <<EOT;
39 # i3 config file (v4)
40 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
41
42 floating_minimum_size -1 x -1
43 EOT
44
45 $pid = launch_with_config($config);
46
47 cmd 'nop MEH';
48 $window = open_floating_window(rect => [ 0, 0, 50, 40 ]);
49 $rect = $window->rect;
50
51 is($rect->{width}, 50, 'width = 50');
52 is($rect->{height}, 40, 'height = 40');
53
54 exit_gracefully($pid);
55
56 ################################################################################
57 # 3: check floating_maximum_size
58 ################################################################################
59
60 $config = <<EOT;
61 # i3 config file (v4)
62 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
63
64 # Test with different dimensions than the i3 default.
65 floating_maximum_size 100 x 100
66 EOT
67
68 $pid = launch_with_config($config);
69
70 $window = open_floating_window(rect => [ 0, 0, 150, 150 ]);
71 $rect = $window->rect;
72
73 is($rect->{width}, 100, 'width = 100');
74 is($rect->{height}, 100, 'height = 100');
75
76 exit_gracefully($pid);
77
78 # Test that the feature works at all (without explicit configuration) by
79 # opening a window which is bigger than the testsuite screen (1280x1024).
80
81 $config = <<EOT;
82 # i3 config file (v4)
83 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
84 EOT
85
86 $pid = launch_with_config($config);
87
88 $window = open_floating_window(rect => [ 0, 0, 2048, 2048 ]);
89 $rect = $window->rect;
90
91 cmp_ok($rect->{width}, '<', 2048, 'width < 2048');
92 cmp_ok($rect->{height}, '<', 2048, 'height < 2048');
93
94 exit_gracefully($pid);
95
96 ################################################################################
97 # 4: check floating_maximum_size
98 ################################################################################
99
100 $config = <<EOT;
101 # i3 config file (v4)
102 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
103
104 # Test with different dimensions than the i3 default.
105 floating_maximum_size -1 x -1
106 EOT
107
108 $pid = launch_with_config($config);
109
110 $window = open_floating_window(rect => [ 0, 0, 2048, 2048 ]);
111 $rect = $window->rect;
112
113 is($rect->{width}, 2048, 'width = 2048');
114 is($rect->{height}, 2048, 'height = 2048');
115
116 exit_gracefully($pid);
117
118 done_testing;