#!/bin/sh
# Build and run the upstream test suite against the installed library.

set -e

cp -a TestAPI "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP/TestAPI"

# The suite enables its per-format tests with the FREEIMAGE_WITH_LIB*
# macros that upstream's CMake build passes; set them for the formats the
# Debian package supports (JPEG XL is disabled in debian/rules).
g++ -DFREEIMAGE_WITH_LIBJPEG=1 \
    -DFREEIMAGE_WITH_LIBTIFF=1 \
    -DFREEIMAGE_WITH_LIBPNG=1 \
    -DFREEIMAGE_WITH_LIBJXR=1 \
    -DFREEIMAGE_WITH_LIBHEIF=1 \
    *.cpp -lfreeimage -o test-freeimage
./test-freeimage
