diff --git a/tests/repros/__snapshots__/usb-c-breakout-net-pair-pcb.snap.svg b/tests/repros/__snapshots__/usb-c-breakout-net-pair-pcb.snap.svg new file mode 100644 index 000000000..c3f43b019 --- /dev/null +++ b/tests/repros/__snapshots__/usb-c-breakout-net-pair-pcb.snap.svg @@ -0,0 +1 @@ +J1VBUSDMDPGNDJ2R1R2R3R4C1USB-C DEVICE BREAKOUTCC pull-downs: 5.1k \ No newline at end of file diff --git a/tests/repros/usb-c-breakout-net-pair.test.tsx b/tests/repros/usb-c-breakout-net-pair.test.tsx new file mode 100644 index 000000000..d6b225c22 --- /dev/null +++ b/tests/repros/usb-c-breakout-net-pair.test.tsx @@ -0,0 +1,25 @@ +import { expect, test } from "bun:test" +import { getSimpleRouteJsonFromCircuitJson } from "lib/utils/autorouting/getSimpleRouteJsonFromCircuitJson" +import { getTestFixture } from "tests/fixtures/get-test-fixture" + +import UsbBreakoutBoard from "./usb-c-breakout/board" + +test("USB-C breakout pair wired through named nets", async () => { + const { circuit } = getTestFixture() + circuit.add() + await circuit.renderUntilSettled() + expect(circuit.db.source_failed_to_create_component_error.list()).toEqual([]) + expect(circuit.db.source_trace_not_connected_error.list()).toEqual([]) + const board = circuit.firstChild + if (!board) throw new Error("Expected USB-C breakout board") + expect(() => + getSimpleRouteJsonFromCircuitJson({ + db: circuit.db, + subcircuitComponent: board, + }), + ).toThrow( + 'Could not find an SRJ connection for trace name or port selector ".R3 > .pin1"', + ) + expect(circuit.db.pcb_trace.list()).toHaveLength(0) + await expect(circuit).toMatchPcbSnapshot(import.meta.path) +}, 30_000) diff --git a/tests/repros/usb-c-breakout/board.tsx b/tests/repros/usb-c-breakout/board.tsx new file mode 100644 index 000000000..3d0bf343d --- /dev/null +++ b/tests/repros/usb-c-breakout/board.tsx @@ -0,0 +1,129 @@ +import { UsbFootprint } from "./usb-footprint" + +export default function UsbBreakoutBoard() { + return ( + + } + pcbY={8} + pcbRotation={180} + pinLabels={{ + pin1: "GND1", + pin2: "VBUS1", + pin3: "CC1", + pin4: "DP1", + pin5: "DM1", + pin6: "SBU1", + pin7: "SBU2", + pin8: "DM2", + pin9: "DP2", + pin10: "CC2", + pin11: "VBUS2", + pin12: "GND2", + pin13: "SHELL1", + pin14: "SHELL2", + pin15: "SHELL3", + pin16: "SHELL4", + }} + /> + + + + + + + {Object.entries({ + GND1: "GND", + GND2: "GND", + SHELL1: "GND", + SHELL2: "GND", + SHELL3: "GND", + SHELL4: "GND", + VBUS1: "VBUS", + VBUS2: "VBUS", + DP1: "DP_USB", + DP2: "DP_USB", + DM1: "DM_USB", + DM2: "DM_USB", + CC1: "CC1", + CC2: "CC2", + }).map(([pin, net]) => ( + .${pin}`} to={`net.${net}`} /> + ))} + + + + + + + + + + + + + + + + + + + + + ) +} diff --git a/tests/repros/usb-c-breakout/usb-footprint.tsx b/tests/repros/usb-c-breakout/usb-footprint.tsx new file mode 100644 index 000000000..9c7e217b0 --- /dev/null +++ b/tests/repros/usb-c-breakout/usb-footprint.tsx @@ -0,0 +1,240 @@ +// Exact C165948 EasyEDA footprint, remapped to standard USB-C pin labels. +export const UsbFootprint = () => ( + + + + + + + + + + + + + + + + + + + + + + + + + + +)