@tscircuit/schematic-trace-solver 0.0.163 → 0.0.164
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 +8 -4
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2.ts +15 -4
- package/package.json +1 -1
- package/tests/bug-reports/bug-report-20260730T061837Z/__snapshots__/bug-report-20260730T061837Z.snap.svg +166 -166
- package/tests/repros/__snapshots__/board-1273-trace-overlap-cycle.snap.svg +26 -26
- package/tests/repros/__snapshots__/repro-pmp11282-endpoint-trace-through-component-text.snap.svg +76 -0
- package/tests/repros/__snapshots__/repro-pmp11282-isolated-dcdc.snap.svg +131 -113
- package/tests/repros/__snapshots__/repro-tida010076-page02.snap.svg +1681 -1690
- package/tests/repros/repro-pmp11282-endpoint-trace-through-component-text.test.ts +82 -0
- package/tests/repros/repro-pmp11282-isolated-dcdc.test.ts +5 -5
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { isPathCollidingWithObstacles } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/collisions"
|
|
3
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
4
|
+
import type { InputProblem } from "lib/types/InputProblem"
|
|
5
|
+
import { getTextBoxBounds } from "lib/utils/textBoxBounds"
|
|
6
|
+
import "tests/fixtures/matcher"
|
|
7
|
+
|
|
8
|
+
// Reduced from the PMP11282 reproduction. U503.pin2 and TP502.pin1 are the
|
|
9
|
+
// original schematic_port_238 and schematic_port_273 endpoints.
|
|
10
|
+
const inputProblem: InputProblem = {
|
|
11
|
+
chips: [
|
|
12
|
+
{
|
|
13
|
+
chipId: "U503",
|
|
14
|
+
center: { x: -2.7375, y: -1.6425 },
|
|
15
|
+
width: 2.1,
|
|
16
|
+
height: 0.6,
|
|
17
|
+
pins: [
|
|
18
|
+
{ pinId: "U503.pin1", x: -3.7875, y: -1.5425 },
|
|
19
|
+
{ pinId: "U503.pin2", x: -3.7875, y: -1.7425 },
|
|
20
|
+
{ pinId: "U503.pin3", x: -1.6875, y: -1.7425 },
|
|
21
|
+
{ pinId: "U503.pin4", x: -1.6875, y: -1.5425 },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
chipId: "TP502",
|
|
26
|
+
center: { x: 0.17175, y: -2.0075 },
|
|
27
|
+
width: 0.9625,
|
|
28
|
+
height: 0.2,
|
|
29
|
+
pins: [{ pinId: "TP502.pin1", x: -0.3095, y: -2.0075 }],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
directConnections: [
|
|
33
|
+
{
|
|
34
|
+
netId: "TP502.pin1 to U503.pin2",
|
|
35
|
+
pinIds: ["TP502.pin1", "U503.pin2"],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
netConnections: [],
|
|
39
|
+
textBoxes: [
|
|
40
|
+
{
|
|
41
|
+
chipId: "U503",
|
|
42
|
+
center: { x: -2.6675, y: -2.0725 },
|
|
43
|
+
width: 1.44,
|
|
44
|
+
height: 0.18,
|
|
45
|
+
text: "PC817X4NSZ0F",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
chipId: "U503",
|
|
49
|
+
center: { x: -3.1475, y: -1.2275 },
|
|
50
|
+
width: 0.6,
|
|
51
|
+
height: 0.25,
|
|
52
|
+
text: "U503",
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
availableNetLabelOrientations: {},
|
|
56
|
+
maxMspPairDistance: 100,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
test("PMP11282 endpoint trace avoids U503 component text", () => {
|
|
60
|
+
const solver = new SchematicTracePipelineSolver(inputProblem, {
|
|
61
|
+
hideRatsNet: true,
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
solver.solve()
|
|
65
|
+
|
|
66
|
+
const trace = solver.schematicTraceLinesSolver!.solvedTracePaths.find(
|
|
67
|
+
(candidate) =>
|
|
68
|
+
candidate.pinIds.includes("U503.pin2") &&
|
|
69
|
+
candidate.pinIds.includes("TP502.pin1"),
|
|
70
|
+
)
|
|
71
|
+
const componentTextBox = inputProblem.textBoxes!.find(
|
|
72
|
+
(textBox) => textBox.text === "PC817X4NSZ0F",
|
|
73
|
+
)!
|
|
74
|
+
|
|
75
|
+
expect(trace).toBeDefined()
|
|
76
|
+
expect(
|
|
77
|
+
isPathCollidingWithObstacles(trace!.tracePath, [
|
|
78
|
+
getTextBoxBounds(componentTextBox),
|
|
79
|
+
]),
|
|
80
|
+
).toBe(false)
|
|
81
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
82
|
+
})
|
|
@@ -35,8 +35,8 @@ test("repro PMP11282 isolated DC/DC traces and endpoint net labels", () => {
|
|
|
35
35
|
expect(defaultPipeline.error).toBe(
|
|
36
36
|
"SchematicTraceLinesSolver ran out of iterations",
|
|
37
37
|
)
|
|
38
|
-
expect(defaultTraceSolver.solvedTracePaths).toHaveLength(
|
|
39
|
-
expect(defaultTraceSolver.failedConnectionPairs).toHaveLength(
|
|
38
|
+
expect(defaultTraceSolver.solvedTracePaths).toHaveLength(70)
|
|
39
|
+
expect(defaultTraceSolver.failedConnectionPairs).toHaveLength(37)
|
|
40
40
|
expect(defaultTraceSolver.queuedConnectionPairs).toHaveLength(95)
|
|
41
41
|
|
|
42
42
|
// Let the same unmodified production pipeline reach its downstream stages
|
|
@@ -64,11 +64,11 @@ test("repro PMP11282 isolated DC/DC traces and endpoint net labels", () => {
|
|
|
64
64
|
expect(diagnosticPipeline.failed).toBe(false)
|
|
65
65
|
expect(
|
|
66
66
|
diagnosticPipeline.schematicTraceLinesSolver!.solvedTracePaths,
|
|
67
|
-
).toHaveLength(
|
|
67
|
+
).toHaveLength(143)
|
|
68
68
|
expect(
|
|
69
69
|
diagnosticPipeline.schematicTraceLinesSolver!.failedConnectionPairs,
|
|
70
|
-
).toHaveLength(
|
|
71
|
-
expect(finalOutput.netLabelPlacements).toHaveLength(
|
|
70
|
+
).toHaveLength(60)
|
|
71
|
+
expect(finalOutput.netLabelPlacements).toHaveLength(108)
|
|
72
72
|
expect(endpointPairLabels).toHaveLength(80)
|
|
73
73
|
expect(endpointPairNetIds.size).toBe(62)
|
|
74
74
|
expect(endpointPairNetIds).toContain("U500.pin8 to C501.pin1")
|