]> git.sur5r.net Git - i3/i3/blob - testcases/t/228-border-widths.t
tests: replace http:// with https:// where appropriate
[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 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://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($tiled[0]->{current_border_width}, 5, 'tiled current border width set to 5');
51 is($tilewindow->rect->width, $tiled[0]->{rect}->{width} - 2*5, 'tiled border width 5');
52
53 my @floating = @{$wscontent->{floating_nodes}};
54 ok(@floating == 1, 'one floating container opened');
55 is($floating[0]->{nodes}[0]->{current_border_width}, 10, 'floating current border width set to 10');
56 is($floatwindow->rect->width, $floating[0]->{rect}->{width} - 2*10, 'floating border width 10');
57
58 exit_gracefully($pid);
59
60 #####################################################################
61 # 2: make sure the order can also be reverse
62 #####################################################################
63
64 $config = <<EOT;
65 # i3 config file (v4)
66 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
67
68 new_float pixel 7
69 new_window pixel 3
70 EOT
71
72 $pid = launch_with_config($config);
73
74 $tmp = fresh_workspace;
75
76 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
77
78 $tilewindow = open_window;
79 $floatwindow = open_floating_window;
80
81 $wscontent = get_ws($tmp);
82
83 @tiled = @{$wscontent->{nodes}};
84 ok(@tiled == 1, 'one tiled container opened');
85 is($tiled[0]->{current_border_width}, 3, 'tiled current border width set to 3');
86 is($tilewindow->rect->width, $tiled[0]->{rect}->{width} - 2*3, 'tiled border width 3');
87
88 @floating = @{$wscontent->{floating_nodes}};
89 ok(@floating == 1, 'one floating container opened');
90 is($floating[0]->{nodes}[0]->{current_border_width}, 7, 'floating current border width set to 7');
91 is($floatwindow->rect->width, $floating[0]->{rect}->{width} - 2*7, 'floating border width 7');
92
93 exit_gracefully($pid);
94
95 #####################################################################
96 # 3: make sure normal border widths work as well
97 #####################################################################
98
99 $config = <<EOT;
100 # i3 config file (v4)
101 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
102
103 new_float normal 6
104 new_window normal 4
105 EOT
106
107 $pid = launch_with_config($config);
108
109 $tmp = fresh_workspace;
110
111 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
112
113 $tilewindow = open_window;
114 $floatwindow = open_floating_window;
115
116 $wscontent = get_ws($tmp);
117
118 @tiled = @{$wscontent->{nodes}};
119 ok(@tiled == 1, 'one tiled container opened');
120 is($tiled[0]->{current_border_width}, 4, 'tiled current border width set to 4');
121 is($tilewindow->rect->width, $tiled[0]->{rect}->{width} - 2*4, 'tiled border width 4');
122
123 @floating = @{$wscontent->{floating_nodes}};
124 ok(@floating == 1, 'one floating container opened');
125 is($floating[0]->{nodes}[0]->{current_border_width}, 6, 'floating current border width set to 6');
126 is($floatwindow->rect->width, $floating[0]->{rect}->{width} - 2*6, 'floating border width 6');
127
128 exit_gracefully($pid);
129
130 done_testing;