@tscircuit/schematic-trace-solver 0.0.143 → 0.0.145
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.d.ts +22 -16
- package/dist/index.js +105 -95
- package/lib/solvers/InlineNetLabelSolver/InlineNetLabelSolver.ts +70 -57
- package/lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver.ts +14 -5
- package/lib/solvers/MspConnectionPairSolver/isLabeledPeripheralConnection.ts +46 -10
- package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +7 -0
- package/lib/types/InputProblem.ts +7 -4
- package/package.json +1 -1
- package/tests/assets/inline-net-label-two-pin-net.json +67 -0
- package/tests/repros/__snapshots__/repro-tida010076-page02.snap.svg +10 -30
- package/tests/repros/assets/repro-tida010076-page02.input.json +2 -0
- package/tests/repros/repro-tida010076-page02.test.ts +31 -0
- package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label-two-pin-net.snap.svg +57 -0
- package/tests/solvers/InlineNetLabelSolver/inline-net-label-two-pin-net.test.ts +38 -0
- package/tests/solvers/InlineNetLabelSolver/two-pin-terminal-stubs-atomic.test.ts +78 -0
- package/tests/solvers/MspConnectionPairSolver/msp-connection-pair-solver-direct-connection-distance.test.ts +80 -0
|
@@ -44,3 +44,83 @@ test("two-pin direct connections use Euclidean max distance", () => {
|
|
|
44
44
|
expect(directConnectionSolver.mspConnectionPairs).toHaveLength(1)
|
|
45
45
|
expect(netConnectionSolver.mspConnectionPairs).toHaveLength(0)
|
|
46
46
|
})
|
|
47
|
+
|
|
48
|
+
test("routes a distant labeled connection when opposed fallback labels would overlap", () => {
|
|
49
|
+
const inputProblem = createInputProblem()
|
|
50
|
+
inputProblem.maxMspPairDistance = 1
|
|
51
|
+
inputProblem.chips[0]!.sectionId = "power-output"
|
|
52
|
+
inputProblem.chips[1]!.sectionId = "power-output"
|
|
53
|
+
inputProblem.chips[0]!.pins.push({
|
|
54
|
+
pinId: "U1.2",
|
|
55
|
+
x: 0,
|
|
56
|
+
y: -0.2,
|
|
57
|
+
_facingDirection: "x+",
|
|
58
|
+
})
|
|
59
|
+
inputProblem.chips[1]!.pins.push({
|
|
60
|
+
pinId: "U2.2",
|
|
61
|
+
x: 2,
|
|
62
|
+
y: 1.8,
|
|
63
|
+
_facingDirection: "x-",
|
|
64
|
+
})
|
|
65
|
+
inputProblem.chips[1]!.pins[0]!.y = 0.1
|
|
66
|
+
inputProblem.directConnections[0]!.netId = "LONG_POWER_NAME"
|
|
67
|
+
inputProblem.directConnections[0]!.netLabelWidth = 1.2
|
|
68
|
+
|
|
69
|
+
const solver = new MspConnectionPairSolver({ inputProblem })
|
|
70
|
+
solver.solve()
|
|
71
|
+
|
|
72
|
+
expect(solver.mspConnectionPairs).toHaveLength(1)
|
|
73
|
+
expect(solver.mspConnectionPairs[0]?.suppressNetLabel).toBe(true)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
test("keeps distant labeled fallback when opposed labels have room", () => {
|
|
77
|
+
const inputProblem = createInputProblem()
|
|
78
|
+
inputProblem.maxMspPairDistance = 1
|
|
79
|
+
inputProblem.chips[0]!.sectionId = "power-output"
|
|
80
|
+
inputProblem.chips[1]!.sectionId = "power-output"
|
|
81
|
+
inputProblem.chips[0]!.pins.push({
|
|
82
|
+
pinId: "U1.2",
|
|
83
|
+
x: 0,
|
|
84
|
+
y: -0.2,
|
|
85
|
+
_facingDirection: "x+",
|
|
86
|
+
})
|
|
87
|
+
inputProblem.chips[1]!.pins.push({
|
|
88
|
+
pinId: "U2.2",
|
|
89
|
+
x: 2,
|
|
90
|
+
y: 1.8,
|
|
91
|
+
_facingDirection: "x-",
|
|
92
|
+
})
|
|
93
|
+
inputProblem.chips[1]!.pins[0]!.y = 0.1
|
|
94
|
+
inputProblem.directConnections[0]!.netId = "SIG"
|
|
95
|
+
inputProblem.directConnections[0]!.netLabelWidth = 0.6
|
|
96
|
+
|
|
97
|
+
const solver = new MspConnectionPairSolver({ inputProblem })
|
|
98
|
+
solver.solve()
|
|
99
|
+
|
|
100
|
+
expect(solver.mspConnectionPairs).toHaveLength(0)
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test("does not apply the overlap fallback outside a shared schematic section", () => {
|
|
104
|
+
const inputProblem = createInputProblem()
|
|
105
|
+
inputProblem.maxMspPairDistance = 1
|
|
106
|
+
inputProblem.chips[0]!.pins.push({
|
|
107
|
+
pinId: "U1.2",
|
|
108
|
+
x: 0,
|
|
109
|
+
y: -0.2,
|
|
110
|
+
_facingDirection: "x+",
|
|
111
|
+
})
|
|
112
|
+
inputProblem.chips[1]!.pins.push({
|
|
113
|
+
pinId: "U2.2",
|
|
114
|
+
x: 2,
|
|
115
|
+
y: 1.8,
|
|
116
|
+
_facingDirection: "x-",
|
|
117
|
+
})
|
|
118
|
+
inputProblem.chips[1]!.pins[0]!.y = 0.1
|
|
119
|
+
inputProblem.directConnections[0]!.netId = "LONG_POWER_NAME"
|
|
120
|
+
inputProblem.directConnections[0]!.netLabelWidth = 1.2
|
|
121
|
+
|
|
122
|
+
const solver = new MspConnectionPairSolver({ inputProblem })
|
|
123
|
+
solver.solve()
|
|
124
|
+
|
|
125
|
+
expect(solver.mspConnectionPairs).toHaveLength(0)
|
|
126
|
+
})
|