#!/bin/sh
#
# Test the kate command line tools to ensure they can run without
# returning an error.

set -e

retval=0

success() { echo "success:" "$@"; }
error() { echo "error:" "$@"; retval=1; }

cat > input.srt <<EOF
1
00:00:08,000 --> 00:00:14,000
This is a simple subtext block
that will be encoded into an ogg file.

2
00:00:15,000 --> 00:00:16,000
This is the second subtext block.

EOF

if kateenc -t srt -l cy -c SUB -o output.ogg input.srt ; then
    success "kateenc could encode an SRT file to OGG"
else
    error "unable to run kateenc"
fi

if katalyzer output.ogg ; then
    success "running katalyzer worked"
else
    error "unable to run katalyser"
fi

if katedec output.ogg ; then
    success "running katedec worked"
else
    error"unable to run katedec"
fi

if KateDJ  --version ; then
    success "running KateDJ worked"
else
    error "unable to run KateDJ"
fi

exit $retval
