From 956538a32c00048a598016e6771a67db332be699 Mon Sep 17 00:00:00 2001 From: jaseg Date: Wed, 18 Aug 2021 21:39:54 +0200 Subject: svg-flatten: Add multi-exclude/include tests --- svg-flatten/src/test/svg_tests.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'svg-flatten/src') diff --git a/svg-flatten/src/test/svg_tests.py b/svg-flatten/src/test/svg_tests.py index 4db827e..3784c59 100644 --- a/svg-flatten/src/test/svg_tests.py +++ b/svg-flatten/src/test/svg_tests.py @@ -5,6 +5,7 @@ import shutil import unittest from pathlib import Path import subprocess +import itertools import os from PIL import Image @@ -168,20 +169,20 @@ class SVGRoundTripTests(unittest.TestCase): vectorizer_test = test_in_svg.stem.startswith('vectorizer') contours_test = test_in_svg.stem.startswith('contours') - if not vectorizer_test: - run_svg_flatten(test_in_svg, tmp_out_svg.name, format='svg') + + if vectorizer_test: + run_svg_flatten(test_in_svg, tmp_out_svg.name, format='svg', + svg_white_is_gerber_dark=True, + clear_color='black', dark_color='white') elif contours_test: - run_svg_flatten(test_in_svg, tmp_out_svg.name, + run_svg_flatten(test_in_svg, tmp_out_svg.name, format='svg', clear_color='black', dark_color='white', svg_white_is_gerber_dark=True, - format='svg', vectorizer='binary-contours') else: - run_svg_flatten(test_in_svg, tmp_out_svg.name, format='svg', - svg_white_is_gerber_dark=True, - clear_color='black', dark_color='white') + run_svg_flatten(test_in_svg, tmp_out_svg.name, format='svg') if not use_rsvg: # default! run_cargo_cmd('resvg', [tmp_out_svg.name, tmp_out_png.name], check=True, stdout=subprocess.DEVNULL) @@ -216,5 +217,10 @@ for group in ["g0", "g00", "g000", "g0000", "g00000", "g0001", "g001", "g0010", setattr(SVGRoundTripTests, f'test_group_sel_inc_{group}', gen('inc', [group])) setattr(SVGRoundTripTests, f'test_group_sel_exc_{group}', gen('exc', [group])) +for g0, g1 in itertools.product(["g0", "g0000", "g0001", "g0010", "g002","path846-59"], repeat=2): + gen = lambda mode, group: lambda self: self.run_svg_group_selector_test(mode, group) + setattr(SVGRoundTripTests, f'test_group_sel_inc_{g0}_{g1}', gen('inc', [g0, g1])) + setattr(SVGRoundTripTests, f'test_group_sel_exc_{g0}_{g1}', gen('exc', [g0, g1])) + if __name__ == '__main__': unittest.main() -- cgit