Skip to content

Expand export format tests with programmatic mesh generation#46

Merged
nash1111 merged 1 commit intomainfrom
issue-45
Feb 7, 2026
Merged

Expand export format tests with programmatic mesh generation#46
nash1111 merged 1 commit intomainfrom
issue-45

Conversation

@nash1111
Copy link
Copy Markdown
Owner

@nash1111 nash1111 commented Feb 7, 2026

Summary

  • Add 24 new tests across all 5 export format modules (STL, OBJ, VTK, glTF/GLB, Quantized GLB)
  • Tests use marching cubes sphere and voxel mesh for realistic multi-face inputs
  • Deep structural validation: GLB chunk parsing, VTK cell index ranges, STL facet structure, OBJ index validity
  • Test count increased from 80 to 104

Test coverage by format

Format New Tests Key Validations
STL 4 Sphere mesh, normal directions, facet structure, coordinate preservation
OBJ 4 Sphere mesh, 1-based indices, surface extraction, vertex precision
VTK 3 Voxel mesh, cell index ranges, shared vertex dedup
glTF/GLB 5 Sphere mesh, chunk parsing, accessor counts, bounds, two-chunk structure
Quantized GLB 5 Sphere mesh, node matrix, i16 range, buffer size, comparison with regular GLB

Test plan

  • cargo test — 104 tests + 11 doc-tests pass
  • cargo clippy -- -D warnings — clean
  • cargo fmt --check — clean

Closes #45

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings February 7, 2026 14:26
@nash1111 nash1111 merged commit ad63340 into main Feb 7, 2026
2 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +501 to +549
#[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"));
}
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +551 to +576
#[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]"));
}
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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.

Expand export format tests with programmatic mesh generation

2 participants