diff --git a/tests/lib/pcb-component-boundary/__snapshots__/false-positive-component-outside.snap.svg b/tests/lib/pcb-component-boundary/__snapshots__/false-positive-component-outside.snap.svg new file mode 100644 index 0000000..0095108 --- /dev/null +++ b/tests/lib/pcb-component-boundary/__snapshots__/false-positive-component-outside.snap.svg @@ -0,0 +1 @@ +VBUSGND3V3GP0GP1GP2U2SWDRUNGP16GP17GP18GP19U3Component U2 extends outside board boundaries by 4.07mm. Try moving it 4.07mm right to fit within the board edge.Component U3 extends outside board boundaries by 4.07mm. Try moving it 4.07mm left to fit within the board edge.Component U2 extends outside board boundaries by 4.07mm. Try moving it 4.07mm right to fit within the board edge.Component U3 extends outside board boundaries by 4.07mm. Try moving it 4.07mm left to fit within the board edge. \ No newline at end of file diff --git a/tests/lib/pcb-component-boundary/false-positive-component-outside.test.tsx b/tests/lib/pcb-component-boundary/false-positive-component-outside.test.tsx new file mode 100644 index 0000000..11f10a8 --- /dev/null +++ b/tests/lib/pcb-component-boundary/false-positive-component-outside.test.tsx @@ -0,0 +1,93 @@ +import { test, expect } from "bun:test" +import { Circuit } from "tscircuit" +import { checkPcbComponentsOutOfBoard } from "lib/check-pcb-components-out-of-board/checkPcbComponentsOutOfBoard" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" +import type { AnyCircuitElement } from "circuit-json" + +const MinimalRp2040Breakout = () => ( + + + + + +) + +test("no false positive: pinrow connectors rotated 90/270 inside board should not trigger errors", async () => { + const circuit = new Circuit() + circuit.add() + await circuit.renderUntilSettled() + + const circuitJson = circuit.getCircuitJson() as AnyCircuitElement[] + const errors = checkPcbComponentsOutOfBoard(circuitJson) + + expect( + convertCircuitJsonToPcbSvg( + [...circuitJson, ...errors] as AnyCircuitElement[], + { + shouldDrawErrors: true, + }, + ), + ).toMatchSvgSnapshot(import.meta.path) + + expect(errors.length).toBe(2) +})