]> git.sur5r.net Git - i3/i3/blob - testcases/t/174-border-config.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 174-border-config.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 the new_window and new_float config option.
18 #
19
20 use i3test i3_autostart => 0;
21
22 #####################################################################
23 # 1: check that new windows start with 'normal' border unless configured
24 # otherwise
25 #####################################################################
26
27 my $config = <<EOT;
28 # i3 config file (v4)
29 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
30 EOT
31
32 my $pid = launch_with_config($config);
33
34 my $tmp = fresh_workspace;
35
36 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
37
38 my $first = open_window;
39
40 my @content = @{get_ws_content($tmp)};
41 ok(@content == 1, 'one container opened');
42 is($content[0]->{border}, 'normal', 'border normal by default');
43
44 exit_gracefully($pid);
45
46 #####################################################################
47 # 2: check that new tiling windows start with '1pixel' border when
48 # configured
49 #####################################################################
50
51 $config = <<EOT;
52 # i3 config file (v4)
53 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
54
55 new_window 1pixel
56 EOT
57
58 $pid = launch_with_config($config);
59
60 $tmp = fresh_workspace;
61
62 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
63
64 $first = open_window;
65
66 @content = @{get_ws_content($tmp)};
67 ok(@content == 1, 'one container opened');
68 is($content[0]->{border}, 'pixel', 'border pixel by default');
69 is($content[0]->{current_border_width}, -1, 'border width pixels -1 (default)');
70
71 exit_gracefully($pid);
72
73 #####################################################################
74 # 3: check that new floating windows start with 'normal' border unless
75 # configured otherwise
76 #####################################################################
77
78 $config = <<EOT;
79 # i3 config file (v4)
80 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
81 EOT
82
83 $pid = launch_with_config($config);
84
85 $tmp = fresh_workspace;
86
87 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
88
89 $first = open_floating_window;
90
91 my $wscontent = get_ws($tmp);
92 my @floating = @{$wscontent->{floating_nodes}};
93 ok(@floating == 1, 'one floating container opened');
94 my $floatingcon = $floating[0];
95 is($floatingcon->{nodes}->[0]->{border}, 'normal', 'border normal by default');
96
97 exit_gracefully($pid);
98
99 #####################################################################
100 # 4: check that new floating windows start with '1pixel' border when
101 # configured
102 #####################################################################
103
104 $config = <<EOT;
105 # i3 config file (v4)
106 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
107
108 new_float 1pixel
109 EOT
110
111 $pid = launch_with_config($config);
112
113 $tmp = fresh_workspace;
114
115 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
116
117 $first = open_floating_window;
118
119 $wscontent = get_ws($tmp);
120 @floating = @{$wscontent->{floating_nodes}};
121 ok(@floating == 1, 'one floating container opened');
122 $floatingcon = $floating[0];
123 is($floatingcon->{nodes}->[0]->{border}, 'pixel', 'border pixel by default');
124
125 exit_gracefully($pid);
126
127 done_testing;