From bc63166a40f522014dfd11e830cce11d6d61be6d Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 30 Mar 2023 14:54:46 +0200 Subject: svg-flatten: Make drill size mapping more precise, add tests --- gerbolyze/tests/test_integration.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'gerbolyze/tests/test_integration.py') diff --git a/gerbolyze/tests/test_integration.py b/gerbolyze/tests/test_integration.py index 668e745..7456e85 100644 --- a/gerbolyze/tests/test_integration.py +++ b/gerbolyze/tests/test_integration.py @@ -20,6 +20,7 @@ import subprocess import tempfile from pathlib import Path +import gerbonara import pytest @@ -67,7 +68,20 @@ def test_convert_layers(): infile = reference_path('layers.svg') with tempfile.TemporaryDirectory() as out_dir: run_command('python3', '-m', 'gerbolyze', 'convert', infile, out_dir) - out_dir = Path(out_dir) - print(list(out_dir.glob('*'))) - assert False + stack = gerbonara.layers.LayerStack.open(out_dir) + for layer, dia in { + 'top paste': 0.100, + 'top silk': 0.110, + 'top mask': 0.120, + 'top copper': 0.130, + 'bottom copper': 0.140, + 'bottom mask': 0.150, + 'bottom silk': 0.160, + 'bottom paste': 0.170, + 'mechanical outline': 0.09}.items(): + assert set(round(ap.diameter, 4) for ap in stack[layer].apertures) == {dia, 0.05} + + # Note: svg-flatten rounds these diameters to the geometric tolerance given on the command line (0.01mm by + # default). Thus, these values are different from the more precise values in the SVG. + assert set(stack.drill_layers[0].drill_sizes()) == {0.67, 0.51} -- cgit