Skip to content

Conversation

imrishabh18
Copy link
Member

No description provided.

Copy link

vercel bot commented Oct 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview Comment Oct 4, 2025 11:19pm

@imrishabh18 imrishabh18 changed the title schematic_component center according to the bounds of the center schematic_component center according to the bounds of the symbols sizes Oct 4, 2025
Comment on lines +1 to +101
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)
})
Copy link
Contributor

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)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@imrishabh18 imrishabh18 merged commit 35ca451 into main Oct 5, 2025
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants