2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Checks that variables are parsed correctly by using for_window rules with
21 use i3test i3_autostart => 0;
23 # starts i3 with the given config, opens a window, returns its border style
24 sub launch_get_border {
27 my $pid = launch_with_config($config);
29 my $i3 = i3(get_socket_path(0));
30 my $tmp = fresh_workspace;
32 my $window = open_window(name => 'special title');
34 my @content = @{get_ws_content($tmp)};
35 cmp_ok(@content, '==', 1, 'one node on this workspace now');
36 my $border = $content[0]->{border};
38 exit_gracefully($pid);
43 #####################################################################
44 # test thet windows get the default border
45 #####################################################################
49 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
52 is(launch_get_border($config), 'normal', 'normal border');
54 #####################################################################
55 # now use a variable and for_window
56 #####################################################################
60 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
62 set $vartest special title
63 for_window [title="$vartest"] border none
66 is(launch_get_border($config), 'none', 'no border');
68 #####################################################################
69 # check that whitespaces and tabs are ignored
70 #####################################################################
74 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
76 set $vartest special title
77 for_window [title="$vartest"] border none
80 is(launch_get_border($config), 'none', 'no border');
82 #####################################################################
83 # test that longest matching variable name is substituted
84 #####################################################################
88 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
91 set $vartest special title
92 set $vart mundane title
93 for_window [title="$vartest"] border none
96 is(launch_get_border($config), 'none', 'no border');