2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • https://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 $old_ws = get_ws(focused_ws());
21 # We are switching to an empty workpspace from an empty workspace, so we expect
22 # to receive "init", "focus", and "empty".
23 my @events = events_for(
24 sub { cmd 'workspace 2' },
27 my $current_ws = get_ws(focused_ws());
29 is(scalar @events, 3, 'Received 3 events');
30 is($events[0]->{change}, 'init', 'First event has change = init');
31 is($events[0]->{current}->{id}, $current_ws->{id}, 'the "current" property contains the initted workspace con');
33 is($events[1]->{change}, 'focus', 'Second event has change = focus');
34 is($events[1]->{current}->{id}, $current_ws->{id}, 'the "current" property should contain the focused workspace con');
35 is($events[1]->{old}->{id}, $old_ws->{id}, 'the "old" property should contain the workspace con that was focused last');
37 is($events[2]->{change}, 'empty', 'Third event has change = empty');
38 is($events[2]->{current}->{id}, $old_ws->{id}, 'the "current" property should contain the emptied workspace con');