Added tests for:

- Inner layer that doesn't exist
- Technical layers
- Wrong layer group/spec
This commit is contained in:
Salvador E. Tropea 2020-07-08 23:34:45 -03:00
parent 995b6990aa
commit d4677a2c2e
7 changed files with 144 additions and 1 deletions

View File

@ -67,7 +67,7 @@ class Layer(Optionable):
self.suffix = ''
""" Suffix used in file names related to this layer. Derived from the name if not specified """
self.description = ''
""" A description for the layer, for documentation purposes """
""" A description for the layer, for documentation purposes """ # pragma: no cover
self._unkown_is_error = True
def config(self, tree):

View File

@ -15,6 +15,7 @@ if prev_dir not in sys.path:
sys.path.insert(0, prev_dir)
# Utils import
from utils import context
from kiplot.misc import (PLOT_ERROR)
GERBER_DIR = 'gerberdir'
@ -49,3 +50,11 @@ def test_gerber_inner():
ctx.expect_out_file(ctx.get_gerber_filename('Signal1'))
ctx.expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
def test_gerber_inner_wrong():
prj = 'good-project'
ctx = context.TestContext('Gerber_InnerWrong', prj, 'gerber_inner_wrong', GERBER_DIR)
ctx.run(PLOT_ERROR)
assert ctx.search_err('is not valid for this board')
ctx.clean_up()

View File

@ -227,3 +227,37 @@ def test_svg_anchor():
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
def test_svg_technical():
prj = 'good-project'
ctx = context.TestContext('SVGTechnical', prj, 'svg_technical', PS_DIR)
ctx.run()
ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Cu', '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_filename('GND_Cu', '.svg'))
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('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('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_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('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.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()

View File

@ -198,6 +198,14 @@ def test_wrong_layer_7():
ctx.clean_up()
def test_wrong_layer_9():
""" A bogus string """
ctx = context.TestContext('ErrorWrongLayer9', '3Rs', 'error_wrong_layer_9', None)
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown layer spec: .?nada.?")
ctx.clean_up()
def test_wrong_layer_8():
""" List of strings, but number in middle """
ctx = context.TestContext('ErrorWrongLayer8', '3Rs', 'error_wrong_layer_8', None)

View File

@ -0,0 +1,28 @@
kiplot:
version: 1
outputs:
- name: PDF
comment: "PDF files"
type: pdf
dir: PDF
options:
exclude_edge_layer: false
exclude_pads_from_silkscreen: false
use_aux_axis_as_origin: false
plot_sheet_reference: false
plot_footprint_refs: true
plot_footprint_values: true
force_plot_invisible_refs_vals: false
tent_vias: true
# PDF options
drill_marks: small
mirror_plot: false
negative_plot: false
line_width: 0.01
layers:
- all
- nada
- user

View File

@ -0,0 +1,38 @@
# Example KiPlot config file for a basic 2-layer board
kiplot:
version: 1
outputs:
- name: 'gerbers'
comment: "Gerbers for the Gerber god"
type: gerber
dir: gerberdir
options:
# generic layer options
exclude_edge_layer: false
exclude_pads_from_silkscreen: false
use_aux_axis_as_origin: false
plot_sheet_reference: false
plot_footprint_refs: true
plot_footprint_values: true
force_plot_invisible_refs_vals: false
tent_vias: true
# gerber options
line_width: 0.15
subtract_mask_from_silk: true
use_protel_extensions: false
gerber_precision: 4.6
create_gerber_job_file: true
use_gerber_x2_attributes: true
use_gerber_net_attributes: false
layers:
- layer: GND.Cu
suffix: GND_Cu
description: 'Ground plane'
- layer: Inner.5
suffix: Signal1
description: 'Inner signals 1'

View File

@ -0,0 +1,26 @@
kiplot:
version: 1
outputs:
- name: SVG
comment: "SVG files"
type: svg
dir: SVG
options:
exclude_edge_layer: false
exclude_pads_from_silkscreen: false
use_aux_axis_as_origin: false
plot_sheet_reference: false
plot_footprint_refs: true
plot_footprint_values: true
force_plot_invisible_refs_vals: false
tent_vias: true
# SVG options
line_width: 0.25
drill_marks: full
mirror_plot: true
negative_plot: true
layers:
- technical