1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#!perl
# vim:ts=4:sw=4:expandtab
#
# Please read the following documents before working on tests:
# • https://build.i3wm.org/docs/testsuite.html
# (or docs/testsuite)
#
# • https://build.i3wm.org/docs/lib-i3test.html
# (alternatively: perldoc ./testcases/lib/i3test.pm)
#
# • https://build.i3wm.org/docs/ipc.html
# (or docs/ipc)
#
# • https://i3wm.org/downloads/modern_perl_a4.pdf
# (unless you are already familiar with Perl)
#
# Test focus next|prev
# Ticket: #2587
use i3test;
cmp_tree(
msg => "cmd 'prev' selects leaf 1/2",
layout_before => 'S[a b] V[c d* T[e f g]]',
layout_after => 'S[a b] V[c* d T[e f g]]',
cb => sub {
cmd 'focus prev';
});
cmp_tree(
msg => "cmd 'prev' selects leaf 2/2",
layout_before => 'S[a b] V[c* d T[e f g]]',
layout_after => 'S[a b*] V[c d T[e f g]]',
cb => sub {
# c* -> V -> b*
cmd 'focus parent, focus prev';
});
cmp_tree(
msg => "cmd 'prev sibling' selects leaf again",
layout_before => 'S[a b] V[c d* T[e f g]]',
layout_after => 'S[a b] V[c* d T[e f g]]',
cb => sub {
cmd 'focus prev sibling';
});
cmp_tree(
msg => "cmd 'next' selects leaf",
# Notice that g is the last to open before focus moves to d*
layout_before => 'S[a b] V[c d* T[e f g]]',
layout_after => 'S[a b] V[c d T[e f g*]]',
cb => sub {
cmd 'focus next';
});
cmp_tree(
msg => "cmd 'next sibling' selects parent 1/2",
layout_before => 'S[a b] V[c d* T[e f g]]',
layout_after => 'S[a b] V[c d T*[e f g]]',
cb => sub {
cmd 'focus next sibling';
});
cmp_tree(
msg => "cmd 'next sibling' selects parent 2/2",
layout_before => 'S[a b*] V[c d T[e f g]]',
layout_after => 'S[a b] V*[c d T[e f g]]',
cb => sub {
# b* -> S* -> V*
cmd 'focus parent, focus next sibling';
});
# See #3997
cmd 'workspace 2';
open_window;
cmd 'workspace 1';
open_window;
cmd 'focus parent, focus parent, focus next sibling, focus prev sibling';
does_i3_live;
is(focused_ws, '1', 'Back and forth between workspaces');
cmd 'focus parent, focus parent, focus next sibling';
is(focused_ws, '2', "Workspace 2 focused with 'focus next sibling'");
done_testing;
|