about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-03-04 18:21:11 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-03-04 18:21:11 +0000
commitc312fa1d3c6ca31f5db705081f1217fbfde1c4d2 (patch)
tree0f39e069a282805d8f5404be8a3269441766566b /test
parent5ce82accbe2b446d572516a4636831e16ee21b16 (diff)
downloadnetpbm-mirror-c312fa1d3c6ca31f5db705081f1217fbfde1c4d2.tar.gz
netpbm-mirror-c312fa1d3c6ca31f5db705081f1217fbfde1c4d2.tar.xz
netpbm-mirror-c312fa1d3c6ca31f5db705081f1217fbfde1c4d2.zip
test new -asciihex and -ascii85 on 'pbmtextps'
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4510 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r--test/pbmtextps-dump.ok25
-rwxr-xr-xtest/pbmtextps-dump.test64
-rw-r--r--test/pbmtextps.ok4
-rwxr-xr-xtest/pbmtextps.test10
4 files changed, 91 insertions, 12 deletions
diff --git a/test/pbmtextps-dump.ok b/test/pbmtextps-dump.ok
index 9fe3b2ea..11a4c5fd 100644
--- a/test/pbmtextps-dump.ok
+++ b/test/pbmtextps-dump.ok
@@ -43,6 +43,13 @@ Test 1
 -stroke 1
 < /pensize -1.000000 def
 > /pensize 1.000000 def
+Test 2
+30 31 32 20 41 42 43 2d 78 79 7a 2e
+1
+303132204142432d78797a2e
+1
+<303132 20 414243 2d 78797a 2e>
+1
 Test Invalid
 Expected failure 1 (-fontsize) 1
 Expected failure 2 (-fontsize 0) 1
@@ -62,4 +69,20 @@ Expected failure 15 (-descent) 1
 Expected failure 16 (-descent -1) 1
 Expected failure 17 (-stroke=A) 1
 Expected failure 18 (-pad -crop) 1
-Expected failure 19 (-font="") 1
+Expected failure 19 (-asciihex <a>) 1
+Expected failure 20 (-asciihex ) 1
+Expected failure 21 (-asciihex <53756c667572) 1
+Expected failure 22 (-asciihex 53756c667572>) 1
+Expected failure 23 (-asciihex <5375<6c667572>) 1
+Expected failure 24 (-asciihex <53756c>667572>) 1
+Expected failure 25 (-ascii85 <~@<6O!FD5W(~) 1
+Expected failure 26 (-ascii85 ~@<6O!FD5W(~>) 1
+Expected failure 27 (-ascii85 <~@<6O<~!FD5W(~>) 1
+Expected failure 28 (-ascii85 <~@<6O~>!FD5W(~>) 1
+Expected failure 29 (-ascii85 <~@<6O!FD5W(~~>) 1
+Expected failure 30 (-ascii85 v) 1
+Expected failure 31 (-ascii85 y) 1
+Expected failure 32 (-ascii85 1z) 1
+Expected failure 33 (-ascii85 z1z) 1
+Expected failure 34 (-ascii85 <~0123z~>) 1
+Expected failure 35 (-font="") 1
diff --git a/test/pbmtextps-dump.test b/test/pbmtextps-dump.test
index 3b3fbadd..82856f7e 100755
--- a/test/pbmtextps-dump.test
+++ b/test/pbmtextps-dump.test
@@ -6,15 +6,15 @@
 # Ghostscript is not required.
 
 tmpdir=${tmpdir:-/tmp}
-text_pbm=${tmpdir}/text.pbm
-text_ps=${tmpdir}/text.ps
+text1_ps=${tmpdir}/text1.ps
+text2_ps=${tmpdir}/text2.ps
 
 text="UNIX Philosophy: Do one thing and do it well."
 
 # Test 1:
 echo "Test 1"
 
-pbmtextps -dump-ps ${text} > ${text_ps}
+pbmtextps -dump-ps ${text} > ${text1_ps}
 
 # Font name is random sequence of alphanumerical characters.
 # Should not match any real name.
@@ -34,10 +34,28 @@ for flag in \
   "-stroke 1"
   do
   echo ${flag}
-  pbmtextps -dump-ps ${flag} ${text} | diff ${text_ps} - | grep "^[<>]"
+  pbmtextps -dump-ps ${flag} ${text} | diff ${text1_ps} - | grep "^[<>]"
   done
 
-rm ${text_ps}
+rm ${text1_ps}
+
+
+# Test 2:
+echo "Test 2"
+
+pbmtextps -dump-ps "012 ABC-xyz." > ${text2_ps}
+
+for hextext in \
+  "30 31 32  20	 41 42 43  2d	78 79 7a  2e" \
+  "303132204142432d78797a2e" \
+  "<303132 20 414243 2d 78797a 2e>" 
+  do
+  echo ${hextext}
+  pbmtextps -dump-ps -asciihex ${hextext} | diff ${text2_ps} - | grep "^[<>]"
+  echo $?
+  done
+
+rm ${text2_ps}
 
 
 echo "Test Invalid"
@@ -69,7 +87,7 @@ for error_flag in \
   "-descent" \
   "-descent -1" \
   "-stroke=A" \
-  "-pad -crop" 
+  "-pad -crop"
   do
     pbmtextps ${error_flag} -dump-ps ${text} >${test_out} || \
     printf "Expected failure $n (${error_flag})";
@@ -78,6 +96,40 @@ for error_flag in \
     n=$((n + 1))
   done
 
+for asciihex_string in \
+  "<a>" \
+  "" \
+  "<53756c667572" \
+  "53756c667572>" \
+  "<5375<6c667572>" \
+  "<53756c>667572>"
+  do
+    pbmtextps -dump-ps -asciihex ${asciihex_string} >${test_out} || \
+    printf "Expected failure $n (-asciihex ${asciihex_string})";
+    test -s ${test_out}; echo " "$?
+    rm -f ${test_out}
+    n=$((n + 1))
+  done
+
+for ascii85_string in \
+  '<~@<6O!FD5W(~'\
+  '~@<6O!FD5W(~>'\
+  "<~@<6O<~!FD5W(~>"\
+  "<~@<6O~>!FD5W(~>"\
+  "<~@<6O!FD5W(~~>"\
+  "v"\
+  "y"\
+  "1z"\
+  "z1z"\
+  "<~0123z~>"
+  do
+    pbmtextps -dump-ps -ascii85 ${ascii85_string} >${test_out} || \
+    printf "Expected failure $n (-ascii85 ${ascii85_string})";
+    test -s ${test_out}; echo " "$?
+    rm -f ${test_out}
+    n=$((n + 1))
+  done
+
   pbmtextps -font="" -dump-ps ${text} >${test_out} || \
   printf "Expected failure $n (-font=\"\")";
   test -s ${test_out}; echo " "$?
diff --git a/test/pbmtextps.ok b/test/pbmtextps.ok
index d407cb0a..2063ac4a 100644
--- a/test/pbmtextps.ok
+++ b/test/pbmtextps.ok
@@ -4,7 +4,9 @@ Test 1.  Should print 0 five times.
 0
 0
 0
-Test 2.  Should print P1 1 1 0 three times
+Test 2.  Should print P1 1 1 0 five times
+P1 1 1 0 
+P1 1 1 0 
 P1 1 1 0 
 P1 1 1 0 
 P1 1 1 0 
diff --git a/test/pbmtextps.test b/test/pbmtextps.test
index 975f960c..55f3f96a 100755
--- a/test/pbmtextps.test
+++ b/test/pbmtextps.test
@@ -24,7 +24,7 @@ pbmtextps -descent=2 ${text} | cmp -s - ${text_pbm}
 rm ${text_pbm}
 
 
-echo "Test 2.  Should print P1 1 1 0 three times"
+echo "Test 2.  Should print P1 1 1 0 five times"
 # blank images
 
 pbmtextps " " | pnmcrop -plain -blank-image=minimize |\
@@ -32,7 +32,11 @@ pbmtextps " " | pnmcrop -plain -blank-image=minimize |\
 pbmtextps -fontsize=12   " " | pnmcrop -plain -blank-image=minimize |\
   tr '\n' ' ' ; echo
 pbmtextps -resolution=50 " " | pnmcrop -plain -blank-image=minimize |\
-  tr '\n' ' ' ; echo 
+  tr '\n' ' ' ; echo
+pbmtextps -asciihex "20" | pnmcrop -plain -blank-image=minimize |\
+  tr '\n' ' ' ; echo
+pbmtextps -ascii85  "+9" | pnmcrop -plain -blank-image=minimize |\
+  tr '\n' ' ' ; echo
 
 
 
@@ -49,5 +53,3 @@ pbmtextps "+" | pnmcrop -left -right | pbmminkowski | grep "eulerchi"
 pbmtextps "+" | pnmcrop | pbmminkowski | grep "eulerchi"
 
 pbmtextps "o" | pnmcrop | pbmminkowski | grep "eulerchi"
-
-