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
|
#!/bin/bash
export LC_ALL=C.UTF-8
if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi
cd "$AUTOPKGTEST_TMP"
# Sample test script to create svg
cat >test.py <<HERE
from railroad import Diagram, Optional, Choice, NonTerminal
d = Diagram(
Optional('+', 'skip'),
Choice(0,
NonTerminal('name-start char'),
NonTerminal('escape')))
f = open('test.svg', 'w+')
d.writeSvg(f.write)
f.close()
HERE
# Run tests in all supported versions of Python
for py in $(py3versions --supported); do
${py} ./test.py
# Ensure file is actually svg
file test.svg | fgrep -q 'SVG'
# Convert to png and test
rsvg-convert -o test.png test.svg
file test.png | fgrep -q 'PNG'
done
|