Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions DOM/Tests/Parser.SVGTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down