fax_tests.sh 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. #!/bin/sh
  2. #
  3. # spandsp fax tests
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU Lesser General Public License version 2.1,
  7. # as published by the Free Software Foundation.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Lesser General Public
  15. # License along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. run_fax_test()
  18. {
  19. rm -f fax_tests.tif
  20. echo ./fax_tests ${OPTS} -i ${FILE}
  21. ./fax_tests ${OPTS} -i ${FILE} >xyzzy 2>xyzzy2
  22. RETVAL=$?
  23. if [ $RETVAL != 0 ]
  24. then
  25. echo fax_tests failed!
  26. exit $RETVAL
  27. fi
  28. # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
  29. # option means the normal differences in tags will be ignored.
  30. ${TIFFCMP} -t ${FILE} fax_tests.tif >/dev/null
  31. RETVAL=$?
  32. if [ $RETVAL != 0 ]
  33. then
  34. echo fax_tests failed!
  35. exit $RETVAL
  36. fi
  37. rm -f fax_tests.tif
  38. echo tested ${FILE}
  39. }
  40. run_fax_squash_test()
  41. {
  42. # Test with lengthwise squashing of a bilevel image
  43. rm -f fax_tests.tif
  44. echo ./fax_tests -b ${SQ} -b ${SQ} ${OPTS} -i ${IN_FILE}
  45. ./fax_tests -b ${SQ} ${OPTS} -i ${IN_FILE} >xyzzy 2>xyzzy2
  46. RETVAL=$?
  47. if [ $RETVAL != 0 ]
  48. then
  49. echo fax_tests failed!
  50. exit $RETVAL
  51. fi
  52. # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
  53. # option means the normal differences in tags will be ignored.
  54. ${TIFFCMP} -t ${OUT_FILE} fax_tests.tif >/dev/null
  55. RETVAL=$?
  56. if [ $RETVAL != 0 ]
  57. then
  58. echo fax_tests failed!
  59. exit $RETVAL
  60. fi
  61. rm -f fax_tests.tif
  62. echo tested ${FILE}
  63. }
  64. run_colour_fax_test()
  65. {
  66. rm -f fax_tests.tif
  67. echo ./fax_tests ${OPTS} -i ${IN_FILE}
  68. ./fax_tests ${OPTS} -i ${IN_FILE} >xyzzy 2>xyzzy2
  69. RETVAL=$?
  70. if [ $RETVAL != 0 ]
  71. then
  72. echo fax_tests failed!
  73. exit $RETVAL
  74. fi
  75. # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
  76. # option means the normal differences in tags will be ignored.
  77. ${TIFFCMP} -t ${OUT_FILE} fax_tests.tif >/dev/null
  78. RETVAL=$?
  79. if [ $RETVAL != 0 ]
  80. then
  81. echo fax_tests failed!
  82. exit $RETVAL
  83. fi
  84. rm -f fax_tests.tif
  85. echo tested ${IN_FILE} to ${OUT_FILE}
  86. }
  87. ITUTESTS_DIR=../test-data/itu/fax
  88. TIFFFX_DIR=../test-data/itu/tiff-fx
  89. LOCALTESTS_DIR=../test-data/local
  90. TIFFCMP=tiffcmp
  91. # Colour/gray -> bilevel by not allowing ECM
  92. #for OPTS in "-p FAX-FAX" "-p T38-T38" "-p FAX-T38gateway-T38gateway-FAX" "-p T38-T38gateway-FAX" "-p FAX-T38gateway-T38"
  93. #do
  94. # IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
  95. # OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-bilevel.tif"
  96. # run_colour_fax_test
  97. # IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif"
  98. # OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif"
  99. # run_colour_fax_test
  100. # IN_FILE="${TIFFFX_DIR}/c03x_02x.tif"
  101. # OUT_FILE="${TIFFFX_DIR}/c03x_02x-bilevel.tif"
  102. # run_colour_fax_test
  103. # IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
  104. # OUT_FILE="${TIFFFX_DIR}/l02x_02x-bilevel.tif"
  105. # run_colour_fax_test
  106. # IN_FILE="${TIFFFX_DIR}/l04x_02x.tif"
  107. # OUT_FILE="${TIFFFX_DIR}/l04x_02x-bilevel.tif"
  108. # run_colour_fax_test
  109. #done
  110. # Colour/gray -> colour/gray
  111. #for OPTS in "-p FAX-FAX -C -e" "-p T38-T38 -C -e" "-p FAX-T38gateway-T38gateway-FAX -C -e" "-p T38-T38gateway-FAX -C -e" "-p FAX-T38gateway-T38 -C -e"
  112. #do
  113. # IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
  114. # OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-out.tif"
  115. # run_colour_fax_test
  116. # IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif"
  117. # OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-out.tif"
  118. # run_colour_fax_test
  119. # IN_FILE="${TIFFFX_DIR}/c03x_02x.tif"
  120. # OUT_FILE="${TIFFFX_DIR}/c03x_02x-out.tif"
  121. # run_colour_fax_test
  122. # IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
  123. # OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif"
  124. # run_colour_fax_test
  125. # IN_FILE="${TIFFFX_DIR}/l04x_02x.tif"
  126. # OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif"
  127. # run_colour_fax_test
  128. #done
  129. # Bi-level tests with image squashing
  130. for OPTS in "-p FAX-FAX" "-p FAX-FAX -e" "-p T38-T38" "-p T38-T38 -e" "-p FAX-T38gateway-T38gateway-FAX" "-p FAX-T38gateway-T38gateway-FAX -e" "-p T38-T38gateway-FAX" "-p T38-T38gateway-FAX -e" "-p FAX-T38gateway-T38" "-p FAX-T38gateway-T38 -e"
  131. do
  132. IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_A4.tif"
  133. OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_A4.tif"
  134. SQ=4
  135. run_fax_squash_test
  136. IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_B4.tif"
  137. OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_B4.tif"
  138. SQ=4
  139. run_fax_squash_test
  140. IN_FILE="${ITUTESTS_DIR}/bilevel_R8_77_A3.tif"
  141. OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_77SQ_A3.tif"
  142. SQ=4
  143. run_fax_squash_test
  144. IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A4.tif"
  145. OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_A4.tif"
  146. SQ=3
  147. run_fax_squash_test
  148. IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_B4.tif"
  149. OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_B4.tif"
  150. SQ=3
  151. run_fax_squash_test
  152. IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A3.tif"
  153. OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQ_A3.tif"
  154. SQ=3
  155. run_fax_squash_test
  156. IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A4.tif"
  157. OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_A4.tif"
  158. SQ=4
  159. run_fax_squash_test
  160. IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_B4.tif"
  161. OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_B4.tif"
  162. SQ=4
  163. run_fax_squash_test
  164. IN_FILE="${ITUTESTS_DIR}/bilevel_R8_154_A3.tif"
  165. OUT_FILE="${ITUTESTS_DIR}/bilevel_R8_154SQSQ_A3.tif"
  166. SQ=4
  167. run_fax_squash_test
  168. IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_A4.tif"
  169. OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_A4.tif"
  170. SQ=4
  171. run_fax_squash_test
  172. IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_B4.tif"
  173. OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_B4.tif"
  174. SQ=4
  175. run_fax_squash_test
  176. IN_FILE="${ITUTESTS_DIR}/bilevel_200_200_A3.tif"
  177. OUT_FILE="${ITUTESTS_DIR}/bilevel_200_200SQ_A3.tif"
  178. SQ=4
  179. run_fax_squash_test
  180. IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A4.tif"
  181. OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_A4.tif"
  182. SQ=3
  183. run_fax_squash_test
  184. IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_B4.tif"
  185. OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_B4.tif"
  186. SQ=3
  187. run_fax_squash_test
  188. IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A3.tif"
  189. OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQ_A3.tif"
  190. SQ=3
  191. run_fax_squash_test
  192. IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A4.tif"
  193. OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_A4.tif"
  194. SQ=4
  195. run_fax_squash_test
  196. IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_B4.tif"
  197. OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_B4.tif"
  198. SQ=4
  199. run_fax_squash_test
  200. IN_FILE="${ITUTESTS_DIR}/bilevel_200_400_A3.tif"
  201. OUT_FILE="${ITUTESTS_DIR}/bilevel_200_400SQSQ_A3.tif"
  202. SQ=4
  203. run_fax_squash_test
  204. done
  205. # Bi-level tests
  206. for OPTS in "-p FAX-FAX" "-p FAX-FAX -e" "-p T38-T38" "-p T38-T38 -e" "-p FAX-T38gateway-T38gateway-FAX" "-p FAX-T38gateway-T38gateway-FAX -e" "-p T38-T38gateway-FAX" "-p T38-T38gateway-FAX -e" "-p FAX-T38gateway-T38" "-p FAX-T38gateway-T38 -e"
  207. do
  208. FILE="${ITUTESTS_DIR}/itutests.tif"
  209. run_fax_test
  210. FILE="${ITUTESTS_DIR}/100pages.tif"
  211. run_fax_test
  212. FILE="${ITUTESTS_DIR}/striped.tif"
  213. run_fax_test
  214. FILE="${ITUTESTS_DIR}/mixed_size_pages.tif"
  215. run_fax_test
  216. FILE="${ITUTESTS_DIR}/bilevel_R8_385_A4.tif"
  217. run_fax_test
  218. FILE="${ITUTESTS_DIR}/bilevel_R8_385_B4.tif"
  219. run_fax_test
  220. FILE="${ITUTESTS_DIR}/bilevel_R8_385_A3.tif"
  221. run_fax_test
  222. FILE="${ITUTESTS_DIR}/bilevel_R8_77_A4.tif"
  223. run_fax_test
  224. FILE="${ITUTESTS_DIR}/bilevel_R8_77_B4.tif"
  225. run_fax_test
  226. FILE="${ITUTESTS_DIR}/bilevel_R8_77_A3.tif"
  227. run_fax_test
  228. FILE="${ITUTESTS_DIR}/bilevel_R8_154_A4.tif"
  229. run_fax_test
  230. FILE="${ITUTESTS_DIR}/bilevel_R8_154_B4.tif"
  231. run_fax_test
  232. FILE="${ITUTESTS_DIR}/bilevel_R8_154_A3.tif"
  233. run_fax_test
  234. FILE="${ITUTESTS_DIR}/bilevel_R16_154_A4.tif"
  235. run_fax_test
  236. FILE="${ITUTESTS_DIR}/bilevel_R16_154_B4.tif"
  237. run_fax_test
  238. FILE="${ITUTESTS_DIR}/bilevel_R16_154_A3.tif"
  239. run_fax_test
  240. FILE="${ITUTESTS_DIR}/bilevel_200_100_A4.tif"
  241. run_fax_test
  242. FILE="${ITUTESTS_DIR}/bilevel_200_100_B4.tif"
  243. run_fax_test
  244. FILE="${ITUTESTS_DIR}/bilevel_200_100_A3.tif"
  245. run_fax_test
  246. FILE="${ITUTESTS_DIR}/bilevel_200_200_A4.tif"
  247. run_fax_test
  248. FILE="${ITUTESTS_DIR}/bilevel_200_200_B4.tif"
  249. run_fax_test
  250. FILE="${ITUTESTS_DIR}/bilevel_200_200_A3.tif"
  251. run_fax_test
  252. FILE="${ITUTESTS_DIR}/bilevel_200_400_A4.tif"
  253. run_fax_test
  254. FILE="${ITUTESTS_DIR}/bilevel_200_400_B4.tif"
  255. run_fax_test
  256. FILE="${ITUTESTS_DIR}/bilevel_200_400_A3.tif"
  257. run_fax_test
  258. FILE="${ITUTESTS_DIR}/bilevel_300_300_A4.tif"
  259. run_fax_test
  260. FILE="${ITUTESTS_DIR}/bilevel_300_300_B4.tif"
  261. run_fax_test
  262. FILE="${ITUTESTS_DIR}/bilevel_300_300_A3.tif"
  263. run_fax_test
  264. FILE="${ITUTESTS_DIR}/bilevel_300_600_A4.tif"
  265. run_fax_test
  266. FILE="${ITUTESTS_DIR}/bilevel_300_600_B4.tif"
  267. run_fax_test
  268. FILE="${ITUTESTS_DIR}/bilevel_300_600_A3.tif"
  269. run_fax_test
  270. FILE="${ITUTESTS_DIR}/bilevel_400_400_A4.tif"
  271. run_fax_test
  272. FILE="${ITUTESTS_DIR}/bilevel_400_400_B4.tif"
  273. run_fax_test
  274. FILE="${ITUTESTS_DIR}/bilevel_400_400_A3.tif"
  275. run_fax_test
  276. FILE="${ITUTESTS_DIR}/bilevel_400_800_A4.tif"
  277. run_fax_test
  278. FILE="${ITUTESTS_DIR}/bilevel_400_800_B4.tif"
  279. run_fax_test
  280. FILE="${ITUTESTS_DIR}/bilevel_400_800_A3.tif"
  281. run_fax_test
  282. FILE="${ITUTESTS_DIR}/bilevel_600_600_A4.tif"
  283. run_fax_test
  284. FILE="${ITUTESTS_DIR}/bilevel_600_600_B4.tif"
  285. run_fax_test
  286. FILE="${ITUTESTS_DIR}/bilevel_600_600_A3.tif"
  287. run_fax_test
  288. FILE="${ITUTESTS_DIR}/bilevel_600_1200_A4.tif"
  289. run_fax_test
  290. FILE="${ITUTESTS_DIR}/bilevel_600_1200_B4.tif"
  291. run_fax_test
  292. FILE="${ITUTESTS_DIR}/bilevel_600_1200_A3.tif"
  293. run_fax_test
  294. FILE="${ITUTESTS_DIR}/bilevel_1200_1200_A4.tif"
  295. run_fax_test
  296. FILE="${ITUTESTS_DIR}/bilevel_1200_1200_B4.tif"
  297. run_fax_test
  298. FILE="${ITUTESTS_DIR}/bilevel_1200_1200_A3.tif"
  299. run_fax_test
  300. done
  301. echo
  302. echo All fax tests successfully completed