Commit graph

14 commits

Author SHA1 Message Date
Kelsi
9f2e8e1979 test(wob): add 2 string-length reject tests
Locks in the recent silent-corruption fix:
- Overlong building name (5000 > 1024) → load returns invalid
  instead of silently zeroing the length and reading 5000 stale
  bytes as the next group's name+counts.
- Overlong group name (9999 > 1024) → same.

Catches regression of the silent-desync defect that affected 7
length fields across the WoB and WOM loaders.
2026-05-06 09:26:08 -07:00
Kelsi
0bf7c8ac3f test(open-formats): add 2 round-trip cap tests
Locks in the recent save-side count caps:
- WoB save with 1500 texture paths → load reads exactly 1024,
  first/last entries match what was written before the cap fired.
- WOC save with tileX/tileY=200 → load reads tileX/tileY=32
  (clamped at write, no warning on the second reload).

Catches the asymmetry that would silently drop everything past
the load limit.
2026-05-06 09:17:48 -07:00
Kelsi
4d6c65ab73 test(wob): add save-side scrub tests for NaN portals and vertices
Two new round-trip tests verify the save-side hardening:
- NaN portal vertices and out-of-range groupA/groupB indices are
  cleaned by save → load reads back finite verts and groupA/B = -1.
- NaN bld.boundRadius, group bounds, and vertex position/normal
  are scrubbed to safe defaults (1.0 boundRadius, zero pos, +Z up).

Locks in the recent WoB scrub work and ensures the on-disk format
stays self-consistent.
2026-05-06 09:00:03 -07:00
Kelsi
19e479a8ff test(open-formats): add WOB doodad NaN scrub test
Verifies the recent WOB doodad-transform sanitize. A WOB with NaN
position/rotation/scale on a doodad should load with the doodad
zeroed out (position/rotation 0, scale 1). Prevents regressing
the GPU crash that NaN model matrices would cause.
2026-05-06 07:21:20 -07:00
Kelsi
a16689f7fa test(open-formats): add hardening tests + fix existing liquidType assertion
The existing WOT round-trip test asserted liquidType==5; the recent
commit clamped >3 to 0, so the test would have failed once rebuilt.
Updated the test data to use type=3 (slime, in valid range).

Adds 5 new hardening test cases:
- WOT clamps OOR tileX/tileY to 32
- WOT clamps OOR water liquidType to 0
- WOC load skips degenerate triangles
- WOC rejects > 2M triangle headers
- WOC clamps OOR tileX/tileY to 32

Catches regressions in the defensive bounds added across recent
commits.
2026-05-06 07:19:40 -07:00
Kelsi
d5bbc28fe1 test(wob): cover toWMOModel material dedupe / portal / doodad / doodadSet
New TEST_CASE exercises the full toWMOModel restore path: materials
deduped across groups, outdoor flag preserved per group, portal vertex
+ groupA/groupB refs reconstructed, doodad path .wom->.m2 conversion,
default doodadSet emission. 113 assertions across 16 test cases now.
2026-05-06 03:28:40 -07:00
Kelsi
ee686051a5 test(woc): cover addMesh slope classification + extra-flag preservation
Two new TEST_CASEs verify WoweeCollisionBuilder::addMesh marks flat
triangles walkable and steep ones not, and that caller-supplied flags
(e.g. indoor 0x08) are OR'd onto the slope-derived flags. 98 assertions
across 15 test cases now.
2026-05-06 02:44:47 -07:00
Kelsi
59a6c22625 test(wom): add WOM3 magic-distinctness check 2026-05-06 01:27:14 -07:00
Kelsi
b439f12c36 fix: WOM2 bone data in client renderer, WOM tests, docs update
- Fix WOM→M2Model conversion: copy boneWeights/boneIndices from WOM2
  vertices (was dropping skeletal binding data, breaking animation)
- Copy bone hierarchy and animation sequences from WOM2 to M2Model
  so animated WOM2 models render with proper skeletal deformation
- Add 3 WOM format tests: WOM1 binary structure, WOM2 magic check,
  invalid magic rejection (6 new assertions)
- CHANGELOG: document WOM1/WOM2 animated model support
- README: clarify WOM1 (static) vs WOM2 (animated) models
- 334 total assertions across 87 test cases
2026-05-05 16:23:22 -07:00
Kelsi
4d5eef480e feat: WOC collision mesh format — 7th novel open format
New format: WOC (Wowee Open Collision) — binary collision mesh for
custom zone walkability. Magic WOC1 (0x31434F57).

- WoweeCollisionBuilder::fromTerrain() generates collision triangles
  from terrain heightmap with slope classification (50 deg threshold)
- Per-triangle flags: walkable (0x01), water (0x02), steep (0x04)
- Respects terrain holes (skips triangles in hole regions)
- Binary save/load with bounds, tile coords, triangle data
- Auto-exported on zone save alongside WOT/WHM/WOM/WOB
- Added to content pack validation (score now 0-7)
- FORMAT_SPEC.md v1.1 updated with WOC binary layout
- 19 new test assertions: flat terrain generation (32k tris all
  walkable), save/load round-trip, hole skipping
- 328 total assertions across 84 test cases
2026-05-05 15:23:58 -07:00
Kelsi
961d863f82 fix: shell injection in gitCommit projectDir, test directory cleanup
- gitCommit() now uses double quotes for projectDir consistently with
  gitPush/gitPull/gitStatus (was single quotes, breaking on paths with
  apostrophes like "John's Project")
- Test suite auto-cleans test_output_formats/ directory via Catch2
  event listener after all tests complete (was leaving empty dir)
2026-05-05 15:16:20 -07:00
Kelsi
22fb509416 test: WOT metadata round-trip with doodad/WMO placements
Comprehensive test for WOT JSON metadata parsing: verifies tile coords,
texture list, chunk layers with holes, water data, doodad names and
placements (nameId, uniqueId, position, rotation, scale, flags), and
WMO names and placements (nameId, uniqueId, position, rotation, flags,
doodadSet) all survive the export→load cycle.

31 new assertions. Total: 309 assertions across 81 test cases.
All open format round-trips now have test coverage.
2026-05-05 15:06:39 -07:00
Kelsi
47eff19cb6 feat: WOB material serialization, FORMAT_SPEC v1.1, material tests
- WOB save/load now serializes Material struct fields (flags, shader,
  blendMode, texturePath) per group — was saving only texture paths
- FORMAT_SPEC.md v1.1: documents WOT doodad/WMO placements, WOB
  material fields, doodad rotation, terrain stamps, WCP file list
- Test coverage: 5 new assertions verify material round-trip (flags,
  shader, blendMode all preserved through save→load cycle)
- 260 total assertions across 75 test cases, all passing
2026-05-05 14:53:28 -07:00
Kelsi
9e33ad645c test: add unit tests for WOB and WHM open format round-trips
- WOB save/load round-trip: verifies groups, vertices, indices,
  portals, doodad placements with rotation and scale preservation
- WOB toWMOModel conversion: verifies WOB→WMO geometry bridge works
- WHM heightmap save/load: verifies 256-chunk terrain with per-vertex
  height data round-trips correctly through binary format
- WHM invalid magic rejection: verifies corrupt files are rejected
- WOB missing file rejection: verifies graceful failure
- 29 new assertions across 5 test cases
2026-05-05 14:49:05 -07:00