@tscircuit/schematic-trace-solver 0.0.137 → 0.0.141
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/.github/workflows/bun-pver-release.yml +7 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.js +304 -36
- package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationObstacleIndex.ts +182 -0
- package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationSolver.ts +67 -25
- package/lib/solvers/AvailableNetOrientationSolver/constants.ts +2 -0
- package/lib/solvers/Example28Solver/labelMovement.ts +71 -0
- package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +12 -4
- package/lib/solvers/TraceOverlapShiftSolver/TraceOverlapShiftSolver.ts +60 -4
- package/package.json +5 -1
- package/tests/bug-reports/bug-report-20260819T091818Z/__snapshots__/bug-report-20260819T091818Z.snap.svg +237 -0
- package/tests/bug-reports/bug-report-20260819T091818Z/bug-report-20260819T091818Z.json +1052 -0
- package/tests/bug-reports/bug-report-20260819T091818Z/bug-report-20260819T091818Z.test.ts +33 -0
- package/tests/repros/__snapshots__/board-1273-trace-overlap-cycle.snap.svg +542 -0
- package/tests/repros/__snapshots__/repro-board-648-esp12f-section.snap.svg +124 -0
- package/tests/repros/assets/board-1273-trace-overlap-cycle.input.json +3519 -0
- package/tests/repros/assets/repro-board-648-esp12f-section.input.json +537 -0
- package/tests/repros/board-1273-trace-overlap-cycle.test.ts +30 -0
- package/tests/repros/repro-board-648-esp12f-section.test.ts +13 -0
- package/tests/repros/repro161-power-section-autolayout.test.ts +7 -0
- package/tests/solvers/AvailableNetOrientationSolver/AvailableNetOrientationObstacleIndex.test.ts +122 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { tracePathContainsPoint } from "lib/solvers/RailNetLabelCornerPlacementSolver/geometry"
|
|
3
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
4
|
+
import type { InputProblem } from "lib/types/InputProblem"
|
|
5
|
+
import inputProblem from "./bug-report-20260819T091818Z.json"
|
|
6
|
+
import "tests/fixtures/matcher"
|
|
7
|
+
|
|
8
|
+
test("disconnected netlabel", () => {
|
|
9
|
+
const expectedAlignedRailX = 3.18
|
|
10
|
+
const expectedCloserLabelAnchorX = 3.71
|
|
11
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as InputProblem)
|
|
12
|
+
|
|
13
|
+
solver.solve()
|
|
14
|
+
|
|
15
|
+
const output = solver.inlineNetLabelSolver!.getOutput()
|
|
16
|
+
const targetLabel = output.netLabelPlacements.find((label) =>
|
|
17
|
+
label.pinIds.includes("schematic_port_204"),
|
|
18
|
+
)!
|
|
19
|
+
const hostTrace = output.traces.find((trace) =>
|
|
20
|
+
targetLabel.mspConnectionPairIds.includes(trace.mspPairId),
|
|
21
|
+
)!
|
|
22
|
+
const labelConnectorTrace = output.traces.find(
|
|
23
|
+
(trace) =>
|
|
24
|
+
trace.mspPairId !== hostTrace.mspPairId &&
|
|
25
|
+
trace.globalConnNetId === targetLabel.globalConnNetId &&
|
|
26
|
+
tracePathContainsPoint(trace.tracePath, targetLabel.anchorPoint),
|
|
27
|
+
)!
|
|
28
|
+
|
|
29
|
+
expect(hostTrace.tracePath[1]!.x).toBeCloseTo(expectedAlignedRailX)
|
|
30
|
+
expect(targetLabel.anchorPoint.x).toBeCloseTo(expectedCloserLabelAnchorX)
|
|
31
|
+
expect(labelConnectorTrace.tracePath[0]).toEqual(hostTrace.tracePath[1])
|
|
32
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
33
|
+
})
|