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());
22 ################################
23 # Workspaces requests and events
24 ################################
26 my $focused = get_ws(focused_ws());
30 # We are switching to an empty workpspace from an empty workspace, so we expect
31 # to receive "init", "focus", and "empty".
32 my $init = AnyEvent->condvar;
33 my $focus = AnyEvent->condvar;
34 my $empty = AnyEvent->condvar;
38 if ($event->{change} eq 'init') {
40 } elsif ($event->{change} eq 'focus') {
41 # Check that we have the old and new workspace
43 $event->{current}->{name} == '2' &&
44 $event->{old}->{name} == $focused->{name}
46 } elsif ($event->{change} eq 'empty') {
64 ok($init->recv, 'Workspace "init" event received');
65 ok($focus->recv, 'Workspace "focus" event received');
66 ok($empty->recv, 'Workspace "empty" event received');