gri3-wm/testcases/t/307-focus-next-prev.t

73 lines
1.9 KiB
Perl

#!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)
#
# • http://onyxneon.com/books/modern_perl/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';
});
done_testing;