NEW
  PREFIX
AUTO 4,1
#!/BIN/SH
#
#
#
ECHO "\f\n              A2osX Terminal Tests"
ECHO
ECHO "This tests the various Terminal/Console/Screen attributes"
ECHO "Available in A2osX scripts and applications."
IF [ -N $Log ]
  ECHO "Begin A2osX Terminal Tests" >> ${Log}
ELSE
  SET T = 0
  SET F = 0
  SET P = 0
FI
SET T = $T + 1
ECHO -N "\e[10;10H"
ECHO "This Text Should be on line 10 column 10"
ECHO
ECHO -N "\e[20;5H"
READ -P "Does the line above appear to be in the right location (Y/N)?" R
ECHO
IF [ $R = "y" ]
  SET R = "Y"
FI
ECHO "\f"
ECHO -N "\e[9;64H"
IF [ $R = "Y" ]
  ECHO "Test 1 PASSED"
  SET P = $P + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 1 PASSED" >> ${Log}
  FI
ELSE
  SET F = $F + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 1 FAILED" >> ${Log}
  FI
  ECHO "Test 1 FAILED"
FI
#
#  Draw Box in middle of screen
#
#  Screen is 80 x 24, make box 40 x 10 centered so
#  starting at 7 - 20
#
SET T = $T + 1
ECHO -N "\e[7;20H"
ECHO "\e[7m                                        \e[0m"
SET LINE = 8
WHILE [ $LINE -NE 17 ]
  ECHO -N "\e[${LINE};20H"
  ECHO "\e[7m \e[0m                                      \e[7m \e[0m"
  SET LINE = $LINE + 1
LOOP
ECHO -N "\e[17;20H"
ECHO "\e[7m                                        \e[0m"
ECHO
ECHO -N "\e[20;5H\e[K"
READ -P "Is there a box centered on the screen above (Y/N)?" R
ECHO
IF [ $R = "y" ]
  SET R = "Y"
FI
ECHO -N "\e[10;64H"
IF [ $R = "Y" ]
  ECHO "Test 2 PASSED"
  SET P = $P + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 2 PASSED" >> ${Log}
  FI
ELSE
  SET F = $F + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 2 FAILED" >> ${Log}
  FI
  ECHO "Test 2 FAILED"
FI
#
#  Now put something in center of box
#
SET T = $T + 1
ECHO -N "\e[12;30HA2osX is the Greatest!"
ECHO -N "\e[20;5H\e[K"
READ -P "Did a phrase appear centered in the box (Y/N)?" R
ECHO
IF [ $R = "y" ]
  SET R = "Y"
FI
ECHO -N "\e[11;64H"
IF [ $R = "Y" ]
  ECHO "Test 3 PASSED"
  SET P = $P + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 3 PASSED" >> ${Log}
  FI
ELSE
  SET F = $F + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 3 FAILED" >> ${Log}
  FI
  ECHO "Test 3 FAILED"
FI
#
#  Now inverse the phrase in the box  \e[7m \e[0m
#
SET T = $T + 1
ECHO -N "\e[12;30H\e[7mA2osX is the Greatest!\e[0m"
ECHO -N "\e[20;5H\e[K"
READ -P "Is the phrase now in inverse (Y/N)?" R
ECHO
IF [ $R = "y" ]
  SET R = "Y"
FI
ECHO -N "\e[12;64H"
IF [ $R = "Y" ]
  ECHO "Test 4 PASSED"
  SET P = $P + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 4 PASSED" >> ${Log}
  FI
ELSE
  SET F = $F + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 4 FAILED" >> ${Log}
  FI
  ECHO "Test 4 FAILED"
FI
#
#  Put up full line Title Bar above box
#
SET T = $T + 1
ECHO -N "\e[2;1H"
ECHO -N "------------------------------  Full Width Title  ------------------------------"
ECHO -N "\e[20;5H\e[K"
READ -P "Has a title line appeared on line 2 (Y/N)?" R
ECHO
IF [ $R = "y" ]
  SET R = "Y"
FI
ECHO -N "\e[13;64H"
IF [ $R = "Y" ]
  ECHO "Test 5 PASSED"
  SET P = $P + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 5 PASSED" >> ${Log}
  FI
ELSE
  SET F = $F + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 5 FAILED" >> ${Log}
  FI
  ECHO "Test 5 FAILED"
FI
#
# Now Blank right half of line
#
SET T = $T + 1
ECHO -N "\e[2;41H\e[K"
ECHO -N "\e[20;5H\e[K"
READ -P "Did the right half of the title disappear (Y/N)?" R
ECHO
IF [ $R = "y" ]
  SET R = "Y"
FI
ECHO -N "\e[14;64H"
IF [ $R = "Y" ]
  ECHO "Test 6 PASSED"
  SET P = $P + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 6 PASSED" >> ${Log}
  FI
ELSE
  SET F = $F + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 6 FAILED" >> ${Log}
  FI
  ECHO "Test 6 FAILED"
FI
#
#  Put up full line Title Bar above box
#
ECHO -N "\e[2;1H"
ECHO -N "------------------------------  Full Width Title  ------------------------------"
ECHO -N "\e[20;5H\e[K"
READ -P "Has a title line appeared on line 2 (Y/N)?" R
ECHO
#
# Now Blank left half of line
#
SET T = $T + 1
ECHO -N "\e[2;40H\e[1K"
ECHO -N "\e[20;5H\e[K"
READ -P "Did the right half of the title disappear (Y/N)?" R
ECHO
IF [ $R = "y" ]
  SET R = "Y"
FI
ECHO -N "\e[15;64H"
IF [ $R = "Y" ]
  ECHO "Test 7 PASSED"
  SET P = $P + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 7 PASSED" >> ${Log}
  FI
ELSE
  SET F = $F + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 7 FAILED" >> ${Log}
  FI
  ECHO "Test 7 FAILED"
FI
#
#  Put up full line Title Bar above box
#
ECHO -N "\e[2;1H"
ECHO -N "------------------------------  Full Width Title  ------------------------------"
ECHO -N "\e[20;5H\e[K"
READ -P "Has a title line appeared on line 2 (Y/N)?" R
ECHO
#
# Now Blank entire line
#
SET T = $T + 1
ECHO -N "\e[2;40H\e[2K"
ECHO -N "\e[20;5H\e[K"
READ -P "Did the entire title line disappear (Y/N)?" R
ECHO
IF [ $R = "y" ]
  SET R = "Y"
FI
ECHO -N "\e[16;64H"
IF [ $R = "Y" ]
  ECHO "Test 8 PASSED"
  SET P = $P + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 8 PASSED" >> ${Log}
  FI
ELSE
  SET F = $F + 1
  IF [ -N $Log ]
    ECHO "A2osX Terminal Test 8 FAILED" >> ${Log}
  FI
  ECHO "Test 8 FAILED"
FI
#  End of Tests
IF [ -N $Log ]
  ECHO "End A2osX Terminal Tests" >> ${Log}
FI
ECHO -N "\e[20;5H\e[K"
ECHO "\e[20;15HEnd of Tests"
ECHO
MAN
TEXT /MAKE/USR/SHARE/TESTS/VTTEST
