]> git.sur5r.net Git - i3/i3/blob - testcases/t/205-ipc-windows.t
aa679e20fdf13d7bfdff6cabd4f5b8770b1a4162
[i3/i3] / testcases / t / 205-ipc-windows.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 use i3test;
18
19 SKIP: {
20
21     skip "AnyEvent::I3 too old (need >= 0.15)", 1 if $AnyEvent::I3::VERSION < 0.15;
22
23 my $i3 = i3(get_socket_path());
24 $i3->connect()->recv;
25
26 ################################
27 # Window event
28 ################################
29
30 # Events
31
32 my $new = AnyEvent->condvar;
33 $i3->subscribe({
34     window => sub {
35         my ($event) = @_;
36         $new->send($event->{change} eq 'new');
37     }
38 })->recv;
39
40 open_window;
41
42 my $t;
43 $t = AnyEvent->timer(after => 0.5, cb => sub { $new->send(0); });
44
45 ok($new->recv, 'Window "new" event received');
46
47 }
48
49 done_testing;