-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathClosePathTests.swift
92 lines (75 loc) · 2.47 KB
/
ClosePathTests.swift
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//
// ClosePathTests.swift
// SVGPath
//
// Created by Tim Wood on 1/26/15.
// Copyright (c) 2015 Tim Wood. All rights reserved.
//
import XCTest
import SVGPath
class ClosePathTests: XCTestCase {
func testAbsoluteCloseAfterMoveTo() {
let actual:[SVGCommand] = SVGPath("M1 2Z").commands
let expect:[SVGCommand] = [
SVGCommand(1.0, 2.0, type: .move),
SVGCommand()
]
assertCommandsEqual(actual, expect)
}
func testRelativeCloseAfterMoveTo() {
let actual:[SVGCommand] = SVGPath("M1 2z").commands
let expect:[SVGCommand] = [
SVGCommand(1.0, 2.0, type: .move),
SVGCommand()
]
assertCommandsEqual(actual, expect)
}
func testAbsoluteCloseAfterLineTo() {
let actual:[SVGCommand] = SVGPath("L1 2Z").commands
let expect:[SVGCommand] = [
SVGCommand(1.0, 2.0, type: .line),
SVGCommand()
]
assertCommandsEqual(actual, expect)
}
func testRelativeCloseAfterLineTo() {
let actual:[SVGCommand] = SVGPath("L1 2z").commands
let expect:[SVGCommand] = [
SVGCommand(1.0, 2.0, type: .line),
SVGCommand()
]
assertCommandsEqual(actual, expect)
}
func testAbsoluteCloseAfterQuadraticCurveTo() {
let actual:[SVGCommand] = SVGPath("Q1 2 3 4Z").commands
let expect:[SVGCommand] = [
SVGCommand(1.0, 2.0, 3.0, 4.0),
SVGCommand()
]
assertCommandsEqual(actual, expect)
}
func testRelativeCloseAfterQuadraticCurveTo() {
let actual:[SVGCommand] = SVGPath("Q1 2 3 4z").commands
let expect:[SVGCommand] = [
SVGCommand(1.0, 2.0, 3.0, 4.0),
SVGCommand()
]
assertCommandsEqual(actual, expect)
}
func testAbsoluteCloseAfterCubicCurveTo() {
let actual:[SVGCommand] = SVGPath("C1 2 3 4 5 6Z").commands
let expect:[SVGCommand] = [
SVGCommand(1.0, 2.0, 3.0, 4.0, 5.0, 6.0),
SVGCommand()
]
assertCommandsEqual(actual, expect)
}
func testRelativeCloseAfterCubicCurveTo() {
let actual:[SVGCommand] = SVGPath("C1 2 3 4 5 6z").commands
let expect:[SVGCommand] = [
SVGCommand(1.0, 2.0, 3.0, 4.0, 5.0, 6.0),
SVGCommand()
]
assertCommandsEqual(actual, expect)
}
}