tools/test_window.sh runs the game under the window class "TableTower Test" (via a temporary override.cfg) so a KWin window rule can keep automated screenshot runs unfocused and behind other windows, without affecting normal playtests from the editor. Also ignore override.cfg and agent worktrees. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
984 B
Bash
Executable file
22 lines
984 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# Runs TableTower in a window for automated checks (screenshots, smoke tests).
|
|
#
|
|
# While it runs, a temporary override.cfg renames the project to "TableTower Test",
|
|
# so its window class is "TableTower Test". A KWin window rule keeps windows of
|
|
# that class in the background without focus. The file is removed on exit, so
|
|
# normal runs from the editor are unaffected.
|
|
#
|
|
# Usage: tools/test_window.sh [project dir] -- [user args, e.g. --screenshot=/tmp/x.png]
|
|
set -euo pipefail
|
|
GODOT="${GODOT:-$HOME/apps/Godot_v4.7.2-stable_linux.x86_64}"
|
|
PROJECT="$(pwd)"
|
|
if [[ $# -gt 0 && "$1" != "--" ]]; then PROJECT="$(cd "$1" && pwd)"; shift; fi
|
|
[[ "${1:-}" == "--" ]] && shift
|
|
OVERRIDE="$PROJECT/override.cfg"
|
|
if [[ -e "$OVERRIDE" ]]; then
|
|
echo "override.cfg already exists in $PROJECT; is another test window running?" >&2
|
|
exit 1
|
|
fi
|
|
printf '[application]\n\nconfig/name="TableTower Test"\n' > "$OVERRIDE"
|
|
trap 'rm -f "$OVERRIDE"' EXIT
|
|
"$GODOT" --path "$PROJECT" -- "$@"
|