]> git.sur5r.net Git - i3/i3/blob - testcases/t/228-border-widths.t
Merge branch 'fix-ws-con'
[i3/i3] / testcases / t / 228-border-widths.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 # Tests that the border widths can be set separately for floating and
18 # tiled windows
19 # Ticket: #1244
20 # Bug still in: 4.7.2-166-gb69b3fc
21
22 use i3test i3_autostart => 0;
23
24 #####################################################################
25 # 1: check that the border widths can be different for floating and
26 # tiled windows
27 #####################################################################
28
29 my $config = <<EOT;
30 # i3 config file (v4)
31 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
32
33 new_window pixel 5
34 new_float pixel 10
35 EOT
36
37 my $pid = launch_with_config($config);
38
39 my $tmp = fresh_workspace;
40
41 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
42
43 my $tilewindow = open_window;
44 my $floatwindow = open_floating_window;
45
46 my $wscontent = get_ws($tmp);
47
48 my @tiled = @{$wscontent->{nodes}};
49 ok(@tiled == 1, 'one tiled container opened');
50 is($tilewindow->rect->width, $tiled[0]->{rect}->{width} - 2*5, 'tiled border width 5');
51
52 my @floating = @{$wscontent->{floating_nodes}};
53 ok(@floating == 1, 'one floating container opened');
54 is($floatwindow->rect->width, $floating[0]->{rect}->{width} - 2*10, 'floating border width 10');
55
56 exit_gracefully($pid);
57
58 #####################################################################
59 # 2: make sure the order can also be reverse
60 #####################################################################
61
62 $config = <<EOT;
63 # i3 config file (v4)
64 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
65
66 new_float pixel 7
67 new_window pixel 3
68 EOT
69
70 $pid = launch_with_config($config);
71
72 $tmp = fresh_workspace;
73
74 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
75
76 $tilewindow = open_window;
77 $floatwindow = open_floating_window;
78
79 $wscontent = get_ws($tmp);
80
81 @tiled = @{$wscontent->{nodes}};
82 ok(@tiled == 1, 'one tiled container opened');
83 is($tilewindow->rect->width, $tiled[0]->{rect}->{width} - 2*3, 'tiled border width 3');
84
85 @floating = @{$wscontent->{floating_nodes}};
86 ok(@floating == 1, 'one floating container opened');
87 is($floatwindow->rect->width, $floating[0]->{rect}->{width} - 2*7, 'floating border width 7');
88
89 exit_gracefully($pid);
90
91 done_testing;