diff options
author | Marius Kintel <marius@kintel.net> | 2011-08-05 01:48:35 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-08-05 01:48:35 (GMT) |
commit | b9608dd2f8cae5f7e9c22e5feacfe8b58715ffae (patch) | |
tree | 4633890a807184b191fe74d28b7c614c4e7c1b4a /tests/compare-bitmaps.sh | |
parent | 0340d4e0a1e3e8a74fdc13d04079d384f7906247 (diff) |
Implemented rudimentary image compare for OpenCSG regression tests
Diffstat (limited to 'tests/compare-bitmaps.sh')
-rwxr-xr-x | tests/compare-bitmaps.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/compare-bitmaps.sh b/tests/compare-bitmaps.sh new file mode 100755 index 0000000..590d0b5 --- /dev/null +++ b/tests/compare-bitmaps.sh @@ -0,0 +1,31 @@ +#!/bin/sh + + +while getopts 'v' c +do + case $c in + v) set -x ;; + esac +done + +shift $(($OPTIND - 1)) + +# FIXME: Sometimes, compare fails when comparing very small images (e.g. 40 x 10 pixels). +# It's unknown why this happens.. +pixelerror=`compare -fuzz 10% -metric AE $1 $2 null: 2>&1` +if [ $? -ne 0 ]; then + echo "General error: Ouch" + exit 1 # Compare failed to read image +else + # Check if $pixelerror contains an integer (it sometimes outputs things like '0 @ 0,0') + if [ $pixelerror -eq $pixelerror 2> /dev/null ]; then + if [ $pixelerror == 0 ]; then + exit 0 + fi + echo "Pixel error: $pixelerror" + else + echo "Pixel error: Err" + fi + exit 1 +fi +exit 0 |