From c1ce7cb3ad4b00df5f7d37b2f80b86ce0d8e84a9 Mon Sep 17 00:00:00 2001 From: seveibar Date: Fri, 25 Oct 2024 12:14:16 -0700 Subject: [PATCH] upgrade snapshots, fix issue where regular holes weren't being drawn --- .gitignore | 1 + ...convert-soup-to-excellon-drill-commands.ts | 19 +++++++++++------- tests/fixtures/preload.ts | 1 - .../__snapshots__/pill-shape-bottom.diff.png | Bin 211 -> 0 bytes .../__snapshots__/pill-shape-bottom.snap.svg | 14 ++++++------- .../__snapshots__/pill-shape-top.diff.png | Bin 213 -> 0 bytes .../__snapshots__/pill-shape-top.snap.svg | 14 ++++++------- .../__snapshots__/simple1-bottom.snap.svg | 14 ++++++------- .../gerber/__snapshots__/simple1-top.snap.svg | 14 ++++++------- .../__snapshots__/simple2-bottom.snap.svg | 14 ++++++------- .../gerber/__snapshots__/simple2-top.snap.svg | 14 ++++++------- .../__snapshots__/simple3-bottom.snap.svg | 14 ++++++------- .../gerber/__snapshots__/simple3-top.snap.svg | 14 ++++++------- .../generate-gerber-with-pill-shape.test.tsx | 6 ------ 14 files changed, 69 insertions(+), 70 deletions(-) delete mode 100644 tests/gerber/__snapshots__/pill-shape-bottom.diff.png delete mode 100644 tests/gerber/__snapshots__/pill-shape-top.diff.png diff --git a/.gitignore b/.gitignore index ea9213d..b151154 100644 --- a/.gitignore +++ b/.gitignore @@ -183,3 +183,4 @@ yalc.lock gerber-output gerber-output.zip .aider* +*.diff.png diff --git a/src/excellon-drill/convert-soup-to-excellon-drill-commands.ts b/src/excellon-drill/convert-soup-to-excellon-drill-commands.ts index a01deb2..f6fa024 100644 --- a/src/excellon-drill/convert-soup-to-excellon-drill-commands.ts +++ b/src/excellon-drill/convert-soup-to-excellon-drill-commands.ts @@ -52,16 +52,19 @@ export const convertSoupToExcellonDrillCommands = ({ element.type === "pcb_via" ) { let hole_diameter: number | undefined - + if ("hole_diameter" in element) { hole_diameter = element.hole_diameter - } else if (element.type === "pcb_plated_hole" && element.shape === "pill") { + } else if ( + element.type === "pcb_plated_hole" && + element.shape === "pill" + ) { // For pill shapes, use the minimum dimension as the hole diameter hole_diameter = Math.min(element.hole_width, element.hole_height) } if (!hole_diameter) continue - + if (!diameterToToolNumber[hole_diameter]) { builder.add("aper_function_header", { is_plated: true, @@ -95,16 +98,18 @@ export const convertSoupToExcellonDrillCommands = ({ ) continue let hole_diameter: number | undefined - + if ("hole_diameter" in element) { hole_diameter = element.hole_diameter - } else if (element.type === "pcb_plated_hole" && element.shape === "pill") { + } + + if (element.type === "pcb_plated_hole" && element.shape === "pill") { hole_diameter = Math.min(element.hole_width, element.hole_height) - + // For pill shapes, we need to route the hole if (diameterToToolNumber[hole_diameter] === i) { const y_multiplier = flip_y_axis ? -1 : 1 - + if (element.hole_width > element.hole_height) { // Horizontal pill const offset = (element.hole_width - element.hole_height) / 2 diff --git a/tests/fixtures/preload.ts b/tests/fixtures/preload.ts index 62360a9..7462d72 100644 --- a/tests/fixtures/preload.ts +++ b/tests/fixtures/preload.ts @@ -36,7 +36,6 @@ async function toMatchGerberSnapshot( } expect.extend({ - // biome-ignore lint/suspicious/noExplicitAny: toMatchGerberSnapshot: toMatchGerberSnapshot as any, }) diff --git a/tests/gerber/__snapshots__/pill-shape-bottom.diff.png b/tests/gerber/__snapshots__/pill-shape-bottom.diff.png deleted file mode 100644 index 90f85bd68e8ef8f0f36b60ed597ddd3c7cae9a3d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 211 zcmeAS@N?(olHy`uVBq!ia0vp^mLSZ*1SFZOL@og-&H|6fVj%AY2s3W24$1}!wtBia zhE&XXJL4qp0Rx`H7HhxXZ}^+mxW)8<0y9U`+QVmhc03Xedt5pz{Fd&1G3CoTkFVBr zmvwLIe!2Q-czD$tnfKQto;U1ZSUvq?CG+e1m8BQ={CcOp=GbeK^;@FrblsLk9$WoW z?5$X;_~r1^>z{4BmZ*^)*uQm6?slHn(Pifsojdz)_A};9e*~M1C%NwhI*7s3)z4*} HQ$iB}Di2#m diff --git a/tests/gerber/__snapshots__/pill-shape-bottom.snap.svg b/tests/gerber/__snapshots__/pill-shape-bottom.snap.svg index f8ca33b..35500f5 100644 --- a/tests/gerber/__snapshots__/pill-shape-bottom.snap.svg +++ b/tests/gerber/__snapshots__/pill-shape-bottom.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/pill-shape-top.diff.png b/tests/gerber/__snapshots__/pill-shape-top.diff.png deleted file mode 100644 index 6e1f5d07c24350ab4519c71d6050922a1026a2c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^mLSZ*1SFZOL@og-&H|6fVj%AY2s3W24$1}!wtKob zhE&XXJHwFgfB_FvrSAX#2TRXh$eSwUE?#+}V*>AuOmB%mLG4dbzfI4H?LNw3%3bMt zziYGTX6{$o&%)n*xuKWO5O(jMdeT$o@0}6W9oP9@h5ysu=oXi~|4~lqZi$6yitArQ z7j8=`bF4l3r%SHe+UHDUVgJ!Jz1w;2Z2vG%wEW$f{h4;VrG@<1f~S=Moy6ej>gTe~ HDWM4fwS!W? diff --git a/tests/gerber/__snapshots__/pill-shape-top.snap.svg b/tests/gerber/__snapshots__/pill-shape-top.snap.svg index b96a4d5..57db981 100644 --- a/tests/gerber/__snapshots__/pill-shape-top.snap.svg +++ b/tests/gerber/__snapshots__/pill-shape-top.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/simple1-bottom.snap.svg b/tests/gerber/__snapshots__/simple1-bottom.snap.svg index adaafc7..79fff85 100644 --- a/tests/gerber/__snapshots__/simple1-bottom.snap.svg +++ b/tests/gerber/__snapshots__/simple1-bottom.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/simple1-top.snap.svg b/tests/gerber/__snapshots__/simple1-top.snap.svg index a1dc021..a2e3d2f 100644 --- a/tests/gerber/__snapshots__/simple1-top.snap.svg +++ b/tests/gerber/__snapshots__/simple1-top.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/simple2-bottom.snap.svg b/tests/gerber/__snapshots__/simple2-bottom.snap.svg index b9ac0b7..270adb0 100644 --- a/tests/gerber/__snapshots__/simple2-bottom.snap.svg +++ b/tests/gerber/__snapshots__/simple2-bottom.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/simple2-top.snap.svg b/tests/gerber/__snapshots__/simple2-top.snap.svg index 4eb3054..bd72f9b 100644 --- a/tests/gerber/__snapshots__/simple2-top.snap.svg +++ b/tests/gerber/__snapshots__/simple2-top.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/simple3-bottom.snap.svg b/tests/gerber/__snapshots__/simple3-bottom.snap.svg index ede6fe8..1823391 100644 --- a/tests/gerber/__snapshots__/simple3-bottom.snap.svg +++ b/tests/gerber/__snapshots__/simple3-bottom.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/simple3-top.snap.svg b/tests/gerber/__snapshots__/simple3-top.snap.svg index dd5ee0a..6117409 100644 --- a/tests/gerber/__snapshots__/simple3-top.snap.svg +++ b/tests/gerber/__snapshots__/simple3-top.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/generate-gerber-with-pill-shape.test.tsx b/tests/gerber/generate-gerber-with-pill-shape.test.tsx index 7e0bdf9..981cc00 100644 --- a/tests/gerber/generate-gerber-with-pill-shape.test.tsx +++ b/tests/gerber/generate-gerber-with-pill-shape.test.tsx @@ -35,8 +35,6 @@ test("Generate gerber with pill shape", async () => { const circuitJson = circuit.getCircuitJson() - console.log(circuitJson) - const gerber_cmds = convertSoupToGerberCommands(circuitJson) const excellon_drill_cmds = convertSoupToExcellonDrillCommands({ circuitJson: circuitJson, @@ -53,10 +51,6 @@ test("Generate gerber with pill shape", async () => { ) const gerberOutput = stringifyGerberCommandLayers(gerber_cmds) - console.log("plated\n", excellonDrillOutput) - - console.log("unplated\n", excellonDrillOutputUnplated) - await maybeOutputGerber(gerberOutput, excellonDrillOutput) expect({