diff --git a/Macaw.xcodeproj/project.pbxproj b/Macaw.xcodeproj/project.pbxproj index 66f5be7e..934c7325 100644 --- a/Macaw.xcodeproj/project.pbxproj +++ b/Macaw.xcodeproj/project.pbxproj @@ -522,6 +522,16 @@ A74C822B2297D5350085A832 /* coords-trans-14-f-manual.reference in Resources */ = {isa = PBXBuildFile; fileRef = A74C82262297D5340085A832 /* coords-trans-14-f-manual.reference */; }; A74C822C2297D5350085A832 /* coords-trans-10-f-manual.reference in Resources */ = {isa = PBXBuildFile; fileRef = A74C82272297D5340085A832 /* coords-trans-10-f-manual.reference */; }; A74C822D2297D5350085A832 /* coords-trans-13-f-manual.reference in Resources */ = {isa = PBXBuildFile; fileRef = A74C82282297D5350085A832 /* coords-trans-13-f-manual.reference */; }; + A74C82322297D8B40085A832 /* shapes-rect-06-f-manual.svg in Resources */ = {isa = PBXBuildFile; fileRef = A74C822E2297D8B30085A832 /* shapes-rect-06-f-manual.svg */; }; + A74C82332297D8B40085A832 /* shapes-rect-02-t-manual.svg in Resources */ = {isa = PBXBuildFile; fileRef = A74C822F2297D8B30085A832 /* shapes-rect-02-t-manual.svg */; }; + A74C82342297D8B40085A832 /* shapes-rect-03-t-manual.svg in Resources */ = {isa = PBXBuildFile; fileRef = A74C82302297D8B30085A832 /* shapes-rect-03-t-manual.svg */; }; + A74C82352297D8B40085A832 /* shapes-rect-07-f-manual.svg in Resources */ = {isa = PBXBuildFile; fileRef = A74C82312297D8B40085A832 /* shapes-rect-07-f-manual.svg */; }; + A74C823C2297DB2C0085A832 /* shapes-rect-07-f-manual.reference in Resources */ = {isa = PBXBuildFile; fileRef = A74C82382297DB2B0085A832 /* shapes-rect-07-f-manual.reference */; }; + A74C823E2297DB2C0085A832 /* shapes-rect-03-t-manual.reference in Resources */ = {isa = PBXBuildFile; fileRef = A74C823A2297DB2B0085A832 /* shapes-rect-03-t-manual.reference */; }; + A74C823F2297DB2C0085A832 /* shapes-rect-06-f-manual.reference in Resources */ = {isa = PBXBuildFile; fileRef = A74C823B2297DB2B0085A832 /* shapes-rect-06-f-manual.reference */; }; + A74C82412297DC220085A832 /* shapes-rect-02-t-manual.reference in Resources */ = {isa = PBXBuildFile; fileRef = A74C82402297DC220085A832 /* shapes-rect-02-t-manual.reference */; }; + A74C82032296BE5F0085A832 /* paths-data-20-f-manual.svg in Resources */ = {isa = PBXBuildFile; fileRef = A74C82022296BE5F0085A832 /* paths-data-20-f-manual.svg */; }; + A74C82052296BFC60085A832 /* paths-data-20-f-manual.reference in Resources */ = {isa = PBXBuildFile; fileRef = A74C82042296BFC60085A832 /* paths-data-20-f-manual.reference */; }; A7E675561EC4213500BD9ECB /* NodeBoundsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7E675551EC4213500BD9ECB /* NodeBoundsTests.swift */; }; C410148E1F834D290022EE44 /* style.svg in Resources */ = {isa = PBXBuildFile; fileRef = C410148D1F834D280022EE44 /* style.svg */; }; C4153A8F1F8793DE001BA5EE /* small-logo.png in Resources */ = {isa = PBXBuildFile; fileRef = C4153A8E1F8793DD001BA5EE /* small-logo.png */; }; @@ -951,6 +961,16 @@ A74C82262297D5340085A832 /* coords-trans-14-f-manual.reference */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "coords-trans-14-f-manual.reference"; sourceTree = ""; }; A74C82272297D5340085A832 /* coords-trans-10-f-manual.reference */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "coords-trans-10-f-manual.reference"; sourceTree = ""; }; A74C82282297D5350085A832 /* coords-trans-13-f-manual.reference */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "coords-trans-13-f-manual.reference"; sourceTree = ""; }; + A74C822E2297D8B30085A832 /* shapes-rect-06-f-manual.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "shapes-rect-06-f-manual.svg"; sourceTree = ""; }; + A74C822F2297D8B30085A832 /* shapes-rect-02-t-manual.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "shapes-rect-02-t-manual.svg"; sourceTree = ""; }; + A74C82302297D8B30085A832 /* shapes-rect-03-t-manual.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "shapes-rect-03-t-manual.svg"; sourceTree = ""; }; + A74C82312297D8B40085A832 /* shapes-rect-07-f-manual.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "shapes-rect-07-f-manual.svg"; sourceTree = ""; }; + A74C82382297DB2B0085A832 /* shapes-rect-07-f-manual.reference */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "shapes-rect-07-f-manual.reference"; sourceTree = ""; }; + A74C823A2297DB2B0085A832 /* shapes-rect-03-t-manual.reference */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "shapes-rect-03-t-manual.reference"; sourceTree = ""; }; + A74C823B2297DB2B0085A832 /* shapes-rect-06-f-manual.reference */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "shapes-rect-06-f-manual.reference"; sourceTree = ""; }; + A74C82402297DC220085A832 /* shapes-rect-02-t-manual.reference */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "shapes-rect-02-t-manual.reference"; sourceTree = ""; }; + A74C82022296BE5F0085A832 /* paths-data-20-f-manual.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "paths-data-20-f-manual.svg"; sourceTree = ""; }; + A74C82042296BFC60085A832 /* paths-data-20-f-manual.reference */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "paths-data-20-f-manual.reference"; sourceTree = ""; }; A7E675551EC4213500BD9ECB /* NodeBoundsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NodeBoundsTests.swift; path = Bounds/NodeBoundsTests.swift; sourceTree = ""; }; C410148D1F834D280022EE44 /* style.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = style.svg; sourceTree = ""; }; C4153A8E1F8793DD001BA5EE /* small-logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "small-logo.png"; sourceTree = ""; }; @@ -1522,6 +1542,8 @@ 5BFEF5D420BC1C1E008DAC11 /* paths-data-18-f-manual.svg */, 5B1AE1D720B6A669007EECCB /* paths-data-19-f-manual.reference */, 5B1AE21A20B6A669007EECCB /* paths-data-19-f-manual.svg */, + A74C82022296BE5F0085A832 /* paths-data-20-f-manual.svg */, + A74C82042296BFC60085A832 /* paths-data-20-f-manual.reference */, 5B37139620BE95D7004BB6EE /* pservers-grad-01-b-manual.reference */, 5B37139220BE95D6004BB6EE /* pservers-grad-01-b-manual.svg */, 5B37139320BE95D6004BB6EE /* pservers-grad-02-b-manual.reference */, @@ -1566,10 +1588,18 @@ 5B1AE1BA20B6A669007EECCB /* shapes-polyline-01-t-manual.svg */, 5B1AE1AF20B6A669007EECCB /* shapes-polyline-02-t-manual.reference */, 5B1AE1E120B6A669007EECCB /* shapes-polyline-02-t-manual.svg */, + A74C82402297DC220085A832 /* shapes-rect-02-t-manual.reference */, + A74C822F2297D8B30085A832 /* shapes-rect-02-t-manual.svg */, + A74C823A2297DB2B0085A832 /* shapes-rect-03-t-manual.reference */, + A74C82302297D8B30085A832 /* shapes-rect-03-t-manual.svg */, 5B1AE22520B6A669007EECCB /* shapes-rect-04-f-manual.reference */, 5B1AE1CE20B6A669007EECCB /* shapes-rect-04-f-manual.svg */, 5B1AE19620B6A669007EECCB /* shapes-rect-05-f-manual.reference */, 5B1AE1B720B6A669007EECCB /* shapes-rect-05-f-manual.svg */, + A74C823B2297DB2B0085A832 /* shapes-rect-06-f-manual.reference */, + A74C822E2297D8B30085A832 /* shapes-rect-06-f-manual.svg */, + A74C82382297DB2B0085A832 /* shapes-rect-07-f-manual.reference */, + A74C82312297D8B40085A832 /* shapes-rect-07-f-manual.svg */, 5B1AE22220B6A669007EECCB /* struct-defs-01-t-manual.reference */, 5B1AE22E20B6A669007EECCB /* struct-defs-01-t-manual.svg */, 5B1AE19720B6A669007EECCB /* struct-frag-01-t-manual.reference */, @@ -1800,6 +1830,7 @@ 5BAE203C208E163D006BF277 /* triangle.reference in Resources */, C4153A8F1F8793DE001BA5EE /* small-logo.png in Resources */, 5BAE2048208E163D006BF277 /* line.reference in Resources */, + A74C82322297D8B40085A832 /* shapes-rect-06-f-manual.svg in Resources */, 5B1AE2A420B6A669007EECCB /* paths-data-12-t-manual.reference in Resources */, 57CAB1361D7832E000FD8E47 /* triangle.svg in Resources */, 5B7E79CF20CBE69700C50BCF /* masking-path-02-b-manual.svg in Resources */, @@ -1821,6 +1852,7 @@ 5B1AE2B820B6A669007EECCB /* painting-stroke-03-t-manual.reference in Resources */, 4269F43E2257265800D91393 /* color-prop-04-t-manual.reference in Resources */, 5B1AE2C720B6A669007EECCB /* paths-data-02-t-manual.svg in Resources */, + A74C823C2297DB2C0085A832 /* shapes-rect-07-f-manual.reference in Resources */, 5B1AE27120B6A669007EECCB /* painting-stroke-04-t-manual.reference in Resources */, 5B1AE2C220B6A669007EECCB /* coords-trans-05-t-manual.svg in Resources */, 5B1AE29D20B6A669007EECCB /* types-basic-01-f-manual.reference in Resources */, @@ -1840,6 +1872,7 @@ 5BAE2040208E163D006BF277 /* ellipse.reference in Resources */, 5B1AE27E20B6A669007EECCB /* coords-transformattr-02-f-manual.reference in Resources */, 5B1AE25720B6A669007EECCB /* coords-trans-07-t-manual.svg in Resources */, + A74C823F2297DB2C0085A832 /* shapes-rect-06-f-manual.reference in Resources */, 5B1AE2BC20B6A669007EECCB /* coords-coord-02-t-manual.svg in Resources */, 5B1AE23520B6A669007EECCB /* shapes-line-02-f-manual.reference in Resources */, 5B1AE2CD20B6A669007EECCB /* paths-data-10-t-manual.svg in Resources */, @@ -1847,9 +1880,11 @@ 5B1AE29320B6A669007EECCB /* coords-trans-09-t-manual.svg in Resources */, 5B1AE2DC20B6A669007EECCB /* struct-defs-01-t-manual.svg in Resources */, A74C821F2297D4810085A832 /* coords-trans-13-f-manual.svg in Resources */, + A74C82052296BFC60085A832 /* paths-data-20-f-manual.reference in Resources */, 5B1AE29020B6A669007EECCB /* painting-stroke-08-t-manual.svg in Resources */, 5B1AE2A720B6A669007EECCB /* paths-data-09-t-manual.svg in Resources */, 5B1AE2AB20B6A669007EECCB /* painting-stroke-08-t-manual.reference in Resources */, + A74C82352297D8B40085A832 /* shapes-rect-07-f-manual.svg in Resources */, 5B1AE2A520B6A669007EECCB /* coords-trans-02-t-manual.reference in Resources */, 5B1AE23220B6A669007EECCB /* text-align-01-b-manual.svg in Resources */, 5B1AE2B220B6A669007EECCB /* types-basic-01-f-manual.svg in Resources */, @@ -1865,6 +1900,7 @@ A74C822C2297D5350085A832 /* coords-trans-10-f-manual.reference in Resources */, 5B1AE24520B6A669007EECCB /* struct-frag-01-t-manual.reference in Resources */, 5B1AE25B20B6A669007EECCB /* painting-stroke-01-t-manual.svg in Resources */, + A74C823E2297DB2C0085A832 /* shapes-rect-03-t-manual.reference in Resources */, 5BAE2047208E163D006BF277 /* viewBox.reference in Resources */, 5B1AE2C120B6A669007EECCB /* painting-stroke-04-t-manual.svg in Resources */, 5B1AE2BE20B6A669007EECCB /* painting-stroke-03-t-manual.svg in Resources */, @@ -1897,11 +1933,13 @@ 5B1AE2CF20B6A669007EECCB /* paths-data-07-t-manual.reference in Resources */, 5B1AE28D20B6A669007EECCB /* shapes-circle-01-t-manual.reference in Resources */, 5B1AE2A320B6A669007EECCB /* painting-fill-01-t-manual.svg in Resources */, + A74C82332297D8B40085A832 /* shapes-rect-02-t-manual.svg in Resources */, 5B1AE2CB20B6A669007EECCB /* painting-fill-02-t-manual.reference in Resources */, 5B1AE26520B6A669007EECCB /* shapes-rect-05-f-manual.svg in Resources */, 5B1AE2D120B6A669007EECCB /* paths-data-03-f-manual.reference in Resources */, 5B1AE28920B6A669007EECCB /* shapes-intro-01-t-manual.reference in Resources */, 5B1AE2C020B6A669007EECCB /* paths-data-14-t-manual.reference in Resources */, + A74C82032296BE5F0085A832 /* paths-data-20-f-manual.svg in Resources */, 5B1AE27420B6A669007EECCB /* color-prop-02-f-manual.svg in Resources */, 5B1AE25120B6A669007EECCB /* coords-trans-05-t-manual.reference in Resources */, 5B1AE29120B6A669007EECCB /* coords-transformattr-01-f-manual.svg in Resources */, @@ -1922,6 +1960,7 @@ 5B1AE28220B6A669007EECCB /* coords-coord-01-t-manual.reference in Resources */, A74C81F32292B45E0085A832 /* color-prop-05-t-manual.reference in Resources */, 5B1AE23420B6A669007EECCB /* painting-control-03-f-manual.reference in Resources */, + A74C82342297D8B40085A832 /* shapes-rect-03-t-manual.svg in Resources */, 5B1AE26820B6A669007EECCB /* shapes-polyline-01-t-manual.svg in Resources */, 5B1AE29A20B6A669007EECCB /* struct-frag-02-t-manual.svg in Resources */, 5B1AE2A620B6A669007EECCB /* text-fonts-01-t-manual.svg in Resources */, @@ -1952,6 +1991,7 @@ 5B1AE26A20B6A669007EECCB /* painting-control-06-f-manual.reference in Resources */, C46E83551F94B20E00208037 /* transform.svg in Resources */, 5B1AE2C420B6A669007EECCB /* painting-fill-01-t-manual.reference in Resources */, + A74C82412297DC220085A832 /* shapes-rect-02-t-manual.reference in Resources */, 5B1AE2AE20B6A669007EECCB /* shapes-circle-02-t-manual.reference in Resources */, 5B1AE29520B6A669007EECCB /* shapes-ellipse-03-f-manual.reference in Resources */, 5B1AE23820B6A669007EECCB /* color-prop-01-b-manual.svg in Resources */, diff --git a/MacawTests/MacawSVGTests.swift b/MacawTests/MacawSVGTests.swift index d1135c43..e6755d8a 100644 --- a/MacawTests/MacawSVGTests.swift +++ b/MacawTests/MacawSVGTests.swift @@ -393,10 +393,30 @@ class MacawSVGTests: XCTestCase { validateJSON("painting-fill-03-t-manual") } + func testShapesRect02() { + validateJSON("shapes-rect-02-t-manual") + } + + func testShapesRect03() { + validateJSON("shapes-rect-03-t-manual") + } + + func testShapesRect04() { + validateJSON("shapes-rect-04-f-manual") + } + func testShapesRect05() { validateJSON("shapes-rect-05-f-manual") } + func testShapesRect06() { + validateJSON("shapes-rect-06-f-manual") + } + + func testShapesRect07() { + validateJSON("shapes-rect-07-f-manual") + } + func testPaintingFill04() { validateJSON("painting-fill-04-t-manual") } @@ -437,10 +457,6 @@ class MacawSVGTests: XCTestCase { validateJSON("painting-fill-02-t-manual") } - func testShapesRect04() { - validateJSON("shapes-rect-04-f-manual") - } - func testCoordsTransformattr03() { validateJSON("coords-transformattr-03-f-manual") } @@ -557,6 +573,10 @@ class MacawSVGTests: XCTestCase { validateJSON("paths-data-19-f-manual") } + func testPathsData20() { + validateJSON("paths-data-20-f-manual") + } + func testStructGroup01() { validateJSON("struct-group-01-t-manual") } diff --git a/MacawTests/w3c-test-suite.md b/MacawTests/w3c-test-suite.md index 4d15d351..111fc7ba 100644 --- a/MacawTests/w3c-test-suite.md +++ b/MacawTests/w3c-test-suite.md @@ -10,12 +10,12 @@ There are [521 SVG tests](https://github.com/web-platform-tests/wpt/tree/master/ * [switch/object](https://www.w3.org/TR/SVG11/backward.html) (7) The rest 306 tests can be split into following categories: -* 31.4% passed (96) +* 31.7% passed (97) * 14.1% filters (43) [#390](https://github.com/exyte/Macaw/issues/390) * 7.8% images (24) [wpt issue](https://github.com/web-platform-tests/wpt/issues/11178) * 2.6% markers (8) [#392](https://github.com/exyte/Macaw/issues/392) * 19.9% text (61) [#391](https://github.com/exyte/Macaw/issues/391) -* 24.5% blocked by issues (75) +* 24.2% blocked by issues (75) Status of each test: @@ -183,7 +183,7 @@ Status of each test: |[paths-data-17-f-manual](w3cSVGTests/paths-data-17-f-manual.svg) | ✅ | |[paths-data-18-f-manual](w3cSVGTests/paths-data-18-f-manual.svg) | ✅ | |[paths-data-19-f-manual](w3cSVGTests/paths-data-19-f-manual.svg) | ✅ | -|[paths-data-20-f-manual](w3cSVGTests/paths-data-20-f-manual.svg) | [#395](https://github.com/exyte/Macaw/issues/395) | +|[paths-data-20-f-manual](w3cSVGTests/paths-data-20-f-manual.svg) | ✅ | |[pservers-grad-01-b-manual](w3cSVGTests/pservers-grad-01-b-manual.svg) | ✅ | |[pservers-grad-02-b-manual](w3cSVGTests/pservers-grad-02-b-manual.svg) | ✅ | |[pservers-grad-03-b-manual](w3cSVGTests/pservers-grad-03-b-manual.svg) | ✅ | diff --git a/MacawTests/w3cSVGTests/paths-data-20-f-manual.reference b/MacawTests/w3cSVGTests/paths-data-20-f-manual.reference new file mode 100644 index 00000000..c9be2934 --- /dev/null +++ b/MacawTests/w3cSVGTests/paths-data-20-f-manual.reference @@ -0,0 +1,793 @@ +{ + "contents" : [ + { + "contents" : [ + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "segments" : [ + { + "data" : [ + 120, + 120 + ], + "type" : "M" + }, + { + "data" : [ + 25 + ], + "type" : "h" + }, + { + "data" : [ + 25, + 25, + 0, + 1, + 0, + -25, + 25 + ], + "type" : "a" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "segments" : [ + { + "data" : [ + 120, + 120 + ], + "type" : "M" + }, + { + "data" : [ + 25 + ], + "type" : "h" + }, + { + "data" : [ + 25, + 25, + 0, + 1, + 0, + -25, + 25 + ], + "type" : "a" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "segments" : [ + { + "data" : [ + 200, + 120 + ], + "type" : "M" + }, + { + "data" : [ + -25 + ], + "type" : "h" + }, + { + "data" : [ + 25, + 25, + 0, + 1, + 1, + 25, + 25 + ], + "type" : "a" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "segments" : [ + { + "data" : [ + 200, + 120 + ], + "type" : "M" + }, + { + "data" : [ + -25 + ], + "type" : "h" + }, + { + "data" : [ + 25, + 25, + 0, + 1, + 1, + 25, + 25 + ], + "type" : "a" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "segments" : [ + { + "data" : [ + 280, + 120 + ], + "type" : "M" + }, + { + "data" : [ + 25 + ], + "type" : "h" + }, + { + "data" : [ + 25, + 25, + 0, + 1, + 0, + -25, + 25 + ], + "type" : "a" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "segments" : [ + { + "data" : [ + 280, + 120 + ], + "type" : "M" + }, + { + "data" : [ + 25 + ], + "type" : "h" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "segments" : [ + { + "data" : [ + 360, + 120 + ], + "type" : "M" + }, + { + "data" : [ + -25 + ], + "type" : "h" + }, + { + "data" : [ + 25, + 25, + 0, + 1, + 1, + 25, + 25 + ], + "type" : "a" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "segments" : [ + { + "data" : [ + 360, + 120 + ], + "type" : "M" + }, + { + "data" : [ + -25 + ], + "type" : "h" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "segments" : [ + { + "data" : [ + 120, + 200 + ], + "type" : "M" + }, + { + "data" : [ + 25 + ], + "type" : "h" + }, + { + "data" : [ + 25, + 25, + 0, + 1, + 1, + -25, + -25 + ], + "type" : "a" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "segments" : [ + { + "data" : [ + 120, + 200 + ], + "type" : "M" + }, + { + "data" : [ + 25 + ], + "type" : "h" + }, + { + "data" : [ + 25, + 25, + 0, + 1, + 1, + -25, + -25 + ], + "type" : "a" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "segments" : [ + { + "data" : [ + 200, + 200 + ], + "type" : "M" + }, + { + "data" : [ + -25 + ], + "type" : "h" + }, + { + "data" : [ + 25, + 25, + 0, + 1, + 0, + 25, + -25 + ], + "type" : "a" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "segments" : [ + { + "data" : [ + 200, + 200 + ], + "type" : "M" + }, + { + "data" : [ + -25 + ], + "type" : "h" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "segments" : [ + { + "data" : [ + 280, + 200 + ], + "type" : "M" + }, + { + "data" : [ + 25 + ], + "type" : "h" + }, + { + "data" : [ + 25, + 25, + 0, + 1, + 1, + -25, + -25 + ], + "type" : "a" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "segments" : [ + { + "data" : [ + 280, + 200 + ], + "type" : "M" + }, + { + "data" : [ + 25 + ], + "type" : "h" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "segments" : [ + { + "data" : [ + 360, + 200 + ], + "type" : "M" + }, + { + "data" : [ + -25 + ], + "type" : "h" + }, + { + "data" : [ + 25, + 25, + 0, + 1, + 0, + 25, + -25 + ], + "type" : "a" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "segments" : [ + { + "data" : [ + 360, + 200 + ], + "type" : "M" + }, + { + "data" : [ + -25 + ], + "type" : "h" + }, + { + "data" : [ + + ], + "type" : "z" + } + ], + "type" : "Path" + }, + "node" : "Shape" + } + ], + "node" : "Group" + }, + { + "contents" : [ + { + "align" : "min", + "baseline" : "bottom", + "fill" : { + "type" : "Color", + "val" : 0 + }, + "font" : { + "name" : "SVGFreeSansASCII,sans-serif", + "size" : 32, + "weight" : "normal" + }, + "node" : "Text", + "place" : "1, 0, 0, 1, 10, 340", + "text" : "$Revision: 1.3 $" + } + ], + "node" : "Group" + }, + { + "form" : { + "h" : 358, + "type" : "Rect", + "w" : 478, + "x" : 1, + "y" : 1 + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + } + ], + "layout" : { + "scalingMode" : "meet", + "svgSize" : { + "height" : "100.0%", + "width" : "100.0%" + }, + "viewBox" : { + "h" : 360, + "type" : "Rect", + "w" : 480, + "x" : 0, + "y" : 0 + }, + "xAligningMode" : "mid", + "yAligningMode" : "mid" + }, + "node" : "Canvas" +} \ No newline at end of file diff --git a/MacawTests/w3cSVGTests/paths-data-20-f-manual.svg b/MacawTests/w3cSVGTests/paths-data-20-f-manual.svg new file mode 100644 index 00000000..ed643bce --- /dev/null +++ b/MacawTests/w3cSVGTests/paths-data-20-f-manual.svg @@ -0,0 +1,87 @@ + + + + + + + + + + +

+ Tests parsing of the elliptical arc path syntax. +

+ + +

+ Run the test. No interaction required. +

+
+ +

+ The test has passed if the image looks as if there are eight green circles that have + two white rectangles overlapping them, like in the reference image. If any red is visible + the test has failed. +

+
+ + $RCSfile: paths-data-20-f.svg,v $ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $Revision: 1.3 $ + + + + diff --git a/MacawTests/w3cSVGTests/shapes-rect-02-t-manual.reference b/MacawTests/w3cSVGTests/shapes-rect-02-t-manual.reference new file mode 100644 index 00000000..2f5be6a1 --- /dev/null +++ b/MacawTests/w3cSVGTests/shapes-rect-02-t-manual.reference @@ -0,0 +1,188 @@ +{ + "contents" : [ + { + "contents" : [ + { + "contents" : [ + { + "fill" : { + "type" : "Color", + "val" : 32768 + }, + "form" : { + "h" : 80, + "type" : "Rect", + "w" : 50, + "x" : 0, + "y" : 46 + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "fill" : { + "type" : "Color", + "val" : 32768 + }, + "form" : { + "h" : 80, + "type" : "Rect", + "w" : 50, + "x" : 130, + "y" : 0 + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "fill" : { + "type" : "Color", + "val" : 32768 + }, + "form" : { + "rect" : { + "h" : 80, + "type" : "Rect", + "w" : 50, + "x" : 30, + "y" : 196 + }, + "rx" : 20, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "fill" : { + "type" : "Color", + "val" : 32768 + }, + "form" : { + "rect" : { + "h" : 80, + "type" : "Rect", + "w" : 50, + "x" : 130, + "y" : 196 + }, + "rx" : 20, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + } + ], + "node" : "Group" + } + ], + "node" : "Group" + }, + { + "contents" : [ + { + "align" : "min", + "baseline" : "bottom", + "fill" : { + "type" : "Color", + "val" : 0 + }, + "font" : { + "name" : "SVGFreeSansASCII,sans-serif", + "size" : 32, + "weight" : "normal" + }, + "node" : "Text", + "place" : "1, 0, 0, 1, 10, 340", + "text" : "$Revision: 1.5 $" + } + ], + "node" : "Group" + }, + { + "form" : { + "h" : 358, + "type" : "Rect", + "w" : 478, + "x" : 1, + "y" : 1 + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + } + ], + "layout" : { + "scalingMode" : "meet", + "svgSize" : { + "height" : "100.0%", + "width" : "100.0%" + }, + "viewBox" : { + "h" : 360, + "type" : "Rect", + "w" : 480, + "x" : 0, + "y" : 0 + }, + "xAligningMode" : "mid", + "yAligningMode" : "mid" + }, + "node" : "Canvas" +} \ No newline at end of file diff --git a/MacawTests/w3cSVGTests/shapes-rect-02-t-manual.svg b/MacawTests/w3cSVGTests/shapes-rect-02-t-manual.svg new file mode 100644 index 00000000..6c487d5f --- /dev/null +++ b/MacawTests/w3cSVGTests/shapes-rect-02-t-manual.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + +

+ Test x, y, width, height, rx and ry default/lacuna values on a rect element. +

+ + +

+ Run the test. No interaction required. +

+
+ +

+ There should be four green rectangles visible, two of them should have rounded corners. +

+
+ + $RCSfile: shapes-rect-02-t.svg,v $ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $Revision: 1.5 $ + + + + + diff --git a/MacawTests/w3cSVGTests/shapes-rect-03-t-manual.reference b/MacawTests/w3cSVGTests/shapes-rect-03-t-manual.reference new file mode 100644 index 00000000..b4afbc6f --- /dev/null +++ b/MacawTests/w3cSVGTests/shapes-rect-03-t-manual.reference @@ -0,0 +1,1629 @@ +{ + "contents" : [ + { + "contents" : [ + { + "contents" : [ + { + "contents" : [ + { + "contents" : [ + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 100, + "y" : 0 + }, + "rx" : 50, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 130, + "y" : 0 + }, + "rx" : 10, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 160, + "y" : 0 + }, + "rx" : 10, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 190, + "y" : 0 + }, + "rx" : 10, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 220, + "y" : 0 + }, + "rx" : 10, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 250, + "y" : 0 + }, + "rx" : 10, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 280, + "y" : 0 + }, + "rx" : 5, + "ry" : 5, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 310, + "y" : 0 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 340, + "y" : 0 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "contents" : [ + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 10, + "y" : 120 + }, + "rx" : 50, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 10, + "y" : 150 + }, + "rx" : 15, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 10, + "y" : 180 + }, + "rx" : 10, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 130, + "y" : 120 + }, + "rx" : 50, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 130, + "y" : 150 + }, + "rx" : 20, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 130, + "y" : 180 + }, + "rx" : 10, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 250, + "y" : 120 + }, + "rx" : 5, + "ry" : 5, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 250, + "y" : 150 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 250, + "y" : 180 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape" + } + ], + "node" : "Group", + "place" : "1, 0, 0, 1, 45, 0" + }, + { + "contents" : [ + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 50, + "x" : 10, + "y" : 120 + }, + "rx" : 25, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 50, + "type" : "Rect", + "w" : 20, + "x" : 80, + "y" : 120 + }, + "rx" : 10, + "ry" : 25, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 50, + "x" : 120, + "y" : 120 + }, + "rx" : 25, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 30, + "type" : "Rect", + "w" : 20, + "x" : 0, + "y" : 0 + }, + "rx" : 10, + "ry" : 15, + "type" : "RoundRect" + }, + "node" : "Shape", + "place" : "2, 0, 0, 2, 180, 120" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 30, + "type" : "Rect", + "w" : 20, + "x" : 230, + "y" : 120 + }, + "rx" : 10, + "ry" : 25, + "type" : "RoundRect" + }, + "node" : "Shape" + } + ], + "node" : "Group", + "place" : "1, 0, 0, 1, 100, 100" + } + ], + "node" : "Group" + } + ], + "node" : "Group" + }, + { + "contents" : [ + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 100, + "y" : 0 + }, + "rx" : 50, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 130, + "y" : 0 + }, + "rx" : 15, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 160, + "y" : 0 + }, + "rx" : 10, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 190, + "y" : 0 + }, + "rx" : 80, + "ry" : 80, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 220, + "y" : 0 + }, + "rx" : 20, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 250, + "y" : 0 + }, + "rx" : 10, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 280, + "y" : 0 + }, + "rx" : 5, + "ry" : 5, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 310, + "y" : 0 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 340, + "y" : 0 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "contents" : [ + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 10, + "y" : 120 + }, + "rx" : 50, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 10, + "y" : 150 + }, + "rx" : 15, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 10, + "y" : 180 + }, + "rx" : 10, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 130, + "y" : 120 + }, + "rx" : 50, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 130, + "y" : 150 + }, + "rx" : 20, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 130, + "y" : 180 + }, + "rx" : 10, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 250, + "y" : 120 + }, + "rx" : 5, + "ry" : 5, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 250, + "y" : 150 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 250, + "y" : 180 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape" + } + ], + "node" : "Group", + "place" : "1, 0, 0, 1, 45, 0" + }, + { + "contents" : [ + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 50, + "x" : 10, + "y" : 120 + }, + "rx" : 50, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 50, + "type" : "Rect", + "w" : 20, + "x" : 80, + "y" : 120 + }, + "rx" : 50, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 50, + "x" : 120, + "y" : 120 + }, + "rx" : 200, + "ry" : 200, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 30, + "type" : "Rect", + "w" : 20, + "x" : 0, + "y" : 0 + }, + "rx" : 50, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape", + "place" : "2, 0, 0, 2, 180, 120" + }, + { + "fill" : { + "type" : "Color", + "val" : 65280 + }, + "form" : { + "rect" : { + "h" : 30, + "type" : "Rect", + "w" : 20, + "x" : 230, + "y" : 120 + }, + "rx" : 50, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + } + ], + "node" : "Group", + "place" : "1, 0, 0, 1, 100, 100" + } + ], + "node" : "Group" + }, + { + "contents" : [ + { + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 100, + "y" : 0 + }, + "rx" : 50, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 130, + "y" : 0 + }, + "rx" : 10, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 160, + "y" : 0 + }, + "rx" : 10, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 190, + "y" : 0 + }, + "rx" : 10, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 220, + "y" : 0 + }, + "rx" : 10, + "ry" : 20, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 250, + "y" : 0 + }, + "rx" : 10, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 280, + "y" : 0 + }, + "rx" : 5, + "ry" : 5, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 310, + "y" : 0 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 20, + "x" : 340, + "y" : 0 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "contents" : [ + { + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 10, + "y" : 120 + }, + "rx" : 50, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 10, + "y" : 150 + }, + "rx" : 15, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 10, + "y" : 180 + }, + "rx" : 10, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 130, + "y" : 120 + }, + "rx" : 50, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 130, + "y" : 150 + }, + "rx" : 20, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 130, + "y" : 180 + }, + "rx" : 10, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 250, + "y" : 120 + }, + "rx" : 5, + "ry" : 5, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 250, + "y" : 150 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 100, + "x" : 250, + "y" : 180 + }, + "rx" : 0, + "ry" : 0, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + } + ], + "node" : "Group", + "place" : "1, 0, 0, 1, 45, 0" + }, + { + "contents" : [ + { + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 50, + "x" : 10, + "y" : 120 + }, + "rx" : 25, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 50, + "type" : "Rect", + "w" : 20, + "x" : 80, + "y" : 120 + }, + "rx" : 10, + "ry" : 25, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 20, + "type" : "Rect", + "w" : 50, + "x" : 120, + "y" : 120 + }, + "rx" : 25, + "ry" : 10, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + }, + { + "form" : { + "rect" : { + "h" : 30, + "type" : "Rect", + "w" : 20, + "x" : 0, + "y" : 0 + }, + "rx" : 10, + "ry" : 15, + "type" : "RoundRect" + }, + "node" : "Shape", + "place" : "2, 0, 0, 2, 180, 120", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 0.5 + } + }, + { + "form" : { + "rect" : { + "h" : 30, + "type" : "Rect", + "w" : 20, + "x" : 230, + "y" : 120 + }, + "rx" : 10, + "ry" : 25, + "type" : "RoundRect" + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + } + ], + "node" : "Group", + "place" : "1, 0, 0, 1, 100, 100" + } + ], + "node" : "Group" + } + ], + "node" : "Group", + "place" : "1, 0, 0, 1, 0, 30" + } + ], + "node" : "Group" + }, + { + "contents" : [ + { + "align" : "min", + "baseline" : "bottom", + "fill" : { + "type" : "Color", + "val" : 0 + }, + "font" : { + "name" : "SVGFreeSansASCII,sans-serif", + "size" : 32, + "weight" : "normal" + }, + "node" : "Text", + "place" : "1, 0, 0, 1, 10, 340", + "text" : "$Revision: 1.9 $" + } + ], + "node" : "Group" + }, + { + "form" : { + "h" : 358, + "type" : "Rect", + "w" : 478, + "x" : 1, + "y" : 1 + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + } + ], + "layout" : { + "scalingMode" : "meet", + "svgSize" : { + "height" : "100.0%", + "width" : "100.0%" + }, + "viewBox" : { + "h" : 360, + "type" : "Rect", + "w" : 480, + "x" : 0, + "y" : 0 + }, + "xAligningMode" : "mid", + "yAligningMode" : "mid" + }, + "node" : "Canvas" +} \ No newline at end of file diff --git a/MacawTests/w3cSVGTests/shapes-rect-03-t-manual.svg b/MacawTests/w3cSVGTests/shapes-rect-03-t-manual.svg new file mode 100644 index 00000000..8e7fbec6 --- /dev/null +++ b/MacawTests/w3cSVGTests/shapes-rect-03-t-manual.svg @@ -0,0 +1,139 @@ + + + + + + + + + + +

+ Tests rx and ry clamping and aliasing. +

+ + +

+ Run the test. No interaction required. +

+
+ +

+ The test has passed if: +

+
    +
  • There is no red visible
  • +
  • There is no green outside the black borders of each rectangle
  • +
+
+ + $RCSfile: shapes-rect-03-t.svg,v $ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $Revision: 1.9 $ + + + + diff --git a/MacawTests/w3cSVGTests/shapes-rect-06-f-manual.reference b/MacawTests/w3cSVGTests/shapes-rect-06-f-manual.reference new file mode 100644 index 00000000..5595a94c --- /dev/null +++ b/MacawTests/w3cSVGTests/shapes-rect-06-f-manual.reference @@ -0,0 +1,221 @@ +{ + "contents" : [ + { + "contents" : [ + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 25, + "y" : 50 + }, + "rx" : 100, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 0 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 25, + "y" : 50 + }, + "rx" : 150, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 25, + "y" : 200 + }, + "rx" : 150, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 0 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 25, + "y" : 200 + }, + "rx" : 100, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 275, + "y" : 50 + }, + "rx" : 100, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 0 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 275, + "y" : 50 + }, + "rx" : 100, + "ry" : 75, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 275, + "y" : 200 + }, + "rx" : 100, + "ry" : 75, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 0 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 275, + "y" : 200 + }, + "rx" : 100, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + } + ], + "node" : "Group" + }, + { + "contents" : [ + { + "align" : "min", + "baseline" : "bottom", + "fill" : { + "type" : "Color", + "val" : 0 + }, + "font" : { + "name" : "SVGFreeSansASCII,sans-serif", + "size" : 32, + "weight" : "normal" + }, + "node" : "Text", + "place" : "1, 0, 0, 1, 10, 340", + "text" : "$Revision: 1.3 $" + } + ], + "node" : "Group" + }, + { + "form" : { + "h" : 358, + "type" : "Rect", + "w" : 478, + "x" : 1, + "y" : 1 + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + } + ], + "layout" : { + "scalingMode" : "meet", + "svgSize" : { + "height" : "100.0%", + "width" : "100.0%" + }, + "viewBox" : { + "h" : 360, + "type" : "Rect", + "w" : 480, + "x" : 0, + "y" : 0 + }, + "xAligningMode" : "mid", + "yAligningMode" : "mid" + }, + "node" : "Canvas" +} \ No newline at end of file diff --git a/MacawTests/w3cSVGTests/shapes-rect-06-f-manual.svg b/MacawTests/w3cSVGTests/shapes-rect-06-f-manual.svg new file mode 100644 index 00000000..7b4d209e --- /dev/null +++ b/MacawTests/w3cSVGTests/shapes-rect-06-f-manual.svg @@ -0,0 +1,70 @@ + + + + + + + + + + +

+ When 'rect' attributes 'rx' and 'ry' have a value greater than half of the width/height of the rectangle, they are treated as half the width/height of the rectangle. +

+

+ The test creates one 'rect' element with 'rx' greater than 1/2 the 'rect' width. Underneath that element, it creates a red 'rect' element with + 'rx' set to 1/2 the width. Repeats with 'ry' attribute. +

+ + +

+ Run the test. No interaction required. +

+
+ +

+ Test passes if there is no red visible on the page. +

+
+ + $RCSfile: shapes-rect-06-f.svg,v $ + + + + + + + + + + + + + + + + + + + + + + $Revision: 1.3 $ + + + + + diff --git a/MacawTests/w3cSVGTests/shapes-rect-07-f-manual.reference b/MacawTests/w3cSVGTests/shapes-rect-07-f-manual.reference new file mode 100644 index 00000000..ad046761 --- /dev/null +++ b/MacawTests/w3cSVGTests/shapes-rect-07-f-manual.reference @@ -0,0 +1,145 @@ +{ + "contents" : [ + { + "contents" : [ + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 25, + "y" : 50 + }, + "rx" : 100, + "ry" : 100, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 0 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 25, + "y" : 50 + }, + "rx" : 100, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 16711680 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 25, + "y" : 200 + }, + "rx" : 100, + "ry" : 50, + "type" : "RoundRect" + }, + "node" : "Shape" + }, + { + "fill" : { + "type" : "Color", + "val" : 0 + }, + "form" : { + "rect" : { + "h" : 100, + "type" : "Rect", + "w" : 200, + "x" : 25, + "y" : 200 + }, + "rx" : 100, + "ry" : 100, + "type" : "RoundRect" + }, + "node" : "Shape" + } + ], + "node" : "Group" + }, + { + "contents" : [ + { + "align" : "min", + "baseline" : "bottom", + "fill" : { + "type" : "Color", + "val" : 0 + }, + "font" : { + "name" : "SVGFreeSansASCII,sans-serif", + "size" : 32, + "weight" : "normal" + }, + "node" : "Text", + "place" : "1, 0, 0, 1, 10, 340", + "text" : "$Revision: 1.2 $" + } + ], + "node" : "Group" + }, + { + "form" : { + "h" : 358, + "type" : "Rect", + "w" : 478, + "x" : 1, + "y" : 1 + }, + "node" : "Shape", + "stroke" : { + "cap" : "butt", + "dashes" : [ + + ], + "fill" : { + "type" : "Color", + "val" : 0 + }, + "join" : "miter", + "width" : 1 + } + } + ], + "layout" : { + "scalingMode" : "meet", + "svgSize" : { + "height" : "100.0%", + "width" : "100.0%" + }, + "viewBox" : { + "h" : 360, + "type" : "Rect", + "w" : 480, + "x" : 0, + "y" : 0 + }, + "xAligningMode" : "mid", + "yAligningMode" : "mid" + }, + "node" : "Canvas" +} \ No newline at end of file diff --git a/MacawTests/w3cSVGTests/shapes-rect-07-f-manual.svg b/MacawTests/w3cSVGTests/shapes-rect-07-f-manual.svg new file mode 100644 index 00000000..ac9e9fbd --- /dev/null +++ b/MacawTests/w3cSVGTests/shapes-rect-07-f-manual.svg @@ -0,0 +1,61 @@ + + + + + + + + + + +

