billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=68787ad524a359634880b7f2e7fe820b881c40af

commit 68787ad524a359634880b7f2e7fe820b881c40af
Author: Boris Faure <[email protected]>
Date:   Sat Dec 29 17:18:39 2018 +0100

    tests/termptyesc: handle DECSACE
    
    Also regenerate tests since checksums changed due to new attribute
---
 src/bin/termpty.h    |  1 +
 src/bin/termptyesc.c | 30 ++++++++++++++++++++++++++++++
 src/bin/termptyops.c |  1 +
 tests/run_tests.sh   | 22 ++++++++++++++++++----
 tests/tests.results  |  4 ++--
 5 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index dd08f08..7a3aee2 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -120,6 +120,7 @@ typedef struct _Term_State {
     unsigned int  cjk_ambiguous_wide : 1;
     unsigned int  hide_cursor : 1;
     unsigned int  combining_strike : 1;
+    unsigned int  sace_rectangular : 1;
 } Term_State;
 
 typedef struct _Term_Cursor {
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index bfde79c..e6c6410 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -1772,6 +1772,34 @@ _handle_esc_csi_decscusr(Termpty *ty, Eina_Unicode **b)
   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
 _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
 {
@@ -2251,6 +2279,8 @@ HVP:
       case 'x':
         if (*(cc-1) == '$')
           _handle_esc_csi_decfra(ty, &b);
+        else if (*(cc-1) == '*')
+          _handle_esc_csi_decsace(ty, &b);
         break;
       case 'z':
         if (*(cc-1) == '$')
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index ad6bf62..2684e88 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -459,6 +459,7 @@ termpty_soft_reset_state(Termpty *ty)
    ty->termstate.no_autorepeat = 0;
    ty->termstate.cjk_ambiguous_wide = 0;
    ty->termstate.hide_cursor = 0;
+   ty->termstate.sace_rectangular = 0;
    ty->mouse_mode = MOUSE_OFF;
    ty->mouse_ext = MOUSE_EXT_NONE;
    ty->bracketed_paste = 0;
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index d1750cf..b743251 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -7,6 +7,7 @@ RESULTS="tests.results"
 TESTDIR="."
 VERBOSE=0
 DEBUG=0
+GENRESULTS=0
 EXIT_ON_FAILURE=0
 NB_TESTS=0
 OK_TESTS=0
@@ -73,8 +74,9 @@ where options are:
   -e, --exitonfailure      Exit as soon as a test fails
 
 Misc options:
-  -v, --verbose            Be verbose about what is being done.
+  -v, --verbose            Be verbose about what is being done
   --debug                  Debug tests
+  --genresults             Output a results file
   -h, --help               Show this help.
 HELP_EOF
 }
@@ -99,6 +101,9 @@ while [ $# -gt 0 ]; do
         -debug|--debug)
             DEBUG=1
             ;;
+        -genresults|--genresults)
+           GENRESULTS=1
+           ;;
         -t|-tytest|--tytest)
             if [ -z "$value" ]; then
                 value=$1
@@ -138,6 +143,11 @@ fi
 if [ ! -d "$TESTDIR" ]; then
     die "Invalid test directory: $TESTDIR"
 fi
+if [ $GENRESULTS -ne 0 ]; then
+   DEBUG=0
+   VERBOSE=0
+fi
+
 
 if [ $DEBUG -ne 0 ]; then
     cat <<EOF
@@ -160,10 +170,14 @@ while read -r TEST EXPECTED_CHECKSUM; do
     if [ $DEBUG -ne 0 ]; then
         printf "(got %s, expected %s) " "$TEST_CHECKSUM" "$EXPECTED_CHECKSUM"
     fi
-    if [ "$TEST_CHECKSUM" = "$EXPECTED_CHECKSUM" ]; then
-        ok "$TEST"
+    if [ $GENRESULTS -ne 0 ]; then
+        printf "%s %s\n" "$TEST" "$TEST_CHECKSUM"
     else
-        failed "$TEST"
+       if [ "$TEST_CHECKSUM" = "$EXPECTED_CHECKSUM" ]; then
+          ok "$TEST"
+       else
+          failed "$TEST"
+       fi
     fi
 done < "$RESULTS"
 summary
diff --git a/tests/tests.results b/tests/tests.results
index 5b38bdc..c46ce8a 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -41,5 +41,5 @@ decaln.sh 9c0cf4de336193bcdaed6ba6c0d6f590
 decawm.sh 84321e76f07b40cf9462238ec0919dc0
 decbi.sh 8153bff12a0d529cb8ba0dbff036a1ee
 decfi.sh e93690447902b923d3d9d2ae72a31de4
-deccara-rectangular-no-restrict-cursor.sh 5f85e9992055397f951af7b5713fabde
-deccara-rectangular-restrict-cursor.sh c1d571a6c60a4fb06fdd81fee7c85e1c
+deccara-rectangular-no-restrict-cursor.sh 0d04ff5f4a266917528ff8d17846c18a
+deccara-rectangular-restrict-cursor.sh 9f23ac6a3423ba8bf7b8af5116e2843b

-- 


Reply via email to