diff --git a/DOM/Tests/Parser.SVGTests.swift b/DOM/Tests/Parser.SVGTests.swift index 4abb011..b1fc05e 100644 --- a/DOM/Tests/Parser.SVGTests.swift +++ b/DOM/Tests/Parser.SVGTests.swift @@ -56,6 +56,18 @@ struct ParserSVGTests { #expect(parsed != expected2) } + @Test + func svgWithUnits() throws { + let node = XML.Element(name: "svg", attributes: ["width": "10cm", "height": "2in"]) + let parser = DOMXMLParser() + + let parsed = try parser.parseSVG(node) + // 10cm = 10 * 37.795 = 377.95 → truncated to 377 + #expect(parsed.width == 377) + // 2in = 2 * 96 = 192 + #expect(parsed.height == 192) + } + @Test func parseSVGInvalidNode() { let node = XML.Element(name: "svg2", attributes: ["width": "100", "height": "200"])