#!/bin/sh
# the postinst downloaded the three level sets, the subgame sounds and
# the wall patterns; the game lists and loads the levels, plays the
# sounds and draws the walls
set -e
cd /usr/share/games/bubbros/bubbob
for f in Arena HouseOfFun LostLevels; do
    test -s levels/fanlevels/$f.bin
done
test "$(find ../nonfree -name '*.wav' | wc -l)" = 14
test "$(find ../nonfree/bubbob/tmp -name 'pat*.ppm' | wc -l)" = 21
python3 - <<'PY'
import os, sys
sys.path[:0] = ['.', '../common']
import bb, binboards, gamesrv
sets = dict(bb.BubBobGame.FnListBoards())
for name in ('Arena', 'HouseOfFun', 'LostLevels'):
    path = sets[name]
    assert path == 'levels/fanlevels/%s.bin' % name, path
    print(name, len(binboards.load(path)), 'levels')
import images
assert '/nonfree/' in images.patdir, images.patdir
print('walls from', os.path.normpath(images.patdir))
for ext in range(1, 8):
    path = gamesrv.soundpath('ext%d/music.wav' % ext)
    assert path and '/nonfree/' in path, path
    print(os.path.normpath(path))
PY
