]> git.sur5r.net Git - i3/i3/blob - testcases/t/188-regress-focus-restart.t
Merge pull request #2953 from CyberShadow/focus_wrapping
[i3/i3] / testcases / t / 188-regress-focus-restart.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 # Verifies that i3 survives inplace restarts with fullscreen containers
18 #
19 use i3test;
20
21 my $tmp = fresh_workspace;
22
23 open_window(name => 'first');
24 open_window(name => 'second');
25
26 cmd 'focus left';
27
28 my ($nodes, $focus) = get_ws_content($tmp);
29 is(scalar @$nodes, 2, 'two tiling nodes on workspace');
30 is($nodes->[0]->{name}, 'first', 'first node name ok');
31 is($nodes->[1]->{name}, 'second', 'second node name ok');
32 is($focus->[0], $nodes->[0]->{id}, 'first node focused');
33 is($focus->[1], $nodes->[1]->{id}, 'second node second in focus stack');
34
35 cmd 'restart';
36
37 does_i3_live;
38
39 ($nodes, $focus) = get_ws_content($tmp);
40 is(scalar @$nodes, 2, 'still two tiling nodes on workspace');
41 is($nodes->[0]->{name}, 'first', 'first node name ok');
42 is($nodes->[1]->{name}, 'second', 'second node name ok');
43 is($focus->[0], $nodes->[0]->{id}, 'first node focused');
44 is($focus->[1], $nodes->[1]->{id}, 'second node second in focus stack');
45
46 done_testing;