[Diff][Fixed] Always comparing the PCB

- Added regression test

Fixes #273
This commit is contained in:
Salvador E. Tropea 2022-09-02 07:03:57 -03:00
parent 2b54d8320a
commit cabf14ec07
9 changed files with 7975 additions and 5 deletions

View File

@ -97,7 +97,7 @@ class DiffOptions(BaseOptions):
def config(self, parent):
super().config(parent)
self._expand_id = 'diff'+'_pcb' if self.pcb else '_sch'
self._expand_id = 'diff'+('_pcb' if self.pcb else '_sch')
def get_targets(self, out_dir):
return [self._parent.expand_filename(out_dir, self.output)]
@ -257,7 +257,12 @@ class DiffOptions(BaseOptions):
self.cache_dir = mkdtemp()
remove_cache = True
# A valid name, not really used
file = GS.pcb_file or GS.sch_file
if self.pcb:
GS.check_pcb()
file = GS.pcb_file
else:
GS.check_sch()
file = GS.sch_file
dir_name = os.path.dirname(name)
file_name = os.path.basename(name)
self.incl_file = None

View File

@ -1 +0,0 @@
light_control.sch

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
light_control.kicad_sch

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1 @@
../5_1_6/light_control_diff-diff_sch.pdf

Binary file not shown.

View File

@ -1274,7 +1274,7 @@ def test_diff_file_1(test_dir):
yaml = 'diff_file_'+('k5' if context.ki5() else 'k6')
ctx = context.TestContext(test_dir, prj, yaml)
ctx.run()
ctx.compare_pdf(prj+'-diff.pdf', reference='light_control-diff.pdf')
ctx.compare_pdf(prj+'-diff_pcb.pdf', reference='light_control-diff_pcb.pdf')
ctx.clean_up(keep_project=True)
@ -1374,3 +1374,13 @@ def test_diff_git_3(test_dir):
ctx.run(extra=['-b', file], no_board_file=True, extra_debug=True)
ctx.compare_pdf(prj+'-diff_pcb.pdf')
ctx.clean_up(keep_project=True)
def test_diff_file_sch_1(test_dir):
""" Difference between the current Schematic and a reference file """
prj = 'light_control_diff'
yaml = 'diff_file_sch_'+('k5' if context.ki5() else 'k6')
ctx = context.TestContext(test_dir, prj, yaml)
ctx.run()
ctx.compare_pdf(prj+'-diff_sch.pdf')
ctx.clean_up(keep_project=True)

View File

@ -0,0 +1,12 @@
kibot:
version: 1
outputs:
- name: 'diff_sch'
comment: "Schematic difference with reference file (KiCad 5)"
type: diff
options:
old: tests/board_samples/kicad_5/light_control.sch
pcb: false
old_type: file
cache_dir: .cache

View File

@ -0,0 +1,12 @@
kibot:
version: 1
outputs:
- name: 'diff_sch'
comment: "Schematic difference with reference file (KiCad 6)"
type: diff
options:
old: tests/board_samples/kicad_6/light_control.kicad_sch
pcb: false
old_type: file
cache_dir: .cache