Conversation
Add comprehensive tests for all export formats using meshes generated by marching cubes and voxel algorithms: - STL: sphere mesh export, normal directions, face structure validation, coordinate preservation - OBJ: sphere mesh export, index validation, surface extraction, vertex precision - VTK: voxel mesh export, cell index range validation, shared vertices - glTF/GLB: sphere mesh export, chunk structure parsing, accessor counts, min/max bounds, two-chunk validation - Quantized GLB: sphere mesh export, node matrix presence, i16 min/max, binary buffer size, side-by-side comparison with regular GLB Test count: 80 -> 104 (+24 new tests) Closes #45 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Expands the exporter test suite by generating more realistic meshes (marching-cubes sphere and voxel-based tetrahedra) and validating key structural properties of the produced STL/OBJ/VTK/glTF(+quantized) outputs.
Changes:
- Add marching-cubes sphere–based tests for STL, OBJ, glTF, and quantized GLB exporters.
- Add voxel-mesh–based tests and stronger structural validation for VTK exporter output.
- Add additional exporter correctness checks (index validity, chunk/header parsing, facet structure, etc.).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/export/vtk.rs | Adds voxel-mesh–driven VTK tests plus parsing/validation of POINTS/CELLS/CELL_TYPES sections. |
| src/export/stl.rs | Adds marching-cubes STL test and additional validations for normals, facet structure, and coordinate formatting. |
| src/export/obj.rs | Adds marching-cubes OBJ test and validations for index ranges/1-based indexing, surface extraction, and precision presence. |
| src/export/gltf.rs | Adds marching-cubes glTF/GLB tests and additional GLB structural validations (header/chunks/bounds/accessor counts). |
| src/export/gltf_quantized.rs | Adds marching-cubes quantized GLB tests and checks for quantization extension presence, node matrix, i16 min/max, and buffer sizing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #[test] | ||
| fn test_glb_accessor_counts_match_mesh() { | ||
| let faces = vec![ | ||
| Face { | ||
| a: Point3D { | ||
| index: 0, | ||
| x: 0.0, | ||
| y: 0.0, | ||
| z: 0.0, | ||
| }, | ||
| b: Point3D { | ||
| index: 1, | ||
| x: 1.0, | ||
| y: 0.0, | ||
| z: 0.0, | ||
| }, | ||
| c: Point3D { | ||
| index: 2, | ||
| x: 0.0, | ||
| y: 1.0, | ||
| z: 0.0, | ||
| }, | ||
| }, | ||
| Face { | ||
| a: Point3D { | ||
| index: 0, | ||
| x: 0.0, | ||
| y: 0.0, | ||
| z: 0.0, | ||
| }, | ||
| b: Point3D { | ||
| index: 2, | ||
| x: 0.0, | ||
| y: 1.0, | ||
| z: 0.0, | ||
| }, | ||
| c: Point3D { | ||
| index: 3, | ||
| x: 0.0, | ||
| y: 0.0, | ||
| z: 1.0, | ||
| }, | ||
| }, | ||
| ]; | ||
| let json = faces_to_gltf(&faces); | ||
| // 4 unique vertices, 6 indices | ||
| assert!(json.contains("\"count\":4")); | ||
| assert!(json.contains("\"count\":6")); | ||
| } |
There was a problem hiding this comment.
test_glb_accessor_counts_match_mesh calls faces_to_gltf (JSON .gltf) rather than faces_to_glb. Either rename the test to reflect that it validates the glTF JSON output, or switch it to parsing the GLB JSON chunk so the name matches the behavior.
| #[test] | ||
| fn test_glb_min_max_bounds() { | ||
| let face = Face { | ||
| a: Point3D { | ||
| index: 0, | ||
| x: -1.0, | ||
| y: -2.0, | ||
| z: -3.0, | ||
| }, | ||
| b: Point3D { | ||
| index: 1, | ||
| x: 4.0, | ||
| y: 5.0, | ||
| z: 6.0, | ||
| }, | ||
| c: Point3D { | ||
| index: 2, | ||
| x: 0.0, | ||
| y: 0.0, | ||
| z: 0.0, | ||
| }, | ||
| }; | ||
| let json = faces_to_gltf(&[face]); | ||
| assert!(json.contains("\"min\":[-1,-2,-3]")); | ||
| assert!(json.contains("\"max\":[4,5,6]")); | ||
| } |
There was a problem hiding this comment.
test_glb_min_max_bounds is validating min/max in the JSON produced by faces_to_gltf, not the GLB output. Rename the test (or validate bounds by extracting and inspecting the GLB JSON chunk) to avoid confusion.
Summary
Test coverage by format
Test plan
cargo test— 104 tests + 11 doc-tests passcargo clippy -- -D warnings— cleancargo fmt --check— cleanCloses #45
🤖 Generated with Claude Code