2 # vim:ts=4:sw=4:expandtab
3 # Check if numbered workspaces and named workspaces are sorted in the right way
4 # in get_workspaces IPC output (necessary for i3bar etc.).
9 use_ok('X11::XCB::Window');
12 my $i3 = i3(get_socket_path());
13 my $x = X11::XCB::Connection->new;
18 my @ws = @{$i3->get_workspaces->recv};
19 my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
20 my @sorted = sort @nums;
22 cmp_deeply(\@nums, \@sorted, $msg);
25 check_order('workspace order alright before testing');
27 #############################################################################
28 # open a window to keep this ws open
29 #############################################################################
33 open_standard_window($x);
35 my @ws = @{$i3->get_workspaces->recv};
36 my @f = grep { defined($_->{num}) && $_->{num} == 93 } @ws;
37 is(@f, 1, 'ws 93 found by num');
38 check_order('workspace order alright after opening 93');
41 open_standard_window($x);
42 check_order('workspace order alright after opening 92');
45 open_standard_window($x);
46 check_order('workspace order alright after opening 94');
49 open_standard_window($x);
50 check_order('workspace order alright after opening 96');
53 open_standard_window($x);
54 check_order('workspace order alright after opening foo');
57 open_standard_window($x);
58 check_order('workspace order alright after opening 91');