]> 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}, '1pixel', 'border normal by default');
69
70 exit_gracefully($pid);
71
72 #####################################################################
73 # 3: check that new floating windows start with 'normal' border unless
74 # configured otherwise
75 #####################################################################
76
77 $config = <<EOT;
78 # i3 config file (v4)
79 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
80 EOT
81
82 $pid = launch_with_config($config);
83
84 $tmp = fresh_workspace;
85
86 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
87
88 $first = open_floating_window;
89
90 my $wscontent = get_ws($tmp);
91 my @floating = @{$wscontent->{floating_nodes}};
92 ok(@floating == 1, 'one floating container opened');
93 my $floatingcon = $floating[0];
94 is($floatingcon->{nodes}->[0]->{border}, 'normal', 'border normal by default');
95
96 exit_gracefully($pid);
97
98 #####################################################################
99 # 4: check that new floating windows start with '1pixel' border when
100 # configured
101 #####################################################################
102
103 $config = <<EOT;
104 # i3 config file (v4)
105 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
106
107 new_float 1pixel
108 EOT
109
110 $pid = launch_with_config($config);
111
112 $tmp = fresh_workspace;
113
114 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
115
116 $first = open_floating_window;
117
118 $wscontent = get_ws($tmp);
119 @floating = @{$wscontent->{floating_nodes}};
120 ok(@floating == 1, 'one floating container opened');
121 $floatingcon = $floating[0];
122 is($floatingcon->{nodes}->[0]->{border}, '1pixel', 'border normal by default');
123
124 exit_gracefully($pid);
125
126 done_testing;