-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/examples/__snapshots__/example2-switchshaft-pcb.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { test, expect } from "bun:test" | ||
import { getTestFixture } from "tests/fixtures/get-test-fixture" | ||
|
||
const SwitchShaft = (props: { | ||
name: string | ||
pcbX?: number | ||
pcbY?: number | ||
}) => ( | ||
<chip | ||
{...props} | ||
footprint={ | ||
<footprint> | ||
<smtpad | ||
shape="rect" | ||
width="2.55mm" | ||
height="2.5mm" | ||
portHints={["pin1"]} | ||
/> | ||
<smtpad | ||
shape="rect" | ||
width="2.55mm" | ||
height="2.5mm" | ||
portHints={["pin2"]} | ||
/> | ||
<platedhole | ||
shape="circle" | ||
name="H1" | ||
holeDiameter="3mm" | ||
outerDiameter="3.1mm" | ||
/> | ||
<platedhole | ||
shape="circle" | ||
name="H2" | ||
holeDiameter="3mm" | ||
outerDiameter="3.1mm" | ||
/> | ||
<constraint xDist="6.35mm" centerToCenter left=".H1" right=".H2" /> | ||
<constraint yDist="2.54mm" centerToCenter top=".H1" bottom=".H2" /> | ||
<constraint edgeToEdge xDist="11.3mm" left=".pin1" right=".pin2" /> | ||
<constraint sameY for={[".pin1", ".H1"]} /> | ||
<constraint sameY for={[".pin2", ".H2"]} /> | ||
<constraint | ||
edgeToEdge | ||
xDist={(11.3 - 6.35 - 3) / 2} | ||
left=".pin1" | ||
right=".H1" | ||
/> | ||
</footprint> | ||
} | ||
/> | ||
) | ||
|
||
test("example2-switchshaft", async () => { | ||
const { circuit } = getTestFixture() | ||
|
||
circuit.add( | ||
<board width="10mm" height="10mm"> | ||
<SwitchShaft name="S1" /> | ||
</board>, | ||
) | ||
|
||
expect(circuit.getCircuitJson()).toMatchPcbSnapshot(import.meta.path) | ||
}) |