]> git.sur5r.net Git - i3/i3/blob - testcases/t/174-border-config.t
testcases: let i3test.pm export $x, adapt testcases
[i3/i3] / testcases / t / 174-border-config.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 # !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3
4 #
5 # Tests the new_window and new_float config option.
6 #
7
8 use i3test;
9
10 #####################################################################
11 # 1: check that new windows start with 'normal' border unless configured
12 # otherwise
13 #####################################################################
14
15 my $config = <<EOT;
16 # i3 config file (v4)
17 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
18 EOT
19
20 my $pid = launch_with_config($config);
21
22 my $tmp = fresh_workspace;
23
24 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
25
26 my $first = open_window($x);
27
28 my @content = @{get_ws_content($tmp)};
29 ok(@content == 1, 'one container opened');
30 is($content[0]->{border}, 'normal', 'border normal by default');
31
32 exit_gracefully($pid);
33
34 #####################################################################
35 # 2: check that new tiling windows start with '1pixel' border when
36 # configured
37 #####################################################################
38
39 $config = <<EOT;
40 # i3 config file (v4)
41 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
42
43 new_window 1pixel
44 EOT
45
46 $pid = launch_with_config($config);
47
48 $tmp = fresh_workspace;
49
50 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
51
52 $first = open_window($x);
53
54 @content = @{get_ws_content($tmp)};
55 ok(@content == 1, 'one container opened');
56 is($content[0]->{border}, '1pixel', 'border normal by default');
57
58 exit_gracefully($pid);
59
60 #####################################################################
61 # 3: check that new floating windows start with 'normal' border unless
62 # configured otherwise
63 #####################################################################
64
65 $config = <<EOT;
66 # i3 config file (v4)
67 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
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 $first = open_floating_window($x);
77
78 my $wscontent = get_ws($tmp);
79 my @floating = @{$wscontent->{floating_nodes}};
80 ok(@floating == 1, 'one floating container opened');
81 my $floatingcon = $floating[0];
82 is($floatingcon->{nodes}->[0]->{border}, 'normal', 'border normal by default');
83
84 exit_gracefully($pid);
85
86 #####################################################################
87 # 4: check that new floating windows start with '1pixel' border when
88 # configured
89 #####################################################################
90
91 $config = <<EOT;
92 # i3 config file (v4)
93 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
94
95 new_float 1pixel
96 EOT
97
98 $pid = launch_with_config($config);
99
100 $tmp = fresh_workspace;
101
102 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
103
104 $first = open_floating_window($x);
105
106 $wscontent = get_ws($tmp);
107 @floating = @{$wscontent->{floating_nodes}};
108 ok(@floating == 1, 'one floating container opened');
109 $floatingcon = $floating[0];
110 is($floatingcon->{nodes}->[0]->{border}, '1pixel', 'border normal by default');
111
112 exit_gracefully($pid);
113
114 done_testing;