#!/bin/sh
# autopkgtest: Assert that extension is properly installed/registered

# output list - may return with error, don't exit test
unopkg list --bundled org.parlatype.loextension

# silent or extra info in case of error
unopkg validate --bundled org.parlatype.loextension

REGISTERED=$(unopkg list --bundled org.parlatype.loextension | grep --count -e 'is registered: yes')

EXPECTED=11
# Must return "is registered: yes" for each of these:
#URL: vnd.sun.star.expand:$BUNDLED_EXTENSIONS/parlatype
#URL: vnd.sun.star.expand:$BUNDLED_EXTENSIONS/parlatype/options/ConfigurationSchema.xcs
#URL: vnd.sun.star.expand:$BUNDLED_EXTENSIONS/parlatype/options/ConfigurationData.xcu
#URL: vnd.sun.star.expand:$BUNDLED_EXTENSIONS/parlatype/options/OptionsDialogRegistry.xcu
#URL: vnd.sun.star.expand:$BUNDLED_EXTENSIONS/parlatype/python/components/OptionsDialogHandler.py
#URL: vnd.sun.star.expand:$BUNDLED_EXTENSIONS/parlatype/toolbar/Toolbar.xcu
#URL: vnd.sun.star.expand:$BUNDLED_EXTENSIONS/parlatype/toolbar/WriterWindowState.xcu
#URL: vnd.sun.star.expand:$BUNDLED_EXTENSIONS/parlatype/toolbar/ProtocolHandler.xcu
#URL: vnd.sun.star.expand:$BUNDLED_EXTENSIONS/parlatype/asr/jobs.xcu
#URL: vnd.sun.star.expand:$BUNDLED_EXTENSIONS/parlatype/python/components/ASR.py
#URL: vnd.sun.star.expand:$BUNDLED_EXTENSIONS/parlatype/python/components/Parlatype.py

if [ "$REGISTERED" != "$EXPECTED" ]; then
	echo "Only $REGISTERED of $EXPECTED components registered" 1>&2
else
	echo "OK: All $EXPECTED components are registered"
fi

