mirror of
https://github.com/tmux/tmux.git
synced 2026-10-09 11:44:23 +00:00
- Extract shared setup for the "noflash" retransmission-avoidance tests
(image-movepane-drag-noflash.sh, image-splitwindow-resize-noflash.sh,
image-status-pane-click-noflash.sh, image-selection-noflash.sh) into
a new image-noflash-common.inc, matching the existing input-common.inc
convention: dual-server cleanup/fail helpers, the shared SIXEL fixture,
the attach-and-capture sequence, and the final DCS-retransmission
assertion. Each test keeps its own distinct interaction and failure
message; only the copy-pasted scaffolding moved.
- Add the missing #{image_support} runtime guard to
image-border-status-sixel.sh, which cats a real SIXEL fixture and
specifically guards a sixel-after-pane-creation ordering bug - without
it, the DCS sequence is compiled out entirely on a non-image build and
the test's assertions could pass without exercising anything.
image-border-status-wipe.sh is deliberately left unguarded: it has no
image/sixel content at all and guards a general border-status caching
bug unrelated to ENABLE_IMAGES.
- Reviewed the rest of the branch's regress/image-*.sh tests in full
(not just headers) for redundant coverage; none warranted merging -
each guards a genuinely distinct fix via a distinct mechanism.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
70 lines
2.1 KiB
PHP
70 lines
2.1 KiB
PHP
# Shared setup for the image-*-noflash.sh tests: each drives some mouse or
|
|
# keyboard interaction that must not retransmit an unrelated pane's image,
|
|
# checked by counting DCS (\033P) sequences in the client's raw output.
|
|
|
|
PATH=/bin:/usr/bin
|
|
TERM=screen
|
|
LC_ALL=C.UTF-8
|
|
export TERM LC_ALL
|
|
|
|
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
|
|
TMUX="$TEST_TMUX -LtestA$$ -f/dev/null"
|
|
TMUX2="$TEST_TMUX -LtestB$$ -f/dev/null"
|
|
|
|
# A small, distinctive 26x26-pixel SIXEL raster, used across these tests as a
|
|
# stand-in image whose retransmission (or lack of it) is being checked for.
|
|
SIXEL_HEADER='\033Pq"1;1;26;26#0;2;100;100;100#0!26~-!26~-!26~-!26~-!26B\033\\'
|
|
|
|
cleanup()
|
|
{
|
|
$TMUX kill-server >/dev/null 2>&1
|
|
$TMUX2 kill-server >/dev/null 2>&1
|
|
}
|
|
fail()
|
|
{
|
|
echo "$*" >&2
|
|
cleanup
|
|
exit 1
|
|
}
|
|
|
|
cleanup
|
|
|
|
TMP=$(mktemp)
|
|
trap "cleanup; rm -f $TMP" 0 1 15
|
|
|
|
# start_capture SX SY - attach an outer client to the inner session and
|
|
# start capturing its raw output into $TMP. Starts the outer session with a
|
|
# plain shell, then begins capturing before triggering the attach - starting
|
|
# the attach as the outer pane's initial command would mean pipe-pane only
|
|
# starts after the attach-driven initial redraw (which sends the image) has
|
|
# already happened, missing it.
|
|
start_capture()
|
|
{
|
|
sx=$1
|
|
sy=$2
|
|
|
|
$TMUX2 new-session -d -x "$sx" -y "$sy" || exit 1
|
|
OUTER=$($TMUX2 list-panes -F '#{pane_id}' | head -1)
|
|
[ -n "$OUTER" ] || fail "No outer pane."
|
|
$TMUX2 pipe-pane -t "$OUTER" -O "cat >$TMP" || fail "pipe-pane failed"
|
|
$TMUX2 send-keys -t "$OUTER" -l "$TMUX attach -t inner" ||
|
|
fail "send attach failed"
|
|
$TMUX2 send-keys -t "$OUTER" Enter || fail "send enter failed"
|
|
sleep 1
|
|
}
|
|
|
|
# Sanity check: the image reached the client at all.
|
|
assert_image_reached()
|
|
{
|
|
grep -qa '"1;1;26;26' $TMP || fail "sanity: image never reached the client"
|
|
}
|
|
|
|
# assert_no_retransmit CONTEXT - no DCS sequence should have been sent since
|
|
# $TMP was last cleared. Expected to fail before the fix each test guards -
|
|
# see that test's header comment.
|
|
assert_no_retransmit()
|
|
{
|
|
n=$(grep -ac "$(printf '\033P')" $TMP)
|
|
[ "$n" -eq 0 ] || fail "image was retransmitted ($n times) $1"
|
|
}
|