-
Notifications
You must be signed in to change notification settings - Fork 73
schematic_component center according to the bounds of the symbols sizes #1447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
import { test, expect } from "bun:test" | ||
import { getTestFixture } from "tests/fixtures/get-test-fixture" | ||
|
||
test("SchematicRect Test2", () => { | ||
const { circuit } = getTestFixture() | ||
|
||
circuit.add( | ||
<board width="10mm" height="10mm"> | ||
<chip | ||
name="U1" | ||
schX={5} | ||
schY={5} | ||
symbol={ | ||
<symbol> | ||
<schematicrect | ||
schX={2} | ||
schY={3} | ||
width={2} | ||
height={2} | ||
isFilled={false} | ||
/> | ||
<schematicrect | ||
schX={-2} | ||
schY={3} | ||
width={2} | ||
height={2} | ||
isFilled={false} | ||
/> | ||
</symbol> | ||
} | ||
/> | ||
</board>, | ||
) | ||
|
||
circuit.render() | ||
|
||
const schematic_component = circuit.db.schematic_component.get( | ||
circuit.selectOne("chip")?.schematic_component_id!, | ||
) | ||
expect(schematic_component).not.toBeNull() | ||
expect(schematic_component).toMatchInlineSnapshot(` | ||
{ | ||
"center": { | ||
"x": 5, | ||
"y": 8, | ||
}, | ||
"is_box_with_pins": false, | ||
"schematic_component_id": "schematic_component_0", | ||
"schematic_group_id": "schematic_group_0", | ||
"size": { | ||
"height": 2, | ||
"width": 6, | ||
}, | ||
"source_component_id": "source_component_0", | ||
"symbol_display_value": undefined, | ||
"type": "schematic_component", | ||
} | ||
`) | ||
|
||
const schematic_rect = circuit.db.schematic_rect.list() | ||
expect(schematic_rect).toMatchInlineSnapshot(` | ||
[ | ||
{ | ||
"center": { | ||
"x": 7, | ||
"y": 8, | ||
}, | ||
"color": "rgba(132, 0, 0)", | ||
"height": 2, | ||
"is_dashed": false, | ||
"is_filled": false, | ||
"rotation": 0, | ||
"schematic_component_id": "schematic_component_0", | ||
"schematic_rect_id": "schematic_rect_0", | ||
"stroke_width": 0.12, | ||
"subcircuit_id": "subcircuit_source_group_0", | ||
"type": "schematic_rect", | ||
"width": 2, | ||
}, | ||
{ | ||
"center": { | ||
"x": 3, | ||
"y": 8, | ||
}, | ||
"color": "rgba(132, 0, 0)", | ||
"height": 2, | ||
"is_dashed": false, | ||
"is_filled": false, | ||
"rotation": 0, | ||
"schematic_component_id": "schematic_component_0", | ||
"schematic_rect_id": "schematic_rect_1", | ||
"stroke_width": 0.12, | ||
"subcircuit_id": "subcircuit_source_group_0", | ||
"type": "schematic_rect", | ||
"width": 2, | ||
}, | ||
] | ||
`) | ||
|
||
expect(circuit).toMatchSchematicSnapshot(import.meta.path) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test file naming violates the established rule: "A *.test.ts file may have AT MOST one test(...), after that the user should split into multiple, numbered files. e.g. add1.test.ts, add2.test.ts".
Since schematic-rect.test.tsx
already exists, this new test file should be named schematic-rect1.test.tsx
and the existing file should be renamed to schematic-rect2.test.tsx
, or vice versa, to follow the numbered naming convention for multiple test files covering the same functionality.
Spotted by Diamond (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
e8c7439
to
8a6ea8e
Compare
No description provided.