]> git.sur5r.net Git - i3/i3/blob - testcases/t/128-open-order.t
Merge branch 'release-4.16.1'
[i3/i3] / testcases / t / 128-open-order.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 # Check if new containers are opened after the currently focused one instead
18 # of always at the end
19 use List::Util qw(first);
20 use i3test;
21
22 my $i3 = i3(get_socket_path());
23
24 my $tmp = fresh_workspace;
25
26 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
27
28 # Open two new container
29 my $first = open_empty_con($i3);
30
31 ok(@{get_ws_content($tmp)} == 1, 'containers opened');
32
33 my $second = open_empty_con($i3);
34
35 isnt($first, $second, 'different container focused');
36
37 ##############################################################
38 # see if new containers open after the currently focused
39 ##############################################################
40
41 cmd qq|[con_id="$first"] focus|;
42 cmd 'open';
43 my $content = get_ws_content($tmp);
44 ok(@{$content} == 3, 'three containers opened');
45
46 is($content->[0]->{id}, $first, 'first container unmodified');
47 isnt($content->[1]->{id}, $second, 'second container replaced');
48 is($content->[2]->{id}, $second, 'third container unmodified');
49
50 done_testing;