#!/usr/bin/env bash # Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License. # See LICENSE.md for license information. # SPDX-License-Identifier: MIT # # check-tiled.sh - Host gate for tools/tiled2joey.py, which turns a map # made in Tiled into a tile sheet (baked into tile banks by assetbake.py) and # one jlTileMapPaste map per tile layer (docs/Assets.adoc). tests/host/ # tiledCheck.py writes one map as TMX and as TMJ, with every flip Tiled can # ask for, two tilesets (one external, with a margin and spacing), and every # layer encoding the tool reads; both must convert to the sheet and maps # worked out by hand, the sheet must bake, and maps it cannot take (16x16 # tiles, an RGB tileset) must be refused. # # Usage: scripts/check-tiled.sh # Exit: 0 PASS, 1 FAIL set -uo pipefail repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) label=check-tiled work=$(mktemp -d -t joeylib-tiled.XXXXXX) trap 'rm -rf "$work"' EXIT out=$(python3 "$repo/tests/host/tiledCheck.py" "$repo" "$work") status=$? echo "$out" checks=$(grep -c '^TILED:' <<< "$out") if [ "$status" -ne 0 ]; then echo "$label: FAIL ($(grep -c 'FAIL' <<< "$out") of $checks checks failed)" exit 1 fi echo "$label: PASS ($checks checks: TMX and TMJ, every flip, two tilesets, three layer encodings, the bake, two refusals)" exit 0