[ttssh2-commit] [10300] ticket #45649, #45558 からインポート

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2022年 10月 7日 (金) 23:10:54 JST


Revision: 10300
          https://osdn.net/projects/ttssh2/scm/svn/commits/10300
Author:   nmaya
Date:     2022-10-07 23:10:54 +0900 (Fri, 07 Oct 2022)
Log Message:
-----------
ticket #45649, #45558 からインポート

Ticket Links:
------------
    https://osdn.net/projects/ttssh2/tracker/detail/45649
    https://osdn.net/projects/ttssh2/tracker/detail/45558

Added Paths:
-----------
    trunk/tests/bcetest.sh
    trunk/tests/color-test.bash

-------------- next part --------------
Added: trunk/tests/bcetest.sh
===================================================================
--- trunk/tests/bcetest.sh	                        (rev 0)
+++ trunk/tests/bcetest.sh	2022-10-07 14:10:54 UTC (rev 10300)
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+pause() {
+  printf "==> push return <== "
+  read dummy
+}
+
+CSI() {
+  while [ $# -gt 0 ]; do
+    printf "\033[%s" $1
+    shift
+  done
+}
+
+SGR() {
+  CSI ""
+  printf "%s" $1
+  shift
+  while [ $# -gt 0 ]; do
+    printf ";%s" $1
+    shift
+  done
+
+  printf m
+}
+
+bcetest() {
+  CSI 2J H
+
+  SGR 31 46; printf "EL"; CSI K; SGR 0; echo
+  SGR 31 46; printf "ICH"; CSI 999@; SGR 0; echo
+  SGR 31 46; printf "DCH"; CSI 999P; SGR 0; echo
+  SGR 31 46; printf "ECH"; CSI 999X; SGR 0; echo
+  SGR 31 46; CSI L; printf "IL"; SGR 0; echo
+  SGR 31 46 7; printf "EL+SGR7"; CSI K; SGR 0; echo
+  SGR 31 46; printf "ED"; CSI J; SGR 0; echo; echo; echo
+
+  printf "EL"; CSI K; SGR 0; echo
+  SGR 7; printf "EL+SGR7"; CSI K; SGR 0; echo
+  printf "ED"; CSI J; SGR 0; echo; echo; echo
+}
+
+bcetest
+
+pause
+
+CSI "?5h"
+
+bcetest
+
+pause
+
+CSI "?5l"
+CSI 9999H

Added: trunk/tests/color-test.bash
===================================================================
--- trunk/tests/color-test.bash	                        (rev 0)
+++ trunk/tests/color-test.bash	2022-10-07 14:10:54 UTC (rev 10300)
@@ -0,0 +1,57 @@
+#!/usr/local/bin/bash
+
+pause() {
+  printf "=>push return<= "
+  read dummy
+  echo
+}
+
+test_color() {
+  case $1 in
+    ?) len=25;;
+    ??) len=26;;
+    ???) len=27;;
+    *) return;;
+  esac
+  
+  echo -ne "\e]4;$1;?\a"
+  IFS=: read -n $len dummy cstr
+  reply=$(echo $cstr | tr -d '\07')
+  h=$(printf "%1x0" $1)
+  expected="$h$h/$h$h/$h$h"
+
+  if [ $reply = $expected ]; then
+    printf "o "
+  else
+    printf "x "
+  fi
+  printf "%d: %s %s\n" $1 $reply $expected
+}
+
+OLD_MODE=$(stty -g)
+stty -echo
+
+seq 0 15 | while read c; do
+  printf "\033[48;5;${c}m  "
+done
+printf "\033[m\n"
+
+pause
+
+seq 0 15 | while read c; do
+  printf "\033]4;${c};#%1x%1x%1x\033\\" $c $c $c
+done
+
+pause
+
+for c in $(seq 0 15); do
+  test_color $c
+done
+
+pause
+
+seq 0 15 | while read c; do
+  printf "\033]104;${c}\033\\"
+done
+
+stty $OLD_MODE


ttssh2-commit メーリングリストの案内
Back to archive index