-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: schematic x and y props using parsed value in mm
- Loading branch information
1 parent
7fe32b3
commit ecf147e
Showing
3 changed files
with
81 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
17 changes: 17 additions & 0 deletions
17
tests/repros/__snapshots__/repo8-resistor-schX-schematic.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,62 @@ | ||
import { test, expect } from "bun:test" | ||
import { getTestFixture } from "tests/fixtures/get-test-fixture" | ||
|
||
test("board with resistor being passed schX and pcbX in mm", () => { | ||
const { circuit } = getTestFixture() | ||
|
||
circuit.add( | ||
<board width="10mm" height="10mm"> | ||
<resistor | ||
resistance="1k" | ||
footprint="0402" | ||
name="R1" | ||
schX="2mm" | ||
pcbX="-2mm" | ||
/> | ||
</board>, | ||
) | ||
|
||
circuit.render() | ||
|
||
expect(circuit.db.schematic_component.list()).toMatchInlineSnapshot(` | ||
[ | ||
{ | ||
"center": { | ||
"x": 2, | ||
"y": 0, | ||
}, | ||
"rotation": 0, | ||
"schematic_component_id": "schematic_component_0", | ||
"size": { | ||
"height": 0.388910699999999, | ||
"width": 1.0583332999999997, | ||
}, | ||
"source_component_id": "source_component_0", | ||
"symbol_display_value": "1kΩ", | ||
"symbol_name": "boxresistor_right", | ||
"type": "schematic_component", | ||
}, | ||
] | ||
`) | ||
|
||
expect(circuit.db.pcb_component.list()).toMatchInlineSnapshot(` | ||
[ | ||
{ | ||
"center": { | ||
"x": -2, | ||
"y": 0, | ||
}, | ||
"height": 0.6000000000000001, | ||
"layer": "top", | ||
"pcb_component_id": "pcb_component_0", | ||
"rotation": 0, | ||
"source_component_id": "source_component_0", | ||
"subcircuit_id": "subcircuit_source_group_0", | ||
"type": "pcb_component", | ||
"width": 1.5999999999999999, | ||
}, | ||
] | ||
`) | ||
|
||
expect(circuit).toMatchSchematicSnapshot(import.meta.path) | ||
}) |