mirror of
https://github.com/tmux/tmux.git
synced 2026-09-25 06:06:29 +00:00
Update tests and bits after popups removed.
This commit is contained in:
+1
-1
@@ -44,7 +44,7 @@ LLVMFuzzerTestOneInput(const u_char *data, size_t size)
|
||||
w = window_create(PANE_WIDTH, PANE_HEIGHT, 0, 0);
|
||||
wp = window_add_pane(w, NULL, 0, 0);
|
||||
bufferevent_pair_new(libevent, BEV_OPT_CLOSE_ON_FREE, vpty);
|
||||
wp->ictx = input_init(wp, vpty[0], NULL, NULL);
|
||||
wp->ictx = input_init(wp, vpty[0], NULL);
|
||||
window_add_ref(w, __func__);
|
||||
|
||||
wp->fd = open("/dev/null", O_WRONLY);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Popups require a tty overlay and cannot be displayed by a control client.
|
||||
# Popups require an attached terminal and cannot be displayed by a control
|
||||
# client.
|
||||
# A popup command from control mode must be ignored cleanly, leaving the
|
||||
# client command queue and server usable.
|
||||
|
||||
|
||||
@@ -400,6 +400,107 @@ $TMUX2 send-keys -t "$OUTER" a
|
||||
sleep 1
|
||||
must_equal "$(fmt modal:0 '#{window_modal_pane}')" ''
|
||||
|
||||
$TMUX bind P display-popup -E -t "$p0" -w 20 -h 5 -T popup-title 'cat'
|
||||
$TMUX2 send-keys -t "$OUTER" C-b P
|
||||
sleep 1
|
||||
modal=$(fmt modal:0 '#{window_modal_pane}')
|
||||
[ -n "$modal" ] || fail "display-popup did not create a modal pane"
|
||||
must_equal "$(fmt "$modal" '#{pane_title}')" popup-title
|
||||
must_equal "$($TMUX show-options -pv -t "$modal" pane-border-status)" top
|
||||
must_equal "$($TMUX show-options -pv -t "$modal" pane-border-format)" \
|
||||
'#{pane_title}'
|
||||
$TMUX2 send-keys -t "$OUTER" C-b x z Enter
|
||||
sleep 1
|
||||
must_equal "$($TMUX show -gv @modal-prefix)" no
|
||||
must_equal "$($TMUX show -gv @modal-root)" no
|
||||
case "$($TMUX capture-pane -pt "$modal")" in
|
||||
*xz*) ;;
|
||||
*) fail "keys did not reach display-popup pane" ;;
|
||||
esac
|
||||
$TMUX2 send-keys -t "$OUTER" Escape
|
||||
sleep 1
|
||||
must_equal "$(fmt modal:0 '#{window_modal_pane}')" "$modal"
|
||||
$TMUX2 send-keys -t "$OUTER" C-c
|
||||
sleep 1
|
||||
must_equal "$(fmt modal:0 '#{window_modal_pane}')" ''
|
||||
|
||||
# Creating a popup pane must not fire the split-window hook.
|
||||
check_ok set-hook -t modal after-split-window \
|
||||
"set-option -g @popup-after-split yes"
|
||||
check_ok set-option -g @popup-after-split no
|
||||
check_ok display-popup -E -t "$p0" true
|
||||
must_equal "$($TMUX show-option -gv @popup-after-split)" no
|
||||
check_ok set-hook -u -t modal after-split-window
|
||||
|
||||
# A borderless popup must not create a zero-sized pane in a tiny window.
|
||||
check_ok new-window -d -t modal: -n popup-small 'cat'
|
||||
check_ok set-option -w -t modal:popup-small window-size manual
|
||||
check_ok resize-window -t modal:popup-small -x 1 -y 1
|
||||
small=$(fmt modal:popup-small '#{pane_id}')
|
||||
check_ok bind Z display-popup -B -t "$small" 'cat'
|
||||
$TMUX2 send-keys -t "$OUTER" C-b Z
|
||||
sleep 1
|
||||
must_equal "$(fmt modal:popup-small '#{window_panes}')" 1
|
||||
must_equal "$(fmt modal:popup-small '#{window_modal_pane}')" ''
|
||||
|
||||
$TMUX bind D display-popup -t "$p0" -w 20 -h 5 'printf done'
|
||||
$TMUX2 send-keys -t "$OUTER" C-b D
|
||||
sleep 2
|
||||
modal=$(fmt modal:0 '#{window_modal_pane}')
|
||||
[ -n "$modal" ] || fail "retained display-popup was not created"
|
||||
must_equal "$(fmt "$modal" '#{pane_dead}')" 1
|
||||
case "$($TMUX capture-pane -pt "$modal")" in
|
||||
*'Pane is dead'*) fail "display-popup showed remain-on-exit message" ;;
|
||||
esac
|
||||
$TMUX2 send-keys -t "$OUTER" a
|
||||
sleep 1
|
||||
must_equal "$(fmt modal:0 '#{window_modal_pane}')" "$modal"
|
||||
$TMUX2 send-keys -t "$OUTER" Escape
|
||||
sleep 1
|
||||
must_equal "$(fmt modal:0 '#{window_modal_pane}')" ''
|
||||
|
||||
$TMUX bind K display-popup -k -t "$p0" -w 20 -h 5 'printf done'
|
||||
$TMUX2 send-keys -t "$OUTER" C-b K
|
||||
sleep 2
|
||||
modal=$(fmt modal:0 '#{window_modal_pane}')
|
||||
[ -n "$modal" ] || fail "display-popup -k was not created"
|
||||
must_equal "$(fmt "$modal" '#{pane_dead}')" 1
|
||||
$TMUX2 send-keys -t "$OUTER" a
|
||||
sleep 1
|
||||
must_equal "$(fmt modal:0 '#{window_modal_pane}')" ''
|
||||
|
||||
$TMUX bind F display-popup -EE -t "$p0" -w 20 -h 5 'exit 1'
|
||||
$TMUX2 send-keys -t "$OUTER" C-b F
|
||||
sleep 2
|
||||
modal=$(fmt modal:0 '#{window_modal_pane}')
|
||||
[ -n "$modal" ] || fail "failed display-popup -EE did not remain"
|
||||
must_equal "$(fmt "$modal" '#{pane_dead}')" 1
|
||||
$TMUX2 send-keys -t "$OUTER" a
|
||||
sleep 1
|
||||
must_equal "$(fmt modal:0 '#{window_modal_pane}')" "$modal"
|
||||
$TMUX2 send-keys -t "$OUTER" Escape
|
||||
sleep 1
|
||||
must_equal "$(fmt modal:0 '#{window_modal_pane}')" "$modal"
|
||||
check_ok kill-pane -t "$modal"
|
||||
sleep 1
|
||||
|
||||
check_ok display-popup -EE -t "$p0" true
|
||||
must_equal "$(fmt modal:0 '#{window_modal_pane}')" ''
|
||||
|
||||
$TMUX bind G display-popup -EE -k -t "$p0" -w 20 -h 5 'exit 1'
|
||||
$TMUX2 send-keys -t "$OUTER" C-b G
|
||||
sleep 2
|
||||
modal=$(fmt modal:0 '#{window_modal_pane}')
|
||||
[ -n "$modal" ] || fail "failed display-popup -EE -k did not remain"
|
||||
must_equal "$(fmt "$modal" '#{pane_dead}')" 1
|
||||
must_equal "$($TMUX show-options -pv -t "$modal" remain-on-exit)" failed-key
|
||||
$TMUX2 send-keys -t "$OUTER" a
|
||||
sleep 1
|
||||
must_equal "$(fmt modal:0 '#{window_modal_pane}')" ''
|
||||
|
||||
check_ok display-popup -EE -k -t "$p0" true
|
||||
must_equal "$(fmt modal:0 '#{window_modal_pane}')" ''
|
||||
|
||||
# A nonmodal floating pane may remain above zoom, and switching between it and
|
||||
# the zoomed tiled pane must not unzoom the window.
|
||||
check_ok new-window -d -t modal: -n float-over-zoom 'cat'
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Exercise drawing of popups (display-popup) over the window scene. A popup is an
|
||||
# overlay drawn on top of the redraw scene (the overlay_draw path in
|
||||
# screen-redraw.c), so this guards against regressions in how popups appear.
|
||||
#
|
||||
# A popup is modal and stays open until its command exits, so each scene fully
|
||||
# re-creates the servers and re-attaches; the popup is opened in the background
|
||||
# (display-popup blocks the client that runs it) and the outer pane is captured
|
||||
# while it is open.
|
||||
#
|
||||
# Run with GENERATE=1 to (re)create the golden files.
|
||||
|
||||
PATH=/bin:/usr/bin
|
||||
TERM=screen
|
||||
LC_ALL=C.UTF-8
|
||||
export TERM LC_ALL
|
||||
|
||||
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
|
||||
TMUX=
|
||||
TMUX2=
|
||||
SETUP=0
|
||||
RESULTS=screen-redraw-results
|
||||
|
||||
TMP=$(mktemp)
|
||||
|
||||
cleanup() {
|
||||
rm -f "$TMP"
|
||||
[ -n "$TMUX" ] && $TMUX kill-server 2>/dev/null
|
||||
[ -n "$TMUX2" ] && $TMUX2 kill-server 2>/dev/null
|
||||
}
|
||||
trap cleanup 0 1 15
|
||||
|
||||
fail() {
|
||||
echo "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
compare() {
|
||||
sleep 1
|
||||
$TMUX capturep -p >$TMP || exit 1
|
||||
if [ -n "$GENERATE" ]; then
|
||||
cp $TMP "$RESULTS/$1.result" || exit 1
|
||||
echo "generated $1"
|
||||
else
|
||||
cmp -s $TMP "$RESULTS/$1.result" || \
|
||||
fail "scene $1 differs from $RESULTS/$1.result"
|
||||
fi
|
||||
}
|
||||
|
||||
C="sh -c 'i=0; while [ \$i -lt 13 ]; do printf \"POP%02d abcdefghij\n\" \$i; i=\$((i + 1)); done; exec sleep 100'"
|
||||
|
||||
# setup: fresh inner window attached inside a fresh outer pane, 40x14.
|
||||
setup() {
|
||||
[ -n "$TMUX" ] && $TMUX kill-server 2>/dev/null
|
||||
[ -n "$TMUX2" ] && $TMUX2 kill-server 2>/dev/null
|
||||
SETUP=$((SETUP + 1))
|
||||
TMUX="$TEST_TMUX -LtestA$$-$SETUP -f/dev/null"
|
||||
TMUX2="$TEST_TMUX -LtestB$$-$SETUP -f/dev/null"
|
||||
$TMUX2 new -d -x40 -y14 "$C" || exit 1
|
||||
$TMUX2 set -g status off || exit 1
|
||||
$TMUX2 set -g window-size manual || exit 1
|
||||
$TMUX2 resizew -x40 -y14 || exit 1
|
||||
$TMUX new -d -x40 -y14 || exit 1
|
||||
$TMUX set -g status off || exit 1
|
||||
$TMUX set -g window-size manual || exit 1
|
||||
$TMUX set -g default-terminal "tmux-256color" || exit 1
|
||||
$TMUX send -l "$TMUX2 attach" || exit 1
|
||||
$TMUX send Enter || exit 1
|
||||
sleep 1
|
||||
}
|
||||
|
||||
# popup <args>: open a popup running a fixed command, in the background (it stays
|
||||
# open because the command sleeps; the servers are killed at the next setup).
|
||||
popup() {
|
||||
$TMUX2 display-popup "$@" -E "sh -c 'printf POPUP; exec sleep 100'" &
|
||||
sleep 1
|
||||
}
|
||||
|
||||
# Basic popup over a single pane.
|
||||
setup
|
||||
popup -w20 -h6 -x6 -y3
|
||||
compare popup-basic
|
||||
|
||||
# Popup over a split: drawn on top of the pane border.
|
||||
setup
|
||||
$TMUX2 splitw -h "$C" || exit 1
|
||||
popup -w24 -h8 -x8 -y3
|
||||
compare popup-over-split
|
||||
|
||||
# Popup with no border lines (-B).
|
||||
setup
|
||||
popup -B -w20 -h6 -x6 -y3
|
||||
compare popup-noborder
|
||||
|
||||
# Popup with double border lines.
|
||||
setup
|
||||
popup -b double -w20 -h6 -x6 -y3
|
||||
compare popup-double
|
||||
|
||||
exit 0
|
||||
@@ -1,14 +0,0 @@
|
||||
POP00 ┌──────────────────┐
|
||||
POP01 │POPUP │
|
||||
POP02 │ │
|
||||
POP03 │ │
|
||||
POP04 │ │
|
||||
POP05 └──────────────────┘
|
||||
POP06 abcdefghij
|
||||
POP07 abcdefghij
|
||||
POP08 abcdefghij
|
||||
POP09 abcdefghij
|
||||
POP10 abcdefghij
|
||||
POP11 abcdefghij
|
||||
POP12 abcdefghij
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
POP00 ╔══════════════════╗
|
||||
POP01 ║POPUP ║
|
||||
POP02 ║ ║
|
||||
POP03 ║ ║
|
||||
POP04 ║ ║
|
||||
POP05 ╚══════════════════╝
|
||||
POP06 abcdefghij
|
||||
POP07 abcdefghij
|
||||
POP08 abcdefghij
|
||||
POP09 abcdefghij
|
||||
POP10 abcdefghij
|
||||
POP11 abcdefghij
|
||||
POP12 abcdefghij
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
POP00 POPUP
|
||||
POP01
|
||||
POP02
|
||||
POP03
|
||||
POP04
|
||||
POP05
|
||||
POP06 abcdefghij
|
||||
POP07 abcdefghij
|
||||
POP08 abcdefghij
|
||||
POP09 abcdefghij
|
||||
POP10 abcdefghij
|
||||
POP11 abcdefghij
|
||||
POP12 abcdefghij
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
POP00 ab┌──────────────────────┐fghij
|
||||
POP01 ab│POPUP │fghij
|
||||
POP02 ab│ │fghij
|
||||
POP03 ab│ │fghij
|
||||
POP04 ab│ │fghij
|
||||
POP05 ab│ │fghij
|
||||
POP06 ab│ │fghij
|
||||
POP07 ab└──────────────────────┘fghij
|
||||
POP08 abcdefghij │POP08 abcdefghij
|
||||
POP09 abcdefghij │POP09 abcdefghij
|
||||
POP10 abcdefghij │POP10 abcdefghij
|
||||
POP11 abcdefghij │POP11 abcdefghij
|
||||
POP12 abcdefghij │POP12 abcdefghij
|
||||
│
|
||||
Reference in New Issue
Block a user