]> git.sur5r.net Git - i3/i3/blob - testcases/t/194-regress-floating-size.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 194-regress-floating-size.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 # Verifies that the size requested by floating windows is set by i3, no matter
18 # to which value the new_window option is set.
19 # ticket #770, bug still present in commit ae88accf6fe3817ff42d0d51be1965071194766e
20 use i3test i3_autostart => 0;
21
22 sub test_with_new_window_value {
23     my ($value) = @_;
24
25     my $config = <<EOT;
26 # i3 config file (v4)
27 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
28 EOT
29
30     if (defined($value)) {
31         $config .= "new_window $value\n";
32         diag("testing with new_window $value");
33     } else {
34         diag("testing without new_window");
35     }
36
37     my $pid = launch_with_config($config);
38
39     my $tmp = fresh_workspace;
40
41     my $window = open_floating_window({ rect => [ 0, 0, 400, 150 ] });
42
43     my ($absolute, $top) = $window->rect;
44
45     ok($window->mapped, 'Window is mapped');
46     cmp_ok($absolute->{width}, '==', 400, 'requested width kept');
47     cmp_ok($absolute->{height}, '==', 150, 'requested height kept');
48
49     exit_gracefully($pid);
50 }
51
52 test_with_new_window_value(undef);
53 test_with_new_window_value('1pixel');
54 test_with_new_window_value('normal');
55 test_with_new_window_value('none');
56
57 done_testing;