Skip to content

Commit 3bc9a39

Browse files
committed
add: a simple test for polygon with arc nodes
1 parent df2cf08 commit 3bc9a39

2 files changed

Lines changed: 127 additions & 0 deletions

File tree

‎test/kicad/board.test.ts‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import footprint_graphics_pcb_src from "./files/footprint-graphics.kicad_pcb";
2222
import footprint_pads_pcb_src from "./files/footprint-pads.kicad_pcb";
2323
import footprint_text_locked_pcb_src from "./files/footprint-text-locked.kicad_pcb";
2424
import footprint_symbol_properties_pcb_src from "./files/footprint-properties.kicad_pcb";
25+
import shape_polygon_arc_pcb_src from "./files/shape_polygon_arc.kicad_pcb";
2526
import { first } from "../../src/base/iterator";
2627

2728
suite("kicad.board.KicadPCB(): board parsing", function () {
@@ -627,6 +628,32 @@ suite("kicad.board.KicadPCB(): board parsing", function () {
627628
net: 0,
628629
} as Partial<board.Via>);
629630
});
631+
632+
test("with polygon", function () {
633+
const pcb = new board.KicadPCB(
634+
"test.kicad_pcb",
635+
shape_polygon_arc_pcb_src,
636+
);
637+
assert.equal(pcb.drawings.length, 1);
638+
639+
const poly1 = pcb.drawings[0]!;
640+
641+
assert(poly1 instanceof board.GrPoly);
642+
assert.deepInclude(poly1, {
643+
pts: [
644+
{
645+
start: { x: 0, y: 0 },
646+
mid: { x: 5, y: -5 },
647+
end: { x: 1, y: 0 },
648+
},
649+
{ x: 1, y: 1 },
650+
{ x: 0, y: 1 },
651+
],
652+
layer: "F.Cu",
653+
width: 0.2,
654+
fill: "none",
655+
} as Partial<board.GrPoly>);
656+
});
630657
});
631658

632659
suite("kicad.board.Footprint()", function () {
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
(kicad_pcb
2+
(version 20240108)
3+
(generator "pcbnew")
4+
(generator_version "8.0")
5+
(general
6+
(thickness 1.6)
7+
(legacy_teardrops no)
8+
)
9+
(paper "A4")
10+
(layers
11+
(0 "F.Cu" signal)
12+
(31 "B.Cu" signal)
13+
(32 "B.Adhes" user "B.Adhesive")
14+
(33 "F.Adhes" user "F.Adhesive")
15+
(34 "B.Paste" user)
16+
(35 "F.Paste" user)
17+
(36 "B.SilkS" user "B.Silkscreen")
18+
(37 "F.SilkS" user "F.Silkscreen")
19+
(38 "B.Mask" user)
20+
(39 "F.Mask" user)
21+
(40 "Dwgs.User" user "User.Drawings")
22+
(41 "Cmts.User" user "User.Comments")
23+
(42 "Eco1.User" user "User.Eco1")
24+
(43 "Eco2.User" user "User.Eco2")
25+
(44 "Edge.Cuts" user)
26+
(45 "Margin" user)
27+
(46 "B.CrtYd" user "B.Courtyard")
28+
(47 "F.CrtYd" user "F.Courtyard")
29+
(48 "B.Fab" user)
30+
(49 "F.Fab" user)
31+
(50 "User.1" user)
32+
(51 "User.2" user)
33+
(52 "User.3" user)
34+
(53 "User.4" user)
35+
(54 "User.5" user)
36+
(55 "User.6" user)
37+
(56 "User.7" user)
38+
(57 "User.8" user)
39+
(58 "User.9" user)
40+
)
41+
(setup
42+
(pad_to_mask_clearance 0)
43+
(allow_soldermask_bridges_in_footprints no)
44+
(pcbplotparams
45+
(layerselection 0x00010fc_ffffffff)
46+
(plot_on_all_layers_selection 0x0000000_00000000)
47+
(disableapertmacros no)
48+
(usegerberextensions no)
49+
(usegerberattributes yes)
50+
(usegerberadvancedattributes yes)
51+
(creategerberjobfile yes)
52+
(dashed_line_dash_ratio 12.000000)
53+
(dashed_line_gap_ratio 3.000000)
54+
(svgprecision 4)
55+
(plotframeref no)
56+
(viasonmask no)
57+
(mode 1)
58+
(useauxorigin no)
59+
(hpglpennumber 1)
60+
(hpglpenspeed 20)
61+
(hpglpendiameter 15.000000)
62+
(pdf_front_fp_property_popups yes)
63+
(pdf_back_fp_property_popups yes)
64+
(dxfpolygonmode yes)
65+
(dxfimperialunits yes)
66+
(dxfusepcbnewfont yes)
67+
(psnegative no)
68+
(psa4output no)
69+
(plotreference yes)
70+
(plotvalue yes)
71+
(plotfptext yes)
72+
(plotinvisibletext no)
73+
(sketchpadsonfab no)
74+
(subtractmaskfromsilk no)
75+
(outputformat 1)
76+
(mirror no)
77+
(drillshape 1)
78+
(scaleselection 1)
79+
(outputdirectory "")
80+
)
81+
)
82+
(net 0 "")
83+
(gr_poly
84+
(pts
85+
(arc
86+
(start 0 0)
87+
(mid 5 -5)
88+
(end 1 0)
89+
)
90+
(xy 1 1) (xy 0 1)
91+
)
92+
(stroke
93+
(width 0.2)
94+
(type solid)
95+
)
96+
(fill none)
97+
(layer "F.Cu")
98+
(uuid "e3346eff-27d7-4d75-bccf-361a8f26ec0f")
99+
)
100+
)

0 commit comments

Comments
 (0)