#!/bin/sh
#
# Need the package mktemp and python-mecavideo
# Based on <URL: https://bugs.launchpad.net/ubuntu/+source/oggvideotools/+bug/1462697 >
# This test does not trigger the reported bug, but test oggCut that do
# not crash.  To crash, a different input file is needed, as only some
# files seem cause the crash.

set -e
at_exit() {
    set +x
    echo "info: test exiting, removing $WORKDIR"
    rm -rf $WORKDIR
}
WORKDIR=$(mktemp -d)
trap at_exit INT TERM EXIT
set -x

cd $WORKDIR

echo "info: Running autopkgtest script $0"

input=/usr/share/python-mecavideo/video/Effet_force_magnetique.ogv

${TESTBINDIR}oggCut -s 500 -e 1000 "$input" out.ogv

if [ -e out.ogv ] ; then
   echo "success: Ogg Theora file out.ogv created."
else
   echo "error: No Ogg Theora file created by oggCut."
   exit 1
fi

echo "info: test completed successfully"
