tests/termptyesc: handle DECSACE

Also regenerate tests since checksums changed due to new attribute
This commit is contained in:
Boris Faure 2018-12-29 17:18:39 +01:00
parent 63911989fc
commit 68787ad524
5 changed files with 52 additions and 6 deletions

View File

@ -120,6 +120,7 @@ typedef struct _Term_State {
unsigned int cjk_ambiguous_wide : 1; unsigned int cjk_ambiguous_wide : 1;
unsigned int hide_cursor : 1; unsigned int hide_cursor : 1;
unsigned int combining_strike : 1; unsigned int combining_strike : 1;
unsigned int sace_rectangular : 1;
} Term_State; } Term_State;
typedef struct _Term_Cursor { typedef struct _Term_Cursor {

View File

@ -1772,6 +1772,34 @@ _handle_esc_csi_decscusr(Termpty *ty, Eina_Unicode **b)
termio_set_cursor_shape(ty->obj, shape); termio_set_cursor_shape(ty->obj, shape);
} }
static void
_handle_esc_csi_decsace(Termpty *ty, Eina_Unicode **b)
{
int arg = _csi_arg_get(ty, b);
DBG("DECSACE (%d) Select Attribute Change Extent", arg);
switch (arg)
{
case -CSI_ARG_ERROR:
return;
case -CSI_ARG_NO_VALUE:
EINA_FALLTHROUGH;
case 0:
EINA_FALLTHROUGH;
case 1:
ty->termstate.sace_rectangular = 0;
break;
case 2:
ty->termstate.sace_rectangular = 1;
break;
default:
WRN("Invalid DECSACE %d", arg);
ty->decoding_error = EINA_TRUE;
return;
}
}
static int static int
_handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce) _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
{ {
@ -2251,6 +2279,8 @@ HVP:
case 'x': case 'x':
if (*(cc-1) == '$') if (*(cc-1) == '$')
_handle_esc_csi_decfra(ty, &b); _handle_esc_csi_decfra(ty, &b);
else if (*(cc-1) == '*')
_handle_esc_csi_decsace(ty, &b);
break; break;
case 'z': case 'z':
if (*(cc-1) == '$') if (*(cc-1) == '$')

View File

@ -459,6 +459,7 @@ termpty_soft_reset_state(Termpty *ty)
ty->termstate.no_autorepeat = 0; ty->termstate.no_autorepeat = 0;
ty->termstate.cjk_ambiguous_wide = 0; ty->termstate.cjk_ambiguous_wide = 0;
ty->termstate.hide_cursor = 0; ty->termstate.hide_cursor = 0;
ty->termstate.sace_rectangular = 0;
ty->mouse_mode = MOUSE_OFF; ty->mouse_mode = MOUSE_OFF;
ty->mouse_ext = MOUSE_EXT_NONE; ty->mouse_ext = MOUSE_EXT_NONE;
ty->bracketed_paste = 0; ty->bracketed_paste = 0;

View File

@ -7,6 +7,7 @@ RESULTS="tests.results"
TESTDIR="." TESTDIR="."
VERBOSE=0 VERBOSE=0
DEBUG=0 DEBUG=0
GENRESULTS=0
EXIT_ON_FAILURE=0 EXIT_ON_FAILURE=0
NB_TESTS=0 NB_TESTS=0
OK_TESTS=0 OK_TESTS=0
@ -73,8 +74,9 @@ where options are:
-e, --exitonfailure Exit as soon as a test fails -e, --exitonfailure Exit as soon as a test fails
Misc options: Misc options:
-v, --verbose Be verbose about what is being done. -v, --verbose Be verbose about what is being done
--debug Debug tests --debug Debug tests
--genresults Output a results file
-h, --help Show this help. -h, --help Show this help.
HELP_EOF HELP_EOF
} }
@ -99,6 +101,9 @@ while [ $# -gt 0 ]; do
-debug|--debug) -debug|--debug)
DEBUG=1 DEBUG=1
;; ;;
-genresults|--genresults)
GENRESULTS=1
;;
-t|-tytest|--tytest) -t|-tytest|--tytest)
if [ -z "$value" ]; then if [ -z "$value" ]; then
value=$1 value=$1
@ -138,6 +143,11 @@ fi
if [ ! -d "$TESTDIR" ]; then if [ ! -d "$TESTDIR" ]; then
die "Invalid test directory: $TESTDIR" die "Invalid test directory: $TESTDIR"
fi fi
if [ $GENRESULTS -ne 0 ]; then
DEBUG=0
VERBOSE=0
fi
if [ $DEBUG -ne 0 ]; then if [ $DEBUG -ne 0 ]; then
cat <<EOF cat <<EOF
@ -160,10 +170,14 @@ while read -r TEST EXPECTED_CHECKSUM; do
if [ $DEBUG -ne 0 ]; then if [ $DEBUG -ne 0 ]; then
printf "(got %s, expected %s) " "$TEST_CHECKSUM" "$EXPECTED_CHECKSUM" printf "(got %s, expected %s) " "$TEST_CHECKSUM" "$EXPECTED_CHECKSUM"
fi fi
if [ $GENRESULTS -ne 0 ]; then
printf "%s %s\n" "$TEST" "$TEST_CHECKSUM"
else
if [ "$TEST_CHECKSUM" = "$EXPECTED_CHECKSUM" ]; then if [ "$TEST_CHECKSUM" = "$EXPECTED_CHECKSUM" ]; then
ok "$TEST" ok "$TEST"
else else
failed "$TEST" failed "$TEST"
fi fi
fi
done < "$RESULTS" done < "$RESULTS"
summary summary

View File

@ -41,5 +41,5 @@ decaln.sh 9c0cf4de336193bcdaed6ba6c0d6f590
decawm.sh 84321e76f07b40cf9462238ec0919dc0 decawm.sh 84321e76f07b40cf9462238ec0919dc0
decbi.sh 8153bff12a0d529cb8ba0dbff036a1ee decbi.sh 8153bff12a0d529cb8ba0dbff036a1ee
decfi.sh e93690447902b923d3d9d2ae72a31de4 decfi.sh e93690447902b923d3d9d2ae72a31de4
deccara-rectangular-no-restrict-cursor.sh 5f85e9992055397f951af7b5713fabde deccara-rectangular-no-restrict-cursor.sh 0d04ff5f4a266917528ff8d17846c18a
deccara-rectangular-restrict-cursor.sh c1d571a6c60a4fb06fdd81fee7c85e1c deccara-rectangular-restrict-cursor.sh 9f23ac6a3423ba8bf7b8af5116e2843b