Add test for rendering failures on text wrapping across frames

This commit is contained in:
John Hood
2015-10-28 00:03:15 -04:00
parent 65ced750e6
commit 484677289d
2 changed files with 111 additions and 0 deletions
+2
View File
@@ -19,8 +19,10 @@ displaytests = \
emulation-back-tab.test \
emulation-cursor-motion.test \
emulation-multiline-scroll.test \
emulation-wrap-across-frames.test \
server-network-timeout.test \
server-signal-timeout.test \
window-resize.test \
unicode-combine-fallback-assert.test \
unicode-later-combining.test \
window-resize.test
+109
View File
@@ -0,0 +1,109 @@
#!/bin/sh
#
# This is a regression test for a bug seen where mosh-server's
# round-trip verification failed if text was filled to column 80 on
# frame N and then wrapped to the next line on frame N+1, because the
# wrap flag used to be in the Cell class and caused miscompares
# between cells. It got moved to the Rows class where it makes more
# sense.
#
fail()
{
printf "$@" 2>&1
exit 99
}
PATH=$PATH:.:$srcdir
# Top-level wrapper.
if [ $# -eq 0 ]; then
e2e-test $0 baseline direct verify
exit
fi
# OK, we have arguments, we're one of the test hooks.
if [ $# -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
sleepf()
{
(sleep .1 || sleep 1) > /dev/null 2>&1
}
seq()
{
if [ $# -lt 1 -o $# -gt 3 ]; then
echo "bad args" >&2
fi
first=$1
incr=1
last=0
case $# in
3)
incr=$2
last=$3
;;
2)
last=$2
;;
1)
;;
esac
while :; do
printf '%d\n' $first
first=$(expr $first + $incr)
if [ $first -gt $last ]; then
break
fi
done
}
chr()
{
printf "\\$(printf %03o $1)"
}
utf8cp()
{
local c=$1
if [ $c -gt $((0x10ffff)) ]; then
fail "illegal Unicode code point %x\n" $c
elif [ $c -lt $((0x80)) ]; then
chr $c
elif [ $c -lt $((0x800)) ]; then
chr $(( (($c >> 6) & 0x1f) | 0xc0 ))
chr $(( ($c & 0x3f) | 0x80 ))
elif [ $c -lt $((0x10000)) ]; then
chr $(( (($c >> 12) & 0x0f) | 0xe0 ))
chr $(( (($c >> 6) & 0x3f) | 0x80 ))
chr $(( ($c & 0x3f) | 0x80 ))
elif [ $c -lt $((0x200000)) ]; then
chr $(( (($c >> 18) & 0x03) | 0xf0 ))
chr $(( (($c >> 12) & 0x3f) | 0x80 ))
chr $(( (($c >> 6) & 0x3f) | 0x80 ))
chr $(( ($c & 0x3f) | 0x80 ))
fi
}
baseline()
{
printf '\033[H\033[J'
for x in $(seq 1 10); do
printf "abcdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1234"
sleep .1
printf "ABCDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5678"
sleep .1
done
printf '\n'
}
case $1 in
baseline|direct)
baseline;;
*)
fail "unknown test argument %s\n" $1;;
esac