imrishabh18/corne-keyboard

The code defines and renders two surface-mount chip components with SMT pads, silkscreen outlines, and 3D CAD models (OBJ and STEP) for PCB assembly.

Version
2.0.21
License
unset
Stars
1

scripts/panel-pour.test.tsx

import {test,expect} from 'bun:test'
import {Circuit} from '@tscircuit/core'
test('each panel pour stays inside its owning board',async()=>{
 const c=new Circuit()
 c.add(<panel row={1} col={2} layoutMode="grid" boardGap={6} panelizationMethod="none"><board name="A" width={10} height={10}><net name="GND" isGroundNet/><copperpour layer="bottom" connectsTo="net.GND"/></board><board name="B" width={10} height={10}><net name="GND" isGroundNet/><copperpour layer="bottom" connectsTo="net.GND"/></board></panel>)
 await c.renderUntilSettled()
 const j:any[]=c.getCircuitJson(),boards=j.filter(e=>e.type==='pcb_board'),pours=j.filter(e=>e.type==='pcb_copper_pour')
 expect(boards.length).toBe(2);expect(pours.length).toBe(2)
 for(let i=0;i<2;i++){
  const p=pours.find(e=>e.source_net_id===`source_net_${i}`),b=boards[i]
  for(const v of p.brep_shape.outer_ring.vertices){expect(v.x).toBeGreaterThan(b.center.x-b.width/2);expect(v.x).toBeLessThan(b.center.x+b.width/2)}
 }
})