blob: 0d3b12ae8580d21d40e00a3c87424d644d060d51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
from lxml import etree
def d_cmp(orig, new):
""" Compares the original d attribute to the new one. """
orig_list = orig.split()
new_list = new.split()
if len(orig_list) != len(new_list):
return False
# Normalize the final 'z' to uppercase:
orig_list[-1] = orig_list[-1].upper()
new_list[-1] = new_list[-1].upper()
for (o, n) in zip(orig_list, new_list):
if o == n:
continue
numeric = "{:.0f}".format(float(n))
if o != numeric:
return False
return True
document = etree.parse("regression-1364_output.svg")
layer = document.find('{http://www.w3.org/2000/svg}g[@id="layer1"]')
boolop_result = layer.find('{http://www.w3.org/2000/svg}path[@id="small"]')
assert boolop_result.attrib.get("transform") == "scale(2)"
assert d_cmp("M 0 0 L 0 50 A 50 50 0 0 0 50 0 L 0 0 z", boolop_result.attrib.get("d"))
|