Added HPGL and PS autoscaling tests.

Added test for example in a dir that must be created.
Removed code not used in docstring trim.
This commit is contained in:
Salvador E. Tropea 2020-07-08 23:16:04 -03:00
parent 8f17733354
commit 995b6990aa
6 changed files with 61 additions and 7 deletions

View File

@ -164,8 +164,8 @@ def trim(docstring):
for line in lines[1:]:
trimmed.append(line[indent:].rstrip())
# Strip off trailing and leading blank lines:
while trimmed and not trimmed[-1]:
trimmed.pop()
# while trimmed and not trimmed[-1]:
# trimmed.pop()
while trimmed and not trimmed[0]:
trimmed.pop(0)
# Return a single string:

View File

@ -30,3 +30,17 @@ def test_hpgl():
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
def test_hpgl_auto():
prj = 'simple_2layer'
ctx = context.TestContext('HPGLAuto', prj, 'hpgl_auto', PS_DIR)
ctx.run()
f_cu = ctx.get_gerber_filename('F_Cu', '.plt')
f_silk = ctx.get_gerber_filename('B_Silks', '.plt')
ctx.expect_out_file(f_cu)
ctx.expect_out_file(f_silk)
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()

View File

@ -325,6 +325,13 @@ def test_help_output():
ctx.clean_up()
def test_help_output_unk():
ctx = context.TestContext('HelpOutputUnk', '3Rs', 'pre_and_position', POS_DIR)
ctx.run(EXIT_BAD_ARGS, extra=['--help-output', 'bogus'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
assert ctx.search_err('Unknown output type')
ctx.clean_up()
def test_help_outputs():
ctx = context.TestContext('HelpOutputs', '3Rs', 'pre_and_position', POS_DIR)
ctx.run(extra=['--help-outputs'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
@ -379,9 +386,11 @@ def test_example_4():
def test_example_5():
""" Copy setting from PCB """
ctx = context.TestContext('Example5', 'good-project', 'pre_and_position', '')
ctx.run(extra=['--example', '-p'], no_verbose=True, no_yaml_file=True)
assert ctx.expect_out_file(EXAMPLE_CFG)
ctx.search_in_file(EXAMPLE_CFG, ['layers: selected', 'pen_width: 35.0'])
output_dir = os.path.join(ctx.output_dir, 'pp')
ctx.run(extra=['--example', '-p', '-d', output_dir], no_verbose=True, no_yaml_file=True, no_out_dir=True)
file = os.path.join('pp', EXAMPLE_CFG)
assert ctx.expect_out_file(file)
ctx.search_in_file(file, ['layers: selected', 'pen_width: 35.0'])
ctx.clean_up()

View File

@ -34,7 +34,7 @@ def test_ps():
def test_ps_auto():
prj = 'simple_2layer'
ctx = context.TestContext('Postscript', prj, 'ps_auto', PS_DIR)
ctx = context.TestContext('PostscriptAuto', prj, 'ps_auto', PS_DIR)
ctx.run()
f_cu = ctx.get_gerber_filename('F_Cu', '.ps')

View File

@ -19,7 +19,7 @@ outputs:
drill_marks: full
mirror_plot: true
sketch_plot: false
scaling: 0 # auto
scaling: 1
pen_number: 2
pen_speed: 50
pen_width: 0.5

View File

@ -0,0 +1,31 @@
kiplot:
version: 1
outputs:
- name: HPGL
comment: "HPGL files"
type: hpgl
dir: HPGL
options:
exclude_edge_layer: false
exclude_pads_from_silkscreen: false
plot_sheet_reference: false
plot_footprint_refs: true
plot_footprint_values: true
force_plot_invisible_refs_vals: false
tent_vias: true
# HPGL options
drill_marks: full
mirror_plot: true
sketch_plot: false
scaling: 0 # auto
pen_number: 2
pen_speed: 50
pen_width: 0.5
layers:
- layer: F.Cu
suffix: F_Cu
- layer: B.SilkS
suffix: B_Silks