← 输入框|github.com|刷新
Skip to content

Allow omitted image dimensions in TSX tilesets - #88

Open
civilwarinfrance wants to merge 1 commit into
pythonarcade:developmentfrom
civilwarinfrance:fix/optional-tsx-image-dimensions
Open

civilwarinfrance wants to merge 1 commit into
pythonarcade:developmentfrom
civilwarinfrance:fix/optional-tsx-image-dimensions

Conversation

@civilwarinfrance

Copy link
Copy Markdown

TSX <image> width and height are optional in Tiled's format reference, but both image-based tilesets and image-collection tiles currently index these attributes unconditionally. A valid image with either dimension omitted raises KeyError.

Read each dimension only when present, preserving the model's existing unknown-size defaults. This matches the JSON parser and keeps supplied dimensions and image references intact.

Regression coverage uses public parse_tileset() across both formats, both tileset styles, and all four width/height presence combinations. On the original code, six TSX cases fail and ten controls pass; after the fix all 16 pass. Full suite: 142 passed, 96% coverage. Mypy passes all 27 source files; both changed files pass Black and the new test passes Ruff. Repository-wide lint/formatting findings match the original base (178 Ruff findings and six unrelated files needing Black). Tested on CPython 3.14/macOS ARM64.

AI assistance: implemented and tested with OpenAI Codex (GPT-6).

AI-assisted by Codex (GPT-6).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant