diff --git a/kibot/layer.py b/kibot/layer.py index 22f3eea2..044b072c 100644 --- a/kibot/layer.py +++ b/kibot/layer.py @@ -6,10 +6,13 @@ import pcbnew from .optionable import Optionable from .gs import GS +from .misc import KICAD_VERSION_5_99 from re import match - from .error import (PlotError, KiPlotConfigurationError) from .macros import macros, document, output_class # noqa: F401 +from . import log + +logger = log.get_logger(__name__) class Layer(Optionable): @@ -60,6 +63,18 @@ class Layer(Optionable): 'F.Fab': 'Front documentation', 'B.Fab': 'Bottom documentation', } + KICAD6_RENAME = { + 'F.Adhes': 'F.Adhesive', + 'B.Adhes': 'B.Adhesive', + 'F.SilkS': 'F.Silkscreen', + 'B.SilkS': 'B.Silkscreen', + 'Dwgs.User': 'User.Drawings', + 'Cmts.User': 'User.Comments', + 'Eco1.User': 'User.Eco1', + 'Eco2.User': 'User.Eco2', + 'F.CrtYd': 'F.Courtyard', + 'B.CrtYd': 'B.Courtyard', + } # Names from the board file _pcb_layers = None _plot_layers = None @@ -135,6 +150,9 @@ class Layer(Optionable): ext = Layer._get_layers(Layer._get_user()) elif layer in Layer._pcb_layers: ext = [Layer.create_layer(layer)] + # Give compatibility for the KiCad 5 default names (automagically renamed by KiCad 6) + elif GS.kicad_version_n >= KICAD_VERSION_5_99 and layer in Layer.KICAD6_RENAME: + ext = [Layer.create_layer(Layer.KICAD6_RENAME[layer])] if ext is None: raise KiPlotConfigurationError("Unknown layer spec: `{}`".format(layer)) new_vals.extend(ext) diff --git a/tests/test_plot/test_svg.py b/tests/test_plot/test_svg.py index 39e772d3..2d0e09e5 100644 --- a/tests/test_plot/test_svg.py +++ b/tests/test_plot/test_svg.py @@ -20,7 +20,7 @@ PS_DIR = 'SVG' def test_svg(): prj = 'simple_2layer' - ctx = context.TestContext('SVG', prj, 'svg', PS_DIR) + ctx = context.TestContext('test_svg', prj, 'svg', PS_DIR) ctx.run() f_cu = ctx.get_gerber_filename('F_Cu', '.svg') @@ -34,28 +34,28 @@ def test_svg(): def test_svg_all(): prj = 'simple_2layer' - ctx = context.TestContext('SVGAll', prj, 'svg_all', PS_DIR) + ctx = context.TestContext('test_svg_all', prj, 'svg_all', PS_DIR) ctx.run() - ctx.expect_out_file(ctx.get_gerber_filename('B_Adhes', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('B_CrtYd', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_ADHES, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_CRTYD, '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('B_Fab', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('B_Mask', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('B_Paste', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('B_SilkS', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('Cmts_User', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('Dwgs_User', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('Eco1_User', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('Eco2_User', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_SILKS, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_CMTSU, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_DWGSU, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_ECO1U, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_ECO2U, '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('Edge_Cuts', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('F_Adhes', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('F_CrtYd', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_ADHES, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_CRTYD, '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Fab', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Mask', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('F_SilkS', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('Margin', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_job_filename()) @@ -64,28 +64,28 @@ def test_svg_all(): def test_svg_selected(): prj = 'simple_2layer' - ctx = context.TestContext('SVGSelected', prj, 'svg_selected', PS_DIR) + ctx = context.TestContext('test_svg_selected', prj, 'svg_selected', PS_DIR) ctx.run() - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Adhes', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_CrtYd', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_ADHES, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_CRTYD, '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Fab', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('B_Mask', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('B_Paste', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('B_SilkS', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Cmts_User', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Dwgs_User', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Eco1_User', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Eco2_User', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_SILKS, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_CMTSU, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_DWGSU, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_ECO1U, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_ECO2U, '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('Edge_Cuts', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Adhes', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_CrtYd', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_ADHES, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_CRTYD, '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Fab', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Mask', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('F_SilkS', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('Margin', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_job_filename()) @@ -94,14 +94,14 @@ def test_svg_selected(): def test_svg_copper_and_user(): prj = 'good-project' - ctx = context.TestContext('SVGCopperUser', prj, 'svg_copper_and_user', PS_DIR) + ctx = context.TestContext('test_svg_copper_and_user', prj, 'svg_copper_and_user', PS_DIR) ctx.run() ctx.expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('Cmts_User', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('Dwgs_User', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('Eco1_User', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('Eco2_User', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_CMTSU, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_DWGSU, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_ECO1U, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_ECO2U, '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('Edge_Cuts', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('GND_Cu', '.svg')) @@ -109,18 +109,18 @@ def test_svg_copper_and_user(): ctx.expect_out_file(ctx.get_gerber_filename('Power_Cu', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('Signal1_Cu', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('Signal2_Cu', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Adhes', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_CrtYd', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_ADHES, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_CRTYD, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Fab', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Mask', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Paste', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_SilkS', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Adhes', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_CrtYd', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_SILKS, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_ADHES, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_CRTYD, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Fab', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Mask', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_SilkS', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_job_filename()) ctx.clean_up() @@ -128,10 +128,11 @@ def test_svg_copper_and_user(): def test_svg_copper_and_draw(): prj = 'good-project' - ctx = context.TestContext('SVGCopperDraw', prj, 'svg_copper_and_draw', PS_DIR) + ctx = context.TestContext('test_svg_copper_and_draw', prj, 'svg_copper_and_draw', PS_DIR) ctx.run() ctx.expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg')) + # This name is selected manually: ctx.expect_out_file(ctx.get_gerber_filename('Dwgs_User', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('GND_Cu', '.svg')) @@ -139,22 +140,22 @@ def test_svg_copper_and_draw(): ctx.expect_out_file(ctx.get_gerber_filename('Signal1_Cu', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('Signal2_Cu', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('Margin', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Eco1_User', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Eco2_User', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_ECO1U, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_ECO2U, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('Edge_Cuts', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Cmts_User', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Adhes', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_CrtYd', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_CMTSU, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_ADHES, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_CRTYD, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Fab', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Mask', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Paste', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_SilkS', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Adhes', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_CrtYd', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_SILKS, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_ADHES, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_CRTYD, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Fab', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Mask', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_SilkS', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_job_filename()) ctx.clean_up() @@ -171,24 +172,24 @@ def test_svg_copper_and_cmt(): ctx.expect_out_file(ctx.get_gerber_filename('Power_Cu', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('Signal1_Cu', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('Signal2_Cu', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('Cmts_User', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Dwgs_User', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_CMTSU, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_DWGSU, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('Margin', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Eco1_User', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Eco2_User', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_ECO1U, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_ECO2U, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('Edge_Cuts', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Adhes', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_CrtYd', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_ADHES, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_CRTYD, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Fab', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Mask', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Paste', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_SilkS', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Adhes', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_CrtYd', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_SILKS, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_ADHES, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_CRTYD, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Fab', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Mask', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_SilkS', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_job_filename()) ctx.clean_up() @@ -196,7 +197,7 @@ def test_svg_copper_and_cmt(): def test_svg_anchor(): prj = 'good-project' - ctx = context.TestContext('SVGCopperCmt', prj, 'svg_anchor', PS_DIR) + ctx = context.TestContext('test_svg_anchor', prj, 'svg_anchor', PS_DIR) ctx.run(extra=['SVG']) assert ctx.search_err(r"- 'SVG files' \(SVG\) \[svg\]") @@ -206,24 +207,24 @@ def test_svg_anchor(): ctx.expect_out_file(ctx.get_gerber_filename('Power_Cu', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('Signal1_Cu', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('Signal2_Cu', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('Cmts_User', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Dwgs_User', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_CMTSU, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_DWGSU, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('Margin', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Eco1_User', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Eco2_User', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_ECO1U, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_ECO2U, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('Edge_Cuts', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Adhes', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_CrtYd', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_ADHES, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_CRTYD, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Fab', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Mask', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Paste', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('B_SilkS', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Adhes', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_CrtYd', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_SILKS, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_ADHES, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_CRTYD, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Fab', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Mask', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('F_SilkS', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_job_filename()) ctx.clean_up() @@ -231,7 +232,7 @@ def test_svg_anchor(): def test_svg_technical(): prj = 'good-project' - ctx = context.TestContext('SVGTechnical', prj, 'svg_technical', PS_DIR) + ctx = context.TestContext('test_svg_technical', prj, 'svg_technical', PS_DIR) ctx.run() ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg')) @@ -240,24 +241,24 @@ def test_svg_technical(): ctx.dont_expect_out_file(ctx.get_gerber_filename('Power_Cu', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('Signal1_Cu', '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('Signal2_Cu', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Cmts_User', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Dwgs_User', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_CMTSU, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_DWGSU, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('Margin', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Eco1_User', '.svg')) - ctx.dont_expect_out_file(ctx.get_gerber_filename('Eco2_User', '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_ECO1U, '.svg')) + ctx.dont_expect_out_file(ctx.get_gerber_filename(context.DEF_ECO2U, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_filename('Edge_Cuts', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('B_Adhes', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('B_CrtYd', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_ADHES, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_CRTYD, '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('B_Fab', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('B_Mask', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('B_Paste', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('B_SilkS', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('F_Adhes', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('F_CrtYd', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_SILKS, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_ADHES, '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_CRTYD, '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Fab', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Mask', '.svg')) ctx.expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg')) - ctx.expect_out_file(ctx.get_gerber_filename('F_SilkS', '.svg')) + ctx.expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg')) ctx.dont_expect_out_file(ctx.get_gerber_job_filename()) ctx.clean_up() diff --git a/tests/utils/context.py b/tests/utils/context.py index 6aef3acf..95e10d7d 100644 --- a/tests/utils/context.py +++ b/tests/utils/context.py @@ -36,9 +36,25 @@ if kicad_version >= KICAD_VERSION_5_99: BOARDS_DIR = '../board_samples/kicad_6' REF_DIR = 'tests/reference/6_0_0' KICAD_SCH_EXT = '.kicad_sch' + # Now these layers can be renamed. + # KiCad 6 takes the freedom to give them more descriptive names ... + DEF_ADHES = 'Adhesive' + DEF_CRTYD = 'Courtyard' + DEF_SILKS = 'Silkscreen' + DEF_CMTSU = 'User_Comments' + DEF_DWGSU = 'User_Drawings' + DEF_ECO1U = 'User_Eco1' + DEF_ECO2U = 'User_Eco2' else: BOARDS_DIR = '../board_samples/kicad_5' KICAD_SCH_EXT = '.sch' + DEF_ADHES = 'Adhes' + DEF_CRTYD = 'CrtYd' + DEF_SILKS = 'SilkS' + DEF_CMTSU = 'Cmts_User' + DEF_DWGSU = 'Dwgs_User' + DEF_ECO1U = 'Eco1_User' + DEF_ECO2U = 'Eco2_User' if kicad_version == KICAD_VERSION_5_1_7: REF_DIR = 'tests/reference/5_1_7' else: