@tscircuit/schematic-trace-solver 0.0.132 → 0.0.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +46 -6
- package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationSolver.ts +12 -6
- package/lib/solvers/AvailableNetOrientationSolver/orderRoutedLabelsBeforeOverlappingPortLabels.ts +47 -0
- package/package.json +1 -1
- package/tests/repros/__snapshots__/repro-usb-power-vbus-label-detour.snap.svg +3 -3
- package/tests/repros/repro-usb-power-vbus-label-detour.test.ts +20 -1
|
@@ -4,7 +4,9 @@ import type { InputProblem } from "lib/types/InputProblem"
|
|
|
4
4
|
import "tests/fixtures/matcher"
|
|
5
5
|
import inputProblemJson from "./assets/repro-usb-power-vbus-label-detour.input.json"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const VBUS_PIN_IDS = new Set(["schematic_port_224", "schematic_port_226"])
|
|
8
|
+
|
|
9
|
+
test("routes the usb power vbus connection without a label detour", () => {
|
|
8
10
|
const inputProblem: InputProblem = JSON.parse(
|
|
9
11
|
JSON.stringify(inputProblemJson),
|
|
10
12
|
)
|
|
@@ -12,5 +14,22 @@ test("reproduces the usb power vbus label detour", () => {
|
|
|
12
14
|
|
|
13
15
|
solver.solve()
|
|
14
16
|
|
|
17
|
+
const vbusTrace = solver.sameNetJunctionAlignmentSolver!.outputTraces.find(
|
|
18
|
+
(trace) =>
|
|
19
|
+
trace.pins.length === VBUS_PIN_IDS.size &&
|
|
20
|
+
trace.pins.every((pin) => VBUS_PIN_IDS.has(pin.pinId)),
|
|
21
|
+
)
|
|
22
|
+
const gndLabel =
|
|
23
|
+
solver.availableNetOrientationSolver!.outputNetLabelPlacements.find(
|
|
24
|
+
(label) => label.pinIds.includes("schematic_port_225"),
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
expect(gndLabel?.orientation).toBe("y-")
|
|
28
|
+
expect(vbusTrace?.tracePath).toEqual([
|
|
29
|
+
{ x: 13, y: -6.2 },
|
|
30
|
+
{ x: 12.8, y: -6.2 },
|
|
31
|
+
{ x: 12.8, y: -5.8 },
|
|
32
|
+
{ x: 13, y: -5.8 },
|
|
33
|
+
])
|
|
15
34
|
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
16
35
|
})
|