Skip to content

Commit 9e99535

Browse files
Repro testpoint transparent boxes and update deps
1 parent 5806972 commit 9e99535

5 files changed

Lines changed: 53 additions & 4 deletions

File tree

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@
3030
"@resvg/resvg-js": "^2.6.2",
3131
"@resvg/resvg-wasm": "^2.6.2",
3232
"@tscircuit/alphabet": "^0.0.23",
33-
"@tscircuit/circuit-json-util": "^0.0.90",
33+
"@tscircuit/circuit-json-util": "^0.0.94",
3434
"@types/bun": "latest",
3535
"@types/earcut": "^3.0.0",
3636
"@types/react": "^19.1.9",
3737
"@types/react-dom": "^19.1.7",
3838
"@vitejs/plugin-react": "^5.0.0",
3939
"bun-match-svg": "^0.0.12",
40-
"circuit-json": "^0.0.399",
41-
"circuit-to-svg": "0.0.336",
40+
"circuit-json": "^0.0.423",
41+
"circuit-to-svg": "0.0.345",
4242
"graphics-debug": "^0.0.65",
4343
"looks-same": "^9.0.1",
4444
"poppygl": "^0.0.20",
4545
"react": "^19.1.1",
4646
"react-cosmos": "^7.0.0",
4747
"react-cosmos-plugin-vite": "^7.0.0",
4848
"react-dom": "^19.1.1",
49-
"tscircuit": "^0.0.1520",
49+
"tscircuit": "^0.0.1736",
5050
"tsup": "^8.5.0",
5151
"vite": "^7.1.1"
5252
},
-581 Bytes
Loading
15.3 KB
Loading
43 Bytes
Loading
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { expect, test } from "bun:test"
2+
import { Circuit } from "tscircuit"
3+
import { renderGLTFToPNGBufferFromGLBBuffer } from "poppygl"
4+
import { convertCircuitJsonTo3D, convertCircuitJsonToGltf } from "../../lib"
5+
import { getBestCameraPosition } from "../../lib/utils/camera-position"
6+
7+
const Repro12Testpoint = () => (
8+
<board width="18mm" height="12mm">
9+
<testpoint name="T1" pcbX={-7} pcbY={3} padDiameter="0.8mm" />
10+
<testpoint name="T2" pcbX={7} pcbY={3} padDiameter="0.8mm" />
11+
<testpoint name="M1" pcbX={-7} pcbY={0} padDiameter="0.8mm" />
12+
<testpoint name="M2" pcbX={7} pcbY={0} padDiameter="0.8mm" />
13+
<testpoint name="B1" pcbX={-7} pcbY={-3} padDiameter="0.8mm" />
14+
<testpoint name="B2" pcbX={7} pcbY={-3} padDiameter="0.8mm" />
15+
</board>
16+
)
17+
18+
export default Repro12Testpoint
19+
20+
test("repro12 testpoint 3d snapshot", async () => {
21+
const circuit = new Circuit()
22+
circuit.add(<Repro12Testpoint />)
23+
24+
const circuitJson = await circuit.getCircuitJson()
25+
const scene = await convertCircuitJsonTo3D(circuitJson, {
26+
showBoundingBoxes: false,
27+
renderBoardTextures: true,
28+
textureResolution: 512,
29+
})
30+
31+
expect(scene.boxes).toHaveLength(7)
32+
33+
const glb = await convertCircuitJsonToGltf(circuitJson, {
34+
format: "glb",
35+
boardTextureResolution: 512,
36+
includeModels: true,
37+
showBoundingBoxes: false,
38+
})
39+
40+
expect(glb).toBeInstanceOf(ArrayBuffer)
41+
expect((glb as ArrayBuffer).byteLength).toBeGreaterThan(0)
42+
43+
expect(
44+
renderGLTFToPNGBufferFromGLBBuffer(
45+
glb as ArrayBuffer,
46+
getBestCameraPosition(circuitJson),
47+
),
48+
).toMatchPngSnapshot(import.meta.path)
49+
})

0 commit comments

Comments
 (0)