aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten/src/test/svg_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'svg-flatten/src/test/svg_tests.py')
-rw-r--r--svg-flatten/src/test/svg_tests.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/svg-flatten/src/test/svg_tests.py b/svg-flatten/src/test/svg_tests.py
index d91bc0d..6afefda 100644
--- a/svg-flatten/src/test/svg_tests.py
+++ b/svg-flatten/src/test/svg_tests.py
@@ -36,12 +36,12 @@ def run_svg_flatten(input_file, output_file, *args, **kwargs):
args.append(str(output_file))
try:
- proc = subprocess.run(args, capture_output=True, check=True)
- except:
+ proc = subprocess.run(args, capture_output=True, check=True, text=True)
+ except subprocess.CalledProcessError as e:
print('Subprocess stdout:')
- print(proc.stdout.decode())
+ print(e.stdout)
print('Subprocess stderr:')
- print(proc.stderr.decode())
+ print(e.stderr)
raise
def run_cargo_cmd(cmd, args, **kwargs):
@@ -213,6 +213,19 @@ class SVGRoundTripTests(unittest.TestCase):
e.args = (msg, *rest)
raise e
+class StrokeMappingTests(unittest.TestCase):
+ def test_stroke_mapping(self):
+ test_in_svg = 'testdata/svg/xform_uniformity_threshold.svg'
+
+ with tempfile.NamedTemporaryFile(suffix='.svg') as tmp_out_svg:
+
+ run_svg_flatten(test_in_svg, tmp_out_svg.name, format='svg')
+
+ with open(tmp_out_svg.name, 'r') as f:
+ num_strokes = sum(1 for l in f.readlines() if 'stroke=' in l)
+ self.assertEqual(num_strokes, 84)
+
+
for test_in_svg in Path('testdata/svg').glob('*.svg'):
# We need to make sure we capture the loop variable's current value here.
gen = lambda testcase: lambda self: self.run_svg_round_trip_test(testcase)