Extend test coverage: seed resolution, coordinate invariants, preset shape characteristics #16
Labels
No labels
assets
bug
duplicate
enhancement
help wanted
invalid
question
testing
ui
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
liamjd/UntitledColonyBuilder#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-on from #12, which added GUT and covered seed determinism (PR #15). The framework is in place; these are the remaining properties from the original list plus what setting it up revealed.
The runner and conventions are documented under
## Testsin CLAUDE.md.1. Seed resolution in
main_menu.gd_read_seed_from_ui()has three branches: empty → random, valid integer → literal, anything else →hash(). Both entry paths — the New Game button and Enter in the seed field — must resolve identically.A real bug shipped here. The resolved seed was echoed into the field before resolution, so typing a seed and clicking New Game silently used the previous seed, while pressing Enter honoured it. A test comparing the two paths would have caught it immediately.
The awkward part is that resolution currently lives inside a method that also writes to the UI and mutates
GameState. Testing it may mean separating "resolve a string to a seed" from "apply it", which is worth doing on its own merits — a pureString -> intfunction is trivially testable and has no reason to know aboutLineEditor autoloads.2. Coordinate invariants
Carried from the POC, where they caught real bugs:
surface_y(L) == map_to_local(Vector3i(0, L, 0)).y + level_height— depends oncell_center_y = false, which_configure_grid()sets deliberately and which nothing currently guards. Flipping it would silently sink every pawn and prop half a level into the ground.world_to_cell(cell_to_world(c)) == cfor every cell, including the boundary cells where the clamping inworld_to_cell()is doing the work.level_at()on an out-of-bounds cell returns the datum rather than erroring or reading past the end of_levels.These become load-bearing as soon as anything is placed on the terrain, which is the next feature area.
3. Shape presets are distinguishable
test_presets_differ_from_each_other_under_one_seedalready asserts island ≠ plains. Worth extending to characteristics rather than mere inequality, so a preset degenerating toward plains is caught:Deliberately loose. These are shape sanity checks, not golden-image tests, and they should survive tuning the noise parameters.
Known issue to cover once decided
The island preset nearly drowns at small grid sizes, surfaced by the #12 tests:
_radial()normalises by the grid centre so the shape is scale-independent, butfalloff_startcombined with the water threshold is not. At the default 64 it looks fine, which is why it had not shown up.This needs a decision before it can be tested: either small grids are unsupported (assert a documented minimum) or the falloff should be scale-corrected (assert walkable area stays proportionate across sizes). Note the #12 tests generate at 24x24 for speed, so whichever way this goes, they may need their grid size revisiting.
Out of scope
Rendering.
gl_compatibilitydraws nothing headless, so visual verification stays manual and screenshot-based. CI too — there is no pipeline yet.