From 6caa53058399bdb2fa59885472588b39be621be8 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Wed, 1 Feb 2017 02:26:22 +0000 Subject: Adapt test of ppmchange.c to recent change in rounding git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2886 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- test/ppmchange.ok | 9 +++++++-- test/ppmchange.test | 39 +++++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/test/ppmchange.ok b/test/ppmchange.ok index 130c3c45..aba3a7a8 100644 --- a/test/ppmchange.ok +++ b/test/ppmchange.ok @@ -1,4 +1,9 @@ 22488533 203 1008787190 613 -3885709071 613 -2101746192 613 +1983174784 613 +2146447222 613 +1216791938 613 + 0 0 0 0 78 + 0 0 255 29 40 + 0 50 2 30 41 + 100 0 1 30 41 diff --git a/test/ppmchange.test b/test/ppmchange.test index 397b290f..a749a5d2 100755 --- a/test/ppmchange.test +++ b/test/ppmchange.test @@ -1,6 +1,6 @@ #! /bin/bash # This script tests: ppmchange -# Also requires: ppmrainbow pgmramp +# Also requires: ppmrainbow pgmramp ppmhist # Failure message @@ -10,9 +10,10 @@ tmpdir=${tmpdir:-/tmp} rainbow_ppm=${tmpdir}/rainbow.ppm +changed_ppm=${tmpdir}/changed.ppm -# Explicit values for intermediate colors: rgb.txt may be defining them -# in unusual ways. +# Explicit values for intermediate colors: rgb.txt may not be the one +# Netpbm provides; they may be defined in unusual ways. brown=rgb:67/43/00 cyan=rgb:00/ff/ff @@ -20,7 +21,7 @@ yellow=rgb:ff/ff/00 gray=rgb:7f/7f/7f -# Test 1. Should print 811868957 60 +# Test 1. Should print 22488533 203 pgmramp -lr 8 8 | ppmchange black black white white $gray $gray \ -close=10 -remainder=blue | cksum @@ -31,29 +32,31 @@ ppmrainbow -tmpdir=$tmpdir -width=200 -height=1 red green blue | \ tee ${rainbow_ppm} | \ ppmchange red $brown green $brown blue $brown | cksum +# Validate ${rainbow_ppm} +# Should print 1983174784 613 -# Test 3. Should print 3885709071 613 +cat ${rainbow_ppm} | cksum + + +# Test 3. Should print 2146447222 613 ppmchange red $brown green $cyan blue $yellow \ -closeness=25 ${rainbow_ppm} | cksum -# Test 4. Should print 2101746192 613 +# Test 4. Should print 1216791938 613 ppmchange red rgb:64/00/01 rgb:00/ff/00 rgb:00/32/02 blue blue \ - -remainder=black -closeness=25 ${rainbow_ppm} | cksum + -remainder=black -closeness=25 ${rainbow_ppm} | tee ${changed_ppm} | cksum -rm ${rainbow_ppm} +# Produce a histogram of the colors in the output image +# Should produce +# 0 0 0 0 78 +# 0 0 255 29 40 +# 0 50 2 30 41 +# 100 0 1 30 41 +ppmhist -sort=rgb -noheader ${changed_ppm} -# cksum ${rainbow_ppm} -# 1983174784 613 rainbow.ppm -# ppmchange red rgb:64/00/01 rgb:00/ff/00 rgb:00/32/02 blue blue \ -# -remainder=black -closeness=25 ${rainbow_ppm} | \ -# pphist -sort=rgb -noheader -# -# 0 0 0 0 75 -# 0 0 255 29 42 -# 0 50 2 30 42 -# 100 0 1 30 41 +rm ${rainbow_ppm} ${changed_ppm} -- cgit 1.4.1