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)
21 skip "AnyEvent::I3 too old (need >= 0.15)", 1 if $AnyEvent::I3::VERSION < 0.15;
23 my $i3 = i3(get_socket_path());
26 ################################
28 ################################
32 my $win0 = open_window;
33 my $win1 = open_window;
34 my $win2 = open_window;
36 my $focus = AnyEvent->condvar;
53 # ensure the rightmost window contains input focus
54 $i3->command('[id="' . $win2->id . '"] focus')->recv;
55 is($x->input_focus, $win2->id, "Window 2 focused");
58 my $event = $focus->recv;
59 is($event->{change}, 'focus', 'Focus event received');
60 is($focus->recv->{container}->{name}, 'Window 1', 'Window 1 focused');
62 $focus = AnyEvent->condvar;
64 $event = $focus->recv;
65 is($event->{change}, 'focus', 'Focus event received');
66 is($event->{container}->{name}, 'Window 0', 'Window 0 focused');
68 $focus = AnyEvent->condvar;
70 $event = $focus->recv;
71 is($event->{change}, 'focus', 'Focus event received');
72 is($event->{container}->{name}, 'Window 1', 'Window 1 focused');
74 $focus = AnyEvent->condvar;
76 $event = $focus->recv;
77 is($event->{change}, 'focus', 'Focus event received');
78 is($event->{container}->{name}, 'Window 2', 'Window 2 focused');
80 $focus = AnyEvent->condvar;
82 $event = $focus->recv;
83 is($event->{change}, 'focus', 'Focus event received');
84 is($event->{container}->{name}, 'Window 0', 'Window 0 focused');
86 $focus = AnyEvent->condvar;
88 $event = $focus->recv;
89 is($event->{change}, 'focus', 'Focus event received');
90 is($event->{container}->{name}, 'Window 2', 'Window 2 focused');