]> git.sur5r.net Git - i3/i3/blob - testcases/t/268-ipc-config.t
Merge branch 'release-4.16.1'
[i3/i3] / testcases / t / 268-ipc-config.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 # Verifies that the config file is returned raw via the IPC interface.
18 # Ticket: #2856
19 # Bug still in: 4.13-133-ge4da07e7
20 use i3test i3_autostart => 0;
21 use File::Temp qw(tempdir);
22
23 my $tmpdir = tempdir(CLEANUP => 1);
24 my $socketpath = $tmpdir . "/config.sock";
25 ok(! -e $socketpath, "$socketpath does not exist yet");
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
31 nop foo \
32 continued
33
34 set $var normal title
35 for_window [title="$vartest"] border none
36 EOT
37
38 $config .= "ipc-socket $socketpath";
39
40 my $pid = launch_with_config($config, dont_add_socket_path => 1, dont_create_temp_dir => 1);
41 get_socket_path(0);
42 my $i3 = i3(get_socket_path());
43 $i3->connect->recv;
44
45 my $cv = AnyEvent->condvar;
46 my $timer = AnyEvent->timer(after => 0.5, interval => 0, cb => sub { $cv->send(0); });
47
48 my $last_config = $i3->get_config()->recv;
49 chomp($last_config->{config});
50 is($last_config->{config}, $config,
51    'received config is not equal to written config');
52
53 exit_gracefully($pid);
54
55 done_testing;