Side status line regress tests.

This commit is contained in:
Nicholas Marriott
2026-10-16 09:02:03 +01:00
parent 4ae6a7ec55
commit 647e15b038
24 changed files with 1779 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Status menus are displayed in the visible window and their commands
# target the clicked window, including when it is not current.
# Status menus are displayed in the visible window, target the clicked
# window, and are placed beside the clicked row on either side status line.
PATH=/bin:/usr/bin
TERM=screen
@@ -29,6 +29,7 @@ fail()
}
# Right-button press at column $1, row $2 (1-based), targeting window $3.
# If supplied, $4 is the expected row and column of the first menu item's text.
check_menu()
{
seq=$(printf '\033[<2;%s;%sM' "$1" "$2")
@@ -42,6 +43,14 @@ check_menu()
done
grep -q 'Swap Left' "$CAPTURE" || fail "window $3 menu not visible"
grep -q "─$3:" "$CAPTURE" || fail "window $3 title missing"
if [ -n "$4" ]; then
got=$(awk '{
gsub(/│/, "|")
if (index($0, "Swap Left"))
print NR, index($0, "Swap Left")
}' "$CAPTURE")
[ "$got" = "$4" ] || fail "menu at '$got', expected '$4'"
fi
# Mark acts on the clicked window without selecting it. Other windows
# exercise dragging into the menu and releasing the right button.
@@ -81,15 +90,49 @@ $TMUX new-window -d -n one 'sleep 100' || exit 1
$TMUX new-window -d -n two 'sleep 100' || exit 1
$TMUX set -g mouse on || exit 1
$TMUX set -g automatic-rename off || exit 1
$TMUX set -g status 2 || exit 1
$TMUX set -g 'status-format[0]' \
'#[range=window|0]0:zero#[norange] #[range=window|1]1:one#[norange]' || \
exit 1
$TMUX set -g side-status-width 14 || exit 1
$TMUX2 new-session -d -s outer -x 80 -y 24 'sleep 100' || exit 1
$TMUX2 set -g status off || exit 1
$TMUX2 respawn-pane -k -t outer:0.0 "$TMUX attach -t inner" || exit 1
sleep 1
for side in left right; do
$TMUX set -g side-status "$side" || exit 1
if [ "$side" = left ]; then
column=3
text_column=17
else
column=69
text_column=51
fi
for status in off bottom top; do
offset=0
if [ "$status" = off ]; then
$TMUX set -g status off || exit 1
else
$TMUX set -g status 2 || exit 1
$TMUX set -g status-position "$status" || exit 1
[ "$status" = top ] && offset=2
fi
sleep 0.5
for window in 0 1; do
row=$((window + offset + 1))
check_menu "$column" "$row" "$window" \
"$((row + 1)) $text_column"
done
done
done
# A noncurrent window's dimensions must not constrain the visible menu.
$TMUX resize-window -t inner:1 -x 10 -y 5 || exit 1
check_menu 69 4 1 '5 51'
# The same target/display distinction applies to the horizontal status line.
$TMUX set -g side-status off || exit 1
$TMUX set -g status 2 || exit 1
$TMUX set -g 'status-format[0]' \
'#[range=window|0]0:zero#[norange] #[range=window|1]1:one#[norange]' || \
exit 1
for position in top bottom; do
$TMUX set -g status-position "$position" || exit 1
if [ "$position" = top ]; then
@@ -98,12 +141,8 @@ for position in top bottom; do
row=23
fi
sleep 0.5
check_menu 2 "$row" 0
check_menu 9 "$row" 1
check_menu 2 "$row" 0 ''
check_menu 9 "$row" 1 ''
done
# A noncurrent window's dimensions must not constrain the visible menu.
$TMUX resize-window -t inner:1 -x 10 -y 5 || exit 1
check_menu 9 23 1
exit 0