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)
19 my $i3 = i3(get_socket_path());
21 ################################
22 # Workspaces requests and events
23 ################################
25 my $focused = get_ws(focused_ws());
29 # We are switching to an empty workpspace from an empty workspace, so we expect
30 # to receive "init", "focus", and "empty".
31 my $init = AnyEvent->condvar;
32 my $focus = AnyEvent->condvar;
33 my $empty = AnyEvent->condvar;
37 if ($event->{change} eq 'init') {
39 } elsif ($event->{change} eq 'focus') {
40 # Check that we have the old and new workspace
42 $event->{current}->{name} == '2' &&
43 $event->{old}->{name} == $focused->{name}
45 } elsif ($event->{change} eq 'empty') {
63 ok($init->recv, 'Workspace "init" event received');
64 ok($focus->recv, 'Workspace "focus" event received');
65 ok($empty->recv, 'Workspace "empty" event received');