Adapted the test_print_sch.py tests to KiCad v6
This commit is contained in:
parent
926d4c84d3
commit
3c4c2f0e15
|
|
@ -0,0 +1,122 @@
|
|||
(kicad_sch (version 20211123) (generator eeschema)
|
||||
|
||||
(uuid e6521bef-4109-48f7-8b88-4121b0468927)
|
||||
|
||||
(paper "A4")
|
||||
|
||||
(title_block
|
||||
(title "KiBom Test Schematic")
|
||||
(date "2020-03-12")
|
||||
(rev "A")
|
||||
(company "https://github.com/SchrodingersGat/KiBom")
|
||||
)
|
||||
|
||||
(lib_symbols
|
||||
)
|
||||
|
||||
|
||||
(text "This schematic serves as a test file for the KiBot export script.\nHere we have a component without lib (from old KiCad?) \nand another that isn't in any lib."
|
||||
(at 13.97 26.67 0)
|
||||
(effects (font (size 2.9972 2.9972)) (justify left bottom))
|
||||
(uuid 646d9e91-59b4-4865-a2fc-29780ed32563)
|
||||
)
|
||||
|
||||
(symbol (lib_id "l1:C") (at 25.4 43.18 0) (unit 1)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f43bec2)
|
||||
(property "Reference" "C1" (id 0) (at 28.321 42.0116 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Value" "1nF" (id 1) (at 28.321 44.323 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Footprint" "Capacitor_SMD:C_0805_2012Metric" (id 2) (at 26.3652 46.99 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "~" (id 3) (at 25.4 43.18 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Config" "T2" (id 4) (at 25.4 43.18 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
)
|
||||
|
||||
(symbol (lib_id "l1:C") (at 36.83 43.18 0) (unit 1)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f43ce1c)
|
||||
(property "Reference" "C2" (id 0) (at 39.751 42.0116 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Value" "1000 pF" (id 1) (at 39.751 44.323 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Footprint" "Capacitor_SMD:C_0805_2012Metric" (id 2) (at 37.7952 46.99 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "~" (id 3) (at 36.83 43.18 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Config" "T3" (id 4) (at 36.83 43.18 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
)
|
||||
|
||||
(symbol (lib_id "Resistor") (at 53.34 43.18 0) (unit 1)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f43d144)
|
||||
(property "Reference" "R1" (id 0) (at 55.118 42.0116 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Value" "1k" (id 1) (at 55.118 44.323 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Footprint" "Resistor_SMD:R_0805_2012Metric" (id 2) (at 51.562 43.18 90)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "~" (id 3) (at 53.34 43.18 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Config" "default" (id 4) (at 53.34 43.18 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
)
|
||||
|
||||
(symbol (lib_id "l1:FooBar") (at 63.5 43.18 0) (unit 1)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f43d4bb)
|
||||
(property "Reference" "R2" (id 0) (at 65.278 42.0116 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Value" "1000" (id 1) (at 65.278 44.323 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Footprint" "Resistor_SMD:R_0805_2012Metric" (id 2) (at 61.722 43.18 90)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "~" (id 3) (at 63.5 43.18 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Config" "T1" (id 4) (at 63.5 43.18 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
)
|
||||
|
||||
(sheet_instances
|
||||
(path "/" (page "1"))
|
||||
)
|
||||
|
||||
(symbol_instances
|
||||
(path "/00000000-0000-0000-0000-00005f43bec2"
|
||||
(reference "C1") (unit 1) (value "1nF") (footprint "Capacitor_SMD:C_0805_2012Metric")
|
||||
)
|
||||
(path "/00000000-0000-0000-0000-00005f43ce1c"
|
||||
(reference "C2") (unit 1) (value "1000 pF") (footprint "Capacitor_SMD:C_0805_2012Metric")
|
||||
)
|
||||
(path "/00000000-0000-0000-0000-00005f43d144"
|
||||
(reference "R1") (unit 1) (value "1k") (footprint "Resistor_SMD:R_0805_2012Metric")
|
||||
)
|
||||
(path "/00000000-0000-0000-0000-00005f43d4bb"
|
||||
(reference "R2") (unit 1) (value "1000") (footprint "Resistor_SMD:R_0805_2012Metric")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
(kicad_sch (version 21211123) (generator eeschema)
|
||||
|
||||
(uuid 3b838d52-596d-4e4d-a6ac-e4c8e7621137)
|
||||
|
||||
(paper "A4")
|
||||
)
|
||||
|
|
@ -1 +0,0 @@
|
|||
../5_1_6/test_v5-schematic_(no_L).pdf
|
||||
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
../5_1_6/test_v5-schematic_(no_L).svg
|
||||
|
Before Width: | Height: | Size: 37 B After Width: | Height: | Size: 178 KiB |
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 37 B After Width: | Height: | Size: 178 KiB |
|
|
@ -19,6 +19,7 @@ if prev_dir not in sys.path:
|
|||
sys.path.insert(0, prev_dir)
|
||||
from kibot.misc import (PDF_SCH_PRINT, SVG_SCH_PRINT)
|
||||
from kibot.kicad.v5_sch import Schematic, SchFileError, DrawPoligon, Pin
|
||||
from kibot.kicad.v6_sch import SchematicV6
|
||||
from kibot.globals import Globals
|
||||
# Utils import
|
||||
from utils import context
|
||||
|
|
@ -40,9 +41,10 @@ def test_print_sch_ok(test_dir):
|
|||
|
||||
|
||||
def test_print_sch_fail(test_dir):
|
||||
prj = '3Rs'
|
||||
ctx = context.TestContext(test_dir, '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')])
|
||||
prj = 'print_err'
|
||||
ctx = context.TestContextSCH(test_dir, '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'+context.KICAD_SCH_EXT)])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -64,12 +66,12 @@ def test_print_sch_svg_fail(test_dir):
|
|||
|
||||
def check_l1(ctx):
|
||||
ctx.run()
|
||||
o_name = os.path.join(NI_DIR, 'test_v5.sch')
|
||||
o_name = os.path.join(NI_DIR, 'test_v5'+context.KICAD_SCH_EXT)
|
||||
ctx.expect_out_file(o_name)
|
||||
glb = Globals()
|
||||
glb.set_tree({})
|
||||
glb.config(None)
|
||||
sch = Schematic()
|
||||
sch = Schematic() if context.ki5() else SchematicV6()
|
||||
try:
|
||||
sch.load(ctx.get_out_path(o_name), 'no_project')
|
||||
except SchFileError as e:
|
||||
|
|
@ -80,7 +82,8 @@ def check_l1(ctx):
|
|||
l1 = next(c for c in comps if c.ref == 'L1')
|
||||
assert l1
|
||||
logging.debug('Found L1')
|
||||
assert l1.lib == 'n'
|
||||
lib_name = 'n' if context.ki5() else 'kibot_crossed'
|
||||
assert l1.lib == lib_name
|
||||
logging.debug('L1 is crossed')
|
||||
ctx.clean_up()
|
||||
|
||||
|
|
@ -141,12 +144,12 @@ def test_sch_missing_1(test_dir):
|
|||
prj = 'missing'
|
||||
ctx = context.TestContextSCH(test_dir, 'test_sch_missing_1', prj, 'sch_no_inductors_1', PDF_DIR)
|
||||
ctx.run()
|
||||
o_name = os.path.join(NI_DIR, prj+'.sch')
|
||||
o_name = os.path.join(NI_DIR, prj+context.KICAD_SCH_EXT)
|
||||
ctx.expect_out_file(o_name)
|
||||
ctx.search_err("Component .?Resistor.? doesn't specify its library")
|
||||
ctx.search_err("Missing component .?l1:FooBar.?")
|
||||
ctx.search_err("Missing component(.*)Resistor", invert=True)
|
||||
ctx.search_err("Missing doc-lib entry for l1:C")
|
||||
ctx.search_err("Missing component(.*)Resistor", invert=context.ki5())
|
||||
ctx.search_err("Missing doc-lib entry for l1:C", invert=(not context.ki5()))
|
||||
ctx.search_out(r"Found 4 unique warning/s \(")
|
||||
ctx.clean_up()
|
||||
|
||||
|
|
@ -157,12 +160,12 @@ def test_sch_missing_filtered(test_dir):
|
|||
prj = 'missing'
|
||||
ctx = context.TestContextSCH(test_dir, 'test_sch_missing_filtered', prj, 'sch_no_inductors_1_filtered', PDF_DIR)
|
||||
ctx.run()
|
||||
o_name = os.path.join(NI_DIR, prj+'.sch')
|
||||
o_name = os.path.join(NI_DIR, prj+context.KICAD_SCH_EXT)
|
||||
ctx.expect_out_file(o_name)
|
||||
ctx.search_err("Component .?Resistor.? doesn't specify its library")
|
||||
ctx.search_err("Missing component .?l1:FooBar.?", invert=True)
|
||||
ctx.search_err("Missing component(.*)Resistor", invert=True)
|
||||
ctx.search_err("Missing doc-lib entry for l1:C")
|
||||
ctx.search_err("Missing component(.*)Resistor", invert=context.ki5())
|
||||
ctx.search_err("Missing doc-lib entry for l1:C", invert=(not context.ki5()))
|
||||
ctx.search_out(r"Found 3 unique warning/s \(\d+ total, \d+ filtered\)")
|
||||
ctx.clean_up()
|
||||
|
||||
|
|
@ -170,6 +173,9 @@ def test_sch_missing_filtered(test_dir):
|
|||
def test_sch_bizarre_cases(test_dir):
|
||||
""" Poligon without points.
|
||||
Pin with unknown direction. """
|
||||
if not context.ki5():
|
||||
# This is very KiCad 5 loader specific
|
||||
return
|
||||
pol = DrawPoligon()
|
||||
pol.points = 0
|
||||
pol.coords = []
|
||||
|
|
|
|||
Loading…
Reference in New Issue