diff --git a/tests/test_plot/test_pcbdraw.py b/tests/test_plot/test_pcbdraw.py index 5333604b..e9b9ab6d 100644 --- a/tests/test_plot/test_pcbdraw.py +++ b/tests/test_plot/test_pcbdraw.py @@ -105,7 +105,10 @@ def test_pcbdraw_variant_1(): # Check all outputs are there fname = prj+'-top.png' ctx.expect_out_file(fname) - ctx.compare_image(fname) + # We use 30% because different versions of the tools are generating large differences + # in the borders. With 30% these differences are removed and we still detect is a + # components was removed. + ctx.compare_image(fname, fuzz='30%') ctx.clean_up() @@ -116,7 +119,7 @@ def test_pcbdraw_variant_2(): # Check all outputs are there fname = prj+'-top-C1.png' ctx.expect_out_file(fname) - ctx.compare_image(fname) + ctx.compare_image(fname, fuzz='30%') ctx.clean_up() @@ -127,6 +130,6 @@ def test_pcbdraw_variant_3(): # Check all outputs are there fname = prj+'-top.png' ctx.expect_out_file(fname) - ctx.compare_image(fname) + ctx.compare_image(fname, fuzz='30%') assert ctx.search_err("Ambiguous list of components to show .?none.? vs variant/filter") ctx.clean_up() diff --git a/tests/utils/context.py b/tests/utils/context.py index b11b3cff..25ed5e1d 100644 --- a/tests/utils/context.py +++ b/tests/utils/context.py @@ -310,7 +310,7 @@ class TestContext(object): logging.debug(msg+' OK') # logging.debug(' '+m.group(0)) - def compare_image(self, image, reference=None, diff='diff.png', ref_out_dir=False): + def compare_image(self, image, reference=None, diff='diff.png', ref_out_dir=False, fuzz='5%'): """ For images and single page PDFs """ if reference is None: reference = image @@ -320,7 +320,7 @@ class TestContext(object): reference = os.path.join(REF_DIR, reference) cmd = ['compare', # Tolerate 5 % error in color - '-fuzz', '5%', + '-fuzz', fuzz, # Count how many pixels differ '-metric', 'AE', self.get_out_path(image),