2014-11-19 16:01:28 +01:00
|
|
|
top_srcdir=@TOP_SRCDIR@
|
2016-05-10 15:48:03 +02:00
|
|
|
PYTHON=@PYTHON@
|
2014-12-20 23:25:19 +01:00
|
|
|
# we need a different tmp for each script since make can run tests in parallel
|
|
|
|
tmp=$top_srcdir/test/tmp-$$
|
2018-07-06 17:11:02 +02:00
|
|
|
test_images=$top_srcdir/test/test-suite/images
|
2016-08-19 10:15:34 +02:00
|
|
|
image=$test_images/йцук.jpg
|
2014-11-19 18:32:29 +01:00
|
|
|
mkdir -p $tmp
|
2014-12-20 18:12:12 +01:00
|
|
|
vips=$top_srcdir/tools/vips
|
|
|
|
vipsthumbnail=$top_srcdir/tools/vipsthumbnail
|
|
|
|
vipsheader=$top_srcdir/tools/vipsheader
|
2016-01-17 10:29:25 +01:00
|
|
|
|
|
|
|
# we need bc to use '.' for a decimal separator
|
|
|
|
export LC_NUMERIC=C
|
2019-10-06 11:55:19 +02:00
|
|
|
|
|
|
|
# test for file format supported
|
|
|
|
test_supported() {
|
|
|
|
format=$1
|
|
|
|
|
|
|
|
if $vips $format > /dev/null 2>&1; then
|
|
|
|
result=0
|
|
|
|
else
|
|
|
|
echo "support for $format not configured, skipping test"
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
return $result
|
|
|
|
}
|
2019-11-24 19:22:43 +01:00
|
|
|
|
|
|
|
# is a difference beyond a threshold? return 0 (meaning all ok) or 1 (meaning
|
|
|
|
# error, or outside threshold)
|
|
|
|
break_threshold() {
|
|
|
|
diff=$1
|
|
|
|
threshold=$2
|
|
|
|
return $(echo "$diff <= $threshold" | bc -l)
|
|
|
|
}
|
|
|
|
|
|
|
|
# subtract, look for max difference less than a threshold
|
|
|
|
test_difference() {
|
|
|
|
before=$1
|
|
|
|
after=$2
|
|
|
|
threshold=$3
|
|
|
|
|
|
|
|
$vips subtract $before $after $tmp/difference.v
|
|
|
|
$vips abs $tmp/difference.v $tmp/abs.v
|
|
|
|
dif=$($vips max $tmp/abs.v)
|
|
|
|
|
|
|
|
if break_threshold $dif $threshold; then
|
|
|
|
echo "save / load difference is $dif"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|