Added test for the new SVG output

This commit is contained in:
SET 2020-08-16 17:32:40 -03:00
parent 9b9ae21e9e
commit 15dbf9cce3
3 changed files with 37 additions and 2 deletions

View File

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Salvador E. Tropea
# Copyright (c) 2020 Instituto Nacional de Tecnología Industrial
# Copyright (c) 2020 @nerdyscout
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
import os
from subprocess import (call)
from .gs import (GS)
@ -41,7 +47,7 @@ class SVG_Sch_PrintOptions(BaseOptions):
class SVG_Sch_Print(BaseOutput): # noqa: F821
""" SVG Schematic Print
Exports the PCB. Suitable for printing.
This a format to document your schematic. """
This is a format to document your schematic. """
def __init__(self):
super().__init__()
with document:

View File

@ -15,12 +15,13 @@ import sys
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if prev_dir not in sys.path:
sys.path.insert(0, prev_dir)
from kiplot.misc import (PDF_SCH_PRINT)
from kiplot.misc import (PDF_SCH_PRINT, SVG_SCH_PRINT)
# Utils import
from utils import context
PDF_DIR = ''
PDF_FILE = 'Schematic.pdf'
SVG_FILE = 'Schematic.svg'
def test_print_sch_ok():
@ -37,3 +38,19 @@ def test_print_sch_fail():
ctx = context.TestContext('PrSCHFail', prj, 'print_sch', PDF_DIR)
ctx.run(PDF_SCH_PRINT, no_board_file=True, extra=['-e', os.path.join(ctx.get_board_dir(), 'print_err.sch')])
ctx.clean_up()
def test_print_sch_svg_ok():
prj = 'bom_no_xml' # bom has meta data, here we test no meta-data
ctx = context.TestContext('PrSCH_SVG', prj, 'print_sch_svg', PDF_DIR)
ctx.run()
# Check all outputs are there
ctx.expect_out_file(SVG_FILE)
ctx.clean_up()
def test_print_sch_svg_fail():
prj = '3Rs'
ctx = context.TestContext('PrSCHFail_SVG', prj, 'print_sch_svg', PDF_DIR)
ctx.run(SVG_SCH_PRINT, no_board_file=True, extra=['-e', os.path.join(ctx.get_board_dir(), 'print_err.sch')])
ctx.clean_up()

View File

@ -0,0 +1,12 @@
# Example KiPlot config file
kiplot:
version: 1
outputs:
- name: 'print_sch_svg'
comment: "Print schematic (SVG)"
type: svg_sch_print
dir: .
options:
output: Schematic.svg