Svg tests added
@ -12,6 +12,16 @@
|
|||||||
57CAB11C1D78177900FD8E47 /* SWXMLHash.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57CAB11B1D78177900FD8E47 /* SWXMLHash.framework */; };
|
57CAB11C1D78177900FD8E47 /* SWXMLHash.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57CAB11B1D78177900FD8E47 /* SWXMLHash.framework */; };
|
||||||
57CAB11D1D78178000FD8E47 /* SWXMLHash.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57CAB11B1D78177900FD8E47 /* SWXMLHash.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
57CAB11D1D78178000FD8E47 /* SWXMLHash.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57CAB11B1D78177900FD8E47 /* SWXMLHash.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
57CAB1211D781F0000FD8E47 /* CAAnimation+Closure.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57CAB1201D781F0000FD8E47 /* CAAnimation+Closure.swift */; };
|
57CAB1211D781F0000FD8E47 /* CAAnimation+Closure.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57CAB1201D781F0000FD8E47 /* CAAnimation+Closure.swift */; };
|
||||||
|
57CAB1231D782DFC00FD8E47 /* TestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57CAB1221D782DFC00FD8E47 /* TestUtils.swift */; };
|
||||||
|
57CAB12E1D7832E000FD8E47 /* circle.svg in Resources */ = {isa = PBXBuildFile; fileRef = 57CAB1251D7832E000FD8E47 /* circle.svg */; };
|
||||||
|
57CAB12F1D7832E000FD8E47 /* ellipse.svg in Resources */ = {isa = PBXBuildFile; fileRef = 57CAB1261D7832E000FD8E47 /* ellipse.svg */; };
|
||||||
|
57CAB1301D7832E000FD8E47 /* group.svg in Resources */ = {isa = PBXBuildFile; fileRef = 57CAB1271D7832E000FD8E47 /* group.svg */; };
|
||||||
|
57CAB1311D7832E000FD8E47 /* line.svg in Resources */ = {isa = PBXBuildFile; fileRef = 57CAB1281D7832E000FD8E47 /* line.svg */; };
|
||||||
|
57CAB1321D7832E000FD8E47 /* polygon.svg in Resources */ = {isa = PBXBuildFile; fileRef = 57CAB1291D7832E000FD8E47 /* polygon.svg */; };
|
||||||
|
57CAB1331D7832E000FD8E47 /* polyline.svg in Resources */ = {isa = PBXBuildFile; fileRef = 57CAB12A1D7832E000FD8E47 /* polyline.svg */; };
|
||||||
|
57CAB1341D7832E000FD8E47 /* rect.svg in Resources */ = {isa = PBXBuildFile; fileRef = 57CAB12B1D7832E000FD8E47 /* rect.svg */; };
|
||||||
|
57CAB1351D7832E000FD8E47 /* roundRect.svg in Resources */ = {isa = PBXBuildFile; fileRef = 57CAB12C1D7832E000FD8E47 /* roundRect.svg */; };
|
||||||
|
57CAB1361D7832E000FD8E47 /* triangle.svg in Resources */ = {isa = PBXBuildFile; fileRef = 57CAB12D1D7832E000FD8E47 /* triangle.svg */; };
|
||||||
57FCD2771D76EA4600CC0FB6 /* Macaw.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57FCD26C1D76EA4600CC0FB6 /* Macaw.framework */; };
|
57FCD2771D76EA4600CC0FB6 /* Macaw.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57FCD26C1D76EA4600CC0FB6 /* Macaw.framework */; };
|
||||||
57FCD27C1D76EA4600CC0FB6 /* MacawTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57FCD27B1D76EA4600CC0FB6 /* MacawTests.swift */; };
|
57FCD27C1D76EA4600CC0FB6 /* MacawTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57FCD27B1D76EA4600CC0FB6 /* MacawTests.swift */; };
|
||||||
57FCD2E71D76EB8E00CC0FB6 /* AnimatableVariable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57FCD2881D76EB8E00CC0FB6 /* AnimatableVariable.swift */; };
|
57FCD2E71D76EB8E00CC0FB6 /* AnimatableVariable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57FCD2881D76EB8E00CC0FB6 /* AnimatableVariable.swift */; };
|
||||||
@ -125,6 +135,16 @@
|
|||||||
57CAB1181D78173F00FD8E47 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RxSwift.framework; sourceTree = "<group>"; };
|
57CAB1181D78173F00FD8E47 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RxSwift.framework; sourceTree = "<group>"; };
|
||||||
57CAB11B1D78177900FD8E47 /* SWXMLHash.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SWXMLHash.framework; path = iOS/SWXMLHash.framework; sourceTree = "<group>"; };
|
57CAB11B1D78177900FD8E47 /* SWXMLHash.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SWXMLHash.framework; path = iOS/SWXMLHash.framework; sourceTree = "<group>"; };
|
||||||
57CAB1201D781F0000FD8E47 /* CAAnimation+Closure.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CAAnimation+Closure.swift"; sourceTree = "<group>"; };
|
57CAB1201D781F0000FD8E47 /* CAAnimation+Closure.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CAAnimation+Closure.swift"; sourceTree = "<group>"; };
|
||||||
|
57CAB1221D782DFC00FD8E47 /* TestUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestUtils.swift; sourceTree = "<group>"; };
|
||||||
|
57CAB1251D7832E000FD8E47 /* circle.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = circle.svg; sourceTree = "<group>"; };
|
||||||
|
57CAB1261D7832E000FD8E47 /* ellipse.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = ellipse.svg; sourceTree = "<group>"; };
|
||||||
|
57CAB1271D7832E000FD8E47 /* group.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = group.svg; sourceTree = "<group>"; };
|
||||||
|
57CAB1281D7832E000FD8E47 /* line.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = line.svg; sourceTree = "<group>"; };
|
||||||
|
57CAB1291D7832E000FD8E47 /* polygon.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = polygon.svg; sourceTree = "<group>"; };
|
||||||
|
57CAB12A1D7832E000FD8E47 /* polyline.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = polyline.svg; sourceTree = "<group>"; };
|
||||||
|
57CAB12B1D7832E000FD8E47 /* rect.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = rect.svg; sourceTree = "<group>"; };
|
||||||
|
57CAB12C1D7832E000FD8E47 /* roundRect.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = roundRect.svg; sourceTree = "<group>"; };
|
||||||
|
57CAB12D1D7832E000FD8E47 /* triangle.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = triangle.svg; sourceTree = "<group>"; };
|
||||||
57FCD26C1D76EA4600CC0FB6 /* Macaw.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Macaw.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
57FCD26C1D76EA4600CC0FB6 /* Macaw.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Macaw.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
57FCD2761D76EA4600CC0FB6 /* MacawTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MacawTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
57FCD2761D76EA4600CC0FB6 /* MacawTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MacawTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
57FCD27B1D76EA4600CC0FB6 /* MacawTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacawTests.swift; sourceTree = "<group>"; };
|
57FCD27B1D76EA4600CC0FB6 /* MacawTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacawTests.swift; sourceTree = "<group>"; };
|
||||||
@ -249,6 +269,22 @@
|
|||||||
path = "Swift-CAAnimation-Closure";
|
path = "Swift-CAAnimation-Closure";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
57CAB1241D7832E000FD8E47 /* svg */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
57CAB1251D7832E000FD8E47 /* circle.svg */,
|
||||||
|
57CAB1261D7832E000FD8E47 /* ellipse.svg */,
|
||||||
|
57CAB1271D7832E000FD8E47 /* group.svg */,
|
||||||
|
57CAB1281D7832E000FD8E47 /* line.svg */,
|
||||||
|
57CAB1291D7832E000FD8E47 /* polygon.svg */,
|
||||||
|
57CAB12A1D7832E000FD8E47 /* polyline.svg */,
|
||||||
|
57CAB12B1D7832E000FD8E47 /* rect.svg */,
|
||||||
|
57CAB12C1D7832E000FD8E47 /* roundRect.svg */,
|
||||||
|
57CAB12D1D7832E000FD8E47 /* triangle.svg */,
|
||||||
|
);
|
||||||
|
path = svg;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
57D2020D1D78044A00A90D4F /* Dependencies */ = {
|
57D2020D1D78044A00A90D4F /* Dependencies */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -312,6 +348,8 @@
|
|||||||
57FCD27A1D76EA4600CC0FB6 /* MacawTests */ = {
|
57FCD27A1D76EA4600CC0FB6 /* MacawTests */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
57CAB1241D7832E000FD8E47 /* svg */,
|
||||||
|
57CAB1221D782DFC00FD8E47 /* TestUtils.swift */,
|
||||||
57FCD27B1D76EA4600CC0FB6 /* MacawTests.swift */,
|
57FCD27B1D76EA4600CC0FB6 /* MacawTests.swift */,
|
||||||
57FCD27D1D76EA4600CC0FB6 /* Info.plist */,
|
57FCD27D1D76EA4600CC0FB6 /* Info.plist */,
|
||||||
);
|
);
|
||||||
@ -626,6 +664,15 @@
|
|||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
57CAB1361D7832E000FD8E47 /* triangle.svg in Resources */,
|
||||||
|
57CAB1301D7832E000FD8E47 /* group.svg in Resources */,
|
||||||
|
57CAB1351D7832E000FD8E47 /* roundRect.svg in Resources */,
|
||||||
|
57CAB12E1D7832E000FD8E47 /* circle.svg in Resources */,
|
||||||
|
57CAB1331D7832E000FD8E47 /* polyline.svg in Resources */,
|
||||||
|
57CAB1311D7832E000FD8E47 /* line.svg in Resources */,
|
||||||
|
57CAB1321D7832E000FD8E47 /* polygon.svg in Resources */,
|
||||||
|
57CAB12F1D7832E000FD8E47 /* ellipse.svg in Resources */,
|
||||||
|
57CAB1341D7832E000FD8E47 /* rect.svg in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -725,6 +772,7 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
57FCD27C1D76EA4600CC0FB6 /* MacawTests.swift in Sources */,
|
57FCD27C1D76EA4600CC0FB6 /* MacawTests.swift in Sources */,
|
||||||
|
57CAB1231D782DFC00FD8E47 /* TestUtils.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -3,108 +3,108 @@ import XCTest
|
|||||||
|
|
||||||
class MacawTests: XCTestCase {
|
class MacawTests: XCTestCase {
|
||||||
|
|
||||||
override func setUp() {
|
override func setUp() {
|
||||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||||
super.setUp()
|
super.setUp()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tearDown() {
|
override func tearDown() {
|
||||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSVGTriangle() {
|
func testSVGTriangle() {
|
||||||
XCTAssertTrue(TestUtils.compareWithReferenceObject("triangle", referenceObject: createTriangleReferenceObject()))
|
XCTAssertTrue(TestUtils.compareWithReferenceObject("triangle", referenceObject: createTriangleReferenceObject()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSVGLine() {
|
func testSVGLine() {
|
||||||
XCTAssertTrue(TestUtils.compareWithReferenceObject("line", referenceObject: createLineReferenceObject()))
|
XCTAssertTrue(TestUtils.compareWithReferenceObject("line", referenceObject: createLineReferenceObject()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSVGRect() {
|
func testSVGRect() {
|
||||||
XCTAssertTrue(TestUtils.compareWithReferenceObject("rect", referenceObject: createRectReferenceObject()))
|
XCTAssertTrue(TestUtils.compareWithReferenceObject("rect", referenceObject: createRectReferenceObject()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSVGRoundRect() {
|
func testSVGRoundRect() {
|
||||||
XCTAssertTrue(TestUtils.compareWithReferenceObject("roundRect", referenceObject: createRoundRectReferenceObject()))
|
XCTAssertTrue(TestUtils.compareWithReferenceObject("roundRect", referenceObject: createRoundRectReferenceObject()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSVGPolygon() {
|
func testSVGPolygon() {
|
||||||
XCTAssertTrue(TestUtils.compareWithReferenceObject("polygon", referenceObject: createPolygonReferenceObject()))
|
XCTAssertTrue(TestUtils.compareWithReferenceObject("polygon", referenceObject: createPolygonReferenceObject()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSVGPolyline() {
|
func testSVGPolyline() {
|
||||||
XCTAssertTrue(TestUtils.compareWithReferenceObject("polyline", referenceObject: createPolylineReferenceObject()))
|
XCTAssertTrue(TestUtils.compareWithReferenceObject("polyline", referenceObject: createPolylineReferenceObject()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSVGCircle() {
|
func testSVGCircle() {
|
||||||
XCTAssertTrue(TestUtils.compareWithReferenceObject("circle", referenceObject: createCircleReferenceObject()))
|
XCTAssertTrue(TestUtils.compareWithReferenceObject("circle", referenceObject: createCircleReferenceObject()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSVGEllipse() {
|
func testSVGEllipse() {
|
||||||
XCTAssertTrue(TestUtils.compareWithReferenceObject("ellipse", referenceObject: createEllipseReferenceObject()))
|
XCTAssertTrue(TestUtils.compareWithReferenceObject("ellipse", referenceObject: createEllipseReferenceObject()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSVGGroup() {
|
func testSVGGroup() {
|
||||||
XCTAssertTrue(TestUtils.compareWithReferenceObject("group", referenceObject: createGroupReferenceObject()))
|
XCTAssertTrue(TestUtils.compareWithReferenceObject("group", referenceObject: createGroupReferenceObject()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func createTriangleReferenceObject() -> Group {
|
func createTriangleReferenceObject() -> Group {
|
||||||
let path = Path(segments: [Move(x: 150, y: 0), PLine(x: 75, y: 200), PLine(x: 225, y: 200), Close()])
|
let path = MoveTo(x: 150, y: 0).lineTo(x: 75, y: 200).lineTo(x: 225, y: 200).close().build()
|
||||||
return Group(contents: [Shape(form: path, stroke: Stroke(fill: Color.black, width: 2, cap: .round, join: .round))])
|
return Group(contents: [Shape(form: path, stroke: Stroke(fill: Color.black, width: 2, cap: .round, join: .round))])
|
||||||
}
|
}
|
||||||
|
|
||||||
func createLineReferenceObject() -> Group {
|
func createLineReferenceObject() -> Group {
|
||||||
let line = Line(x1: 0, y1: 0, x2: 200, y2: 200)
|
let line = Line(x1: 0, y1: 0, x2: 200, y2: 200)
|
||||||
return Group(contents: [Shape(form: line, stroke: Stroke(fill: Color.red, width: 2, cap: .round, join: .round))])
|
return Group(contents: [Shape(form: line, stroke: Stroke(fill: Color.red, width: 2, cap: .round, join: .round))])
|
||||||
}
|
}
|
||||||
|
|
||||||
func createRectReferenceObject() -> Group {
|
func createRectReferenceObject() -> Group {
|
||||||
let rect = Rect(x: 50, w: 150, h: 150)
|
let rect = Rect(x: 50, w: 150, h: 150)
|
||||||
return Group(contents: [Shape(form: rect)])
|
return Group(contents: [Shape(form: rect)])
|
||||||
}
|
}
|
||||||
|
|
||||||
func createRoundRectReferenceObject() -> Group {
|
func createRoundRectReferenceObject() -> Group {
|
||||||
let roundRect = RoundRect(rect: Rect(w: 150, h: 150), rx: 20, ry: 20)
|
let roundRect = RoundRect(rect: Rect(w: 150, h: 150), rx: 20, ry: 20)
|
||||||
return Group(contents: [Shape(form: roundRect)])
|
return Group(contents: [Shape(form: roundRect)])
|
||||||
}
|
}
|
||||||
|
|
||||||
func createPolygonReferenceObject() -> Group {
|
func createPolygonReferenceObject() -> Group {
|
||||||
let polygon = Polygon(points: [200, 10, 250, 190, 160, 210])
|
let polygon = Polygon(points: [200, 10, 250, 190, 160, 210])
|
||||||
return Group(contents: [Shape(form: polygon)])
|
return Group(contents: [Shape(form: polygon)])
|
||||||
}
|
}
|
||||||
|
|
||||||
func createPolylineReferenceObject() -> Group {
|
func createPolylineReferenceObject() -> Group {
|
||||||
let polyline = Polyline(points: [0, 40, 40, 40, 40, 80, 80, 80, 80, 120, 120, 120, 120, 160])
|
let polyline = Polyline(points: [0, 40, 40, 40, 40, 80, 80, 80, 80, 120, 120, 120, 120, 160])
|
||||||
|
|
||||||
return Group(contents: [Shape(form: polyline,
|
return Group(contents: [Shape(form: polyline,
|
||||||
stroke: Stroke(fill: Color.red, width: 4, cap: .round, join: .round),
|
stroke: Stroke(fill: Color.red, width: 4, cap: .round, join: .round),
|
||||||
fill: Color.white)])
|
fill: Color.white)])
|
||||||
}
|
}
|
||||||
|
|
||||||
func createCircleReferenceObject() -> Group {
|
func createCircleReferenceObject() -> Group {
|
||||||
let circle = Circle(cx: 50, cy: 50, r: 40)
|
let circle = Circle(cx: 50, cy: 50, r: 40)
|
||||||
|
|
||||||
return Group(contents: [Shape(form: circle,
|
return Group(contents: [Shape(form: circle,
|
||||||
stroke: Stroke(fill: Color.black, width: 3, cap: .round, join: .round),
|
stroke: Stroke(fill: Color.black, width: 3, cap: .round, join: .round),
|
||||||
fill: Color.red)])
|
fill: Color.red)])
|
||||||
}
|
}
|
||||||
|
|
||||||
func createEllipseReferenceObject() -> Group {
|
func createEllipseReferenceObject() -> Group {
|
||||||
let ellipse = Ellipse(cx: 200, cy: 80, rx: 100, ry: 50)
|
let ellipse = Ellipse(cx: 200, cy: 80, rx: 100, ry: 50)
|
||||||
|
|
||||||
return Group(contents: [Shape(form: ellipse,
|
return Group(contents: [Shape(form: ellipse,
|
||||||
stroke: Stroke(fill: Color.purple, width: 2, cap: .round, join: .round),
|
stroke: Stroke(fill: Color.purple, width: 2, cap: .round, join: .round),
|
||||||
fill: Color.yellow)])
|
fill: Color.yellow)])
|
||||||
}
|
}
|
||||||
|
|
||||||
func createGroupReferenceObject() -> Group {
|
func createGroupReferenceObject() -> Group {
|
||||||
let pathShape = Shape(form: Path(segments: [Move(x: 150, y: 0), PLine(x: 75, y: 200), PLine(x: 225, y: 200), Close()]),
|
let pathShape = Shape(form: MoveTo(x: 150, y: 0).lineTo(x: 75, y: 200).lineTo(x: 225, y: 200).close().build(),
|
||||||
stroke: Stroke(fill: Color.black, width: 2, cap: .round, join: .round))
|
stroke: Stroke(fill: Color.black, width: 2, cap: .round, join: .round))
|
||||||
|
|
||||||
let lineShape = Shape(form: Line(x1: 0, y1: 0, x2: 200, y2: 200),
|
let lineShape = Shape(form: Line(x1: 0, y1: 0, x2: 200, y2: 200),
|
||||||
stroke: Stroke(fill: Color.white, width: 2, cap: .round, join: .round))
|
stroke: Stroke(fill: Color.white, width: 2, cap: .round, join: .round))
|
||||||
|
|
||||||
return Group(contents: [Group(contents: [pathShape, lineShape])])
|
return Group(contents: [Group(contents: [pathShape, lineShape])])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,32 +3,31 @@ import Macaw
|
|||||||
|
|
||||||
class TestUtils {
|
class TestUtils {
|
||||||
|
|
||||||
class func compareWithReferenceObject(fileName: String, referenceObject: AnyObject) -> Bool {
|
class func compareWithReferenceObject(fileName: String, referenceObject: AnyObject) -> Bool {
|
||||||
let bundle = NSBundle(forClass: TestUtils().dynamicType)
|
let bundle = NSBundle(forClass: TestUtils().dynamicType)
|
||||||
if let path = bundle.pathForResource(fileName, ofType: "svg") {
|
if let path = bundle.pathForResource(fileName, ofType: "svg") {
|
||||||
let content = try? NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding)
|
let content = try? NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding)
|
||||||
if let svgString = content as? String {
|
if let svgString = content as? String {
|
||||||
let parser = SVGParser(svgString)
|
let group = SVGParser.parse(text: svgString)
|
||||||
let group = parser.parse()
|
let referenceArray = TestUtils.prepareParametersList(Mirror(reflecting: referenceObject))
|
||||||
let referenceArray = TestUtils.prepareParametersList(Mirror(reflecting: referenceObject))
|
let parametersArray = TestUtils.prepareParametersList(Mirror(reflecting: group))
|
||||||
let parametersArray = TestUtils.prepareParametersList(Mirror(reflecting: group))
|
return referenceArray.elementsEqual(parametersArray, isEquivalent: { first, second in
|
||||||
return referenceArray.elementsEqual(parametersArray, isEquivalent: { first, second in
|
return first.0 == second.0 && first.1 == second.1
|
||||||
return first.0 == second.0 && first.1 == second.1
|
})
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
return false
|
||||||
return false
|
}
|
||||||
}
|
|
||||||
|
|
||||||
class func prepareParametersList(mirror: Mirror) -> [(String, String)] {
|
class func prepareParametersList(mirror: Mirror) -> [(String, String)] {
|
||||||
var result: [(String, String)] = []
|
var result: [(String, String)] = []
|
||||||
for (_, attribute) in mirror.children.enumerate() {
|
for (_, attribute) in mirror.children.enumerate() {
|
||||||
if let label = attribute.label where label == "_value" || label.characters.first != "_" {
|
if let label = attribute.label where label == "_value" || label.characters.first != "_" {
|
||||||
result.append((label, String(attribute.value)))
|
result.append((label, String(attribute.value)))
|
||||||
result.appendContentsOf(prepareParametersList(Mirror(reflecting: attribute.value)))
|
result.appendContentsOf(prepareParametersList(Mirror(reflecting: attribute.value)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 281 B After Width: | Height: | Size: 281 B |
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 259 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 305 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |