#!/bin/sh
#
# Need the packages mktemp, debconf and python-pygame, the latter two
# for an example image and ogg sound.

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"

echo "info: Generating Ogg Theora file"
${TESTBINDIR}oggSlideshow /usr/share/pixmaps/debian-logo.png

# Join it.
echo "info: Copy Ogg Theora file using oggJoin."
${TESTBINDIR}oggJoin out.ogv slideshow.ogv

# This should trigger the bug reported in bug #606224, which need an
# audio file.
echo "info: Copy Ogg Vorbis file using oggJoin."
${TESTBINDIR}oggJoin out.ogv /usr/lib/python*/dist-packages/pygame/examples/data/house_lo.ogg

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

echo "info: test completed successfully"
