about summary refs log tree commit diff
path: root/test/targa-roundtrip.test
blob: 4a99e0e0eff3c224c21a54fe9f462e7ec94c6037 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /bin/bash
# This script tests: pamtotga tgatoppm
# Also requires: ppmtopgm pgmtopbm

  alias pamtotga="${PBM_TESTPREFIX}pamtotga"
  alias tgatoppm="${PBM_TESTPREFIX}tgatoppm"
  alias pgmtopbm="${PBM_BINPREFIX}pgmtopbm"
  alias ppmtopgm="${PBM_BINPREFIX}ppmtopgm"
  shopt -s expand_aliases

#Test 1: Should print 2425386270 41, cksum of testgrid.pbm

pamtotga -mono testgrid.pbm | \
  tgatoppm | ppmtopgm | \
  pgmtopbm -threshold -val 0.5 | cksum

#Test 2: Should print 2871603838 33838, cksum of testimg.pgm

ppmtopgm testimg.ppm > ${tmpdir}/testimg.pgm
pamtotga -cmap ${tmpdir}/testimg.pgm | \
  tgatoppm | ppmtopgm | cksum

rm ${tmpdir}/testimg.pgm

#Test 3: Should print 1926073387 101484, cksum of testimg.ppm

pamtotga -rgb testimg.ppm | tgatoppm | cksum