#!/bin/sh

#
# This simple test loads a small FITS image, prints it to a postscript file
# and then quits DS9. The FITS file is create by funtools.
#

cd "${AUTOPKGTEST_TMP}"

funimage stdin'[TEXT(x:I:100,y:I:100),cir(50,50,40),point(100,1),-cir(50,50,2)]' \
    tmpfile.fits bitpix=8,mask=all < /dev/null

xvfb-run --server-args="-screen 0 1024x768x24" ds9 tmpfile.fits \
    -print destination file \
    -print filename tmpfile.ps \
    -print \
    -quit

res=$?

ls -l

if [ $res != 0 ] ; then
    echo "Error $res executing ds9"
    exit 1
fi
if [ -s tmpfile.ps ] ; then
    echo "ds9 OK"
    exit 0
else
    echo "ds9 did not create output"
    exit 1
fi