+ Checks that unspecified 'ry' and 'rx' attributes are copied from each other before their values are clamped. +

+ + +

+ Run the test. No interaction required. +

+
+ +

+ Test passes if there is no red visible on the page. +

+
+ + $RCSfile: shapes-rect-07-f.svg,v $ + + + + + + + + + + + + + + + + + $Revision: 1.2 $ + + + + + diff --git a/Source/svg/SVGParser.swift b/Source/svg/SVGParser.swift index 904a7470..26140633 100644 --- a/Source/svg/SVGParser.swift +++ b/Source/svg/SVGParser.swift @@ -1610,7 +1610,7 @@ private class PathDataReader { } public func read() -> [PathSegment] { - _ = readNext() + readNext() var segments = [PathSegment]() while let array = readSegments() { segments.append(contentsOf: array) @@ -1625,7 +1625,12 @@ private class PathDataReader { return [PathSegment(type: type)] } var result = [PathSegment]() - let data = readData() + let data: [Double] + if type == .a || type == .A { + data = readDataOfASegment() + } else { + data = readData() + } var index = 0 var isFirstSegment = true while index < data.count { @@ -1663,6 +1668,28 @@ private class PathDataReader { } } + private func readDataOfASegment() -> [Double] { + let argCount = getArgCount(segment: .A) + var data: [Double] = [] + var index = 0 + while true { + skipSpaces() + let value: Double? + let indexMod = index % argCount + if indexMod == 3 || indexMod == 4 { + value = readFlag() + } else { + value = readNum() + } + guard let doubleValue = value else { + return data + } + data.append(doubleValue) + index += 1 + } + return data + } + private func skipSpaces() { var ch = current while ch != nil && "\n\r\t ,".contains(String(ch!)) { @@ -1670,21 +1697,42 @@ private class PathDataReader { } } + private func readFlag() -> Double? { + guard let ch = current else { + return .none + } + readNext() + switch ch { + case "0": + return 0 + case "1": + return 1 + default: + return .none + } + } + fileprivate func readNum() -> Double? { guard let ch = current else { - return nil + return .none } - if (ch >= "0" && ch <= "9") || ch == "." || ch == "-" { - var chars = [ch] - var hasDot = ch == "." - while let ch = readDigit(&hasDot) { - chars.append(ch) - } - var buf = "" - buf.unicodeScalars.append(contentsOf: chars) - return Double(buf) + + guard ch >= "0" && ch <= "9" || ch == "." || ch == "-" else { + return .none } - return nil + + var chars = [ch] + var hasDot = ch == "." + while let ch = readDigit(&hasDot) { + chars.append(ch) + } + + var buf = "" + buf.unicodeScalars.append(contentsOf: chars) + guard let value = Double(buf) else { + return .none + } + return value } fileprivate func readDigit(_ hasDot: inout Bool) -> UnicodeScalar? { @@ -1714,6 +1762,7 @@ private class PathDataReader { return false } + @discardableResult private func readNext() -> UnicodeScalar? { previous = current current = iterator.next() @@ -1730,7 +1779,7 @@ private class PathDataReader { private func readSegmentType() -> PathSegmentType? { while true { if let type = getPathSegmentType() { - _ = readNext() + readNext() return type } if readNext() == nil {