#!/bin/bash

set -e

readonly input_dia=./samples/chronograms.dia
readonly output_svg=chronograms.svg
readonly err=dia.err

# Export a dia file to SVG
dia --export=$output_svg $input_dia 2> $err

# The previous commands writes to stderr. To not trigger autopkgtest failure,
# write to a file and dump its content to stderr, without the expected line
grep -v "$input_dia --> $output_svg" $err 1>&2 || true


# Do not compare the content of the generated SVG file, because few numbers
# change a bit on different architectures...
[[ "$(file $output_svg)" == "$output_svg: SVG XML document" ]]
[[ "$(cat $output_svg | wc -l)" == 77 ]]
