Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/repros/repro02/repro02.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,20 @@ test("repro02: convert circuit json with rotated pill holes to STEP", async () =
expect(stepText).toContain("CIRCLE")
expect(stepText).toContain("CYLINDRICAL_SURFACE")

// Guard against #6 regression: complex rotated-pill hole cutting must
// produce exactly one board solid. This fixture has source_components
// (MP1-4, Xpattern1-4) but no pcb_component entries, so no component
// fallback boxes should be generated. A regression that fragments the
// board geometry or adds spurious component boxes would change this count.
const solidCount = (stepText.match(/MANIFOLD_SOLID_BREP/g) || []).length
expect(solidCount).toBe(1)

// Write STEP file to debug-output
const outputPath = "debug-output/repro02.step"
await Bun.write(outputPath, stepText)

console.log("✓ STEP file generated successfully")
console.log(` - Solids created: ${solidCount}`)
console.log(` - STEP text length: ${stepText.length} bytes`)
console.log(` - Output: ${outputPath}`)

Expand Down
16 changes: 14 additions & 2 deletions test/repros/repro03/repro03.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,28 @@ test("repro03: reproduces fallback boxes for hole wrapper components", async ()
expect(stepText).toContain("ISO-10303-21")
expect(stepText).toContain("END-ISO-10303-21")
expect(stepText).toContain("Repro03")
expect(stepText).toContain("MANIFOLD_SOLID_BREP")
expect(stepText).toContain("CYLINDRICAL_SURFACE")

// Current repro behavior: these are fallback boxes for wrapper components,
// not intended physical component models.
// Guard: hole-wrapper pcb_components (subcircuit containers with
// obstructs_within_bounds) must NOT receive fallback component boxes.
// Any regression restoring the erroneous fallback would reintroduce
// these labels in the STEP output.
expect(stepText).not.toContain("Xpattern1")
expect(stepText).not.toContain("Xpattern4")

// Guard against #6 regression: since all pcb_components in this fixture
// are hole-wrapper containers, no component fallback boxes should be
// generated — the STEP output must contain exactly one board solid.
const solidCount = (stepText.match(/MANIFOLD_SOLID_BREP/g) || []).length
expect(solidCount).toBe(1)

const outputPath = "debug-output/repro03.step"
await Bun.write(outputPath, stepText)

console.log("\u2713 STEP file generated successfully")
console.log(` - Solids created: ${solidCount}`)

const occtResult = await importStepWithOcct(stepText)
expect(occtResult.success).toBe(true)
expect(occtResult.meshes.length).toBeGreaterThan(0)
Expand Down
Loading