summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/tests/check-conv
blob: 5c352e68f1780146ea1c08a6f23a98684d304aea (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# This file is part of the dvisvgm package and published under the 
# terms of the GNU General Public License version 3 or later.
# See file COPYING for further details.
# Copyright (C) 2009-2024 Martin Gieseking <martin.gieseking@uos.de>


files=(sample frktest)
state=0

BLUE="\E[0;34m"
GREEN="\E[0;32m"
RED="\E[0;31m"
COLOR_OFF="\E[0m"

if [ \! -e enable-check-conv ]; then
	echo -e "${BLUE}conversion checks skipped${COLOR_OFF}"
	exit 0
fi

for f in ${files[@]}; do
	for m in "wf" "nf"; do
		infile=${srcdir}/$f
		outfile=$f-$m.svg
		cmpfile=${srcdir}/$f-$m-cmp.svg
		if [ $m = "wf" ]; then
			../src/dvisvgm -v0 -o$outfile $infile
		else
			../src/dvisvgm -v0 -n  -o$outfile $infile
		fi
		xsltproc --novalid ${srcdir}/normalize.xsl $outfile | xmllint --format - >tmp1.svg
		xsltproc --novalid ${srcdir}/normalize.xsl $cmpfile | xmllint --format - >tmp2.svg
		mv tmp1.svg $outfile

		diff $outfile tmp2.svg >$f-$m.diff #>/dev/null
		if [ $? -ne 0 ]; then
			echo -en "${RED}FAILED $COLOR_OFF"
			state=1
		else
			echo -en "${GREEN}PASSED $COLOR_OFF"
			rm $outfile
		fi
		echo "converting $f.dvi (mode $m)"
		if [ \! -s $f-$m.diff ]; then
			rm $f-$m.diff
		fi
		rm tmp2.svg
	done
done
exit $state