From e74538edfefad571967931997f7f6d65552371e8 Mon Sep 17 00:00:00 2001 From: Anas sarkiz Date: Wed, 20 Nov 2024 00:31:16 +0200 Subject: [PATCH 1/2] Render pin labels for the PinHeader component in SVG --- .../create-svg-objects-for-sch-port-pin-label.ts | 2 +- tests/sch/__snapshots__/kicad-theme-demo.snap.svg | 2 +- tests/sch/kicad-theme-demo.test.tsx | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts b/lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts index 1734e09..2a095fd 100644 --- a/lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts +++ b/lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts @@ -42,7 +42,7 @@ export const createSvgObjectsForSchPortPinLabel = (params: { const label = schPort.display_pin_label ?? - schComponent.port_labels?.[`pin${schPort.pin_number}`] + schComponent.port_labels?.[`${schPort.pin_number}`] if (!label) return [] diff --git a/tests/sch/__snapshots__/kicad-theme-demo.snap.svg b/tests/sch/__snapshots__/kicad-theme-demo.snap.svg index d384ccb..6e494a3 100644 --- a/tests/sch/__snapshots__/kicad-theme-demo.snap.svg +++ b/tests/sch/__snapshots__/kicad-theme-demo.snap.svg @@ -14,4 +14,4 @@ .pin-number { fill: rgb(169, 0, 0); } .port-label { fill: rgb(0, 100, 100); } .component-name { fill: rgb(0, 100, 100); } - -3,-5-3,-4-3,-3-3,-2-3,-1-3,0-3,1-3,2-3,3-3,4-3,5-2,-5-2,-4-2,-3-2,-2-2,-1-2,0-2,1-2,2-2,3-2,4-2,5-1,-5-1,-4-1,-3-1,-2-1,-1-1,0-1,1-1,2-1,3-1,4-1,50,-50,-40,-30,-20,-10,00,10,20,30,40,51,-51,-41,-31,-21,-11,01,11,21,31,41,52,-52,-42,-32,-22,-12,02,12,22,32,42,53,-53,-43,-33,-23,-13,03,13,23,33,43,54,-54,-44,-34,-24,-14,04,14,24,34,44,55,-55,-45,-35,-25,-15,05,15,25,35,45,56,-56,-46,-36,-26,-16,06,16,26,36,46,57,-57,-47,-37,-27,-17,07,17,27,37,47,58,-58,-48,-38,-28,-18,08,18,28,38,48,5R110ΩC11mF29RESET13GND2VCC18OSC11478121415161719202223ATmega8-16AU2 \ No newline at end of file + -3,-5-3,-4-3,-3-3,-2-3,-1-3,0-3,1-3,2-3,3-3,4-3,5-2,-5-2,-4-2,-3-2,-2-2,-1-2,0-2,1-2,2-2,3-2,4-2,5-1,-5-1,-4-1,-3-1,-2-1,-1-1,0-1,1-1,2-1,3-1,4-1,50,-50,-40,-30,-20,-10,00,10,20,30,40,51,-51,-41,-31,-21,-11,01,11,21,31,41,52,-52,-42,-32,-22,-12,02,12,22,32,42,53,-53,-43,-33,-23,-13,03,13,23,33,43,54,-54,-44,-34,-24,-14,04,14,24,34,44,55,-55,-45,-35,-25,-15,05,15,25,35,45,56,-56,-46,-36,-26,-16,06,16,26,36,46,57,-57,-47,-37,-27,-17,07,17,27,37,47,58,-58,-48,-38,-28,-18,08,18,28,38,48,5R110ΩC11mF1pin22pin33pin44pin55pin66pin77pin88pin99pin101029RESET13GND2VCC18OSC11478121415161719202223ATmega8-16AU2 \ No newline at end of file diff --git a/tests/sch/kicad-theme-demo.test.tsx b/tests/sch/kicad-theme-demo.test.tsx index 2756b77..1cd858d 100644 --- a/tests/sch/kicad-theme-demo.test.tsx +++ b/tests/sch/kicad-theme-demo.test.tsx @@ -23,7 +23,13 @@ it("example 4: kicad theme demo", async () => { schX={2} /> - + Date: Wed, 20 Nov 2024 00:34:57 +0200 Subject: [PATCH 2/2] Formatted --- tests/sch/kicad-theme-demo.test.tsx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/sch/kicad-theme-demo.test.tsx b/tests/sch/kicad-theme-demo.test.tsx index 1cd858d..7545e66 100644 --- a/tests/sch/kicad-theme-demo.test.tsx +++ b/tests/sch/kicad-theme-demo.test.tsx @@ -23,13 +23,24 @@ it("example 4: kicad theme demo", async () => { schX={2} /> - +