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)
17 # Check if numbered workspaces and named workspaces are sorted in the right way
18 # in get_workspaces IPC output (necessary for i3bar etc.).
21 my $i3 = i3(get_socket_path());
26 my @ws = @{$i3->get_workspaces->recv};
27 my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
28 my @sorted = sort @nums;
30 is_deeply(\@nums, \@sorted, $msg);
33 check_order('workspace order alright before testing');
35 #############################################################################
36 # open a window to keep this ws open
37 #############################################################################
43 my @ws = @{$i3->get_workspaces->recv};
44 my @f = grep { defined($_->{num}) && $_->{num} == 93 } @ws;
45 is(@f, 1, 'ws 93 found by num');
46 check_order('workspace order alright after opening 93');
50 check_order('workspace order alright after opening 92');
54 check_order('workspace order alright after opening 94');
58 check_order('workspace order alright after opening 96');
62 check_order('workspace order alright after opening foo');
66 check_order('workspace order alright after opening 91');