forked from ChartsOrg/Charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLineChartTests.swift
executable file
·72 lines (57 loc) · 1.79 KB
/
LineChartTests.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
import XCTest
import FBSnapshotTestCase
@testable import Charts
class LineChartTests: FBSnapshotTestCase
{
var chart: LineChartView!
var dataSet: LineChartDataSet!
override func setUp()
{
super.setUp()
// Set to `true` to re-capture all snapshots
self.recordMode = false
// Sample data
let values: [Double] = [8, 104, 81, 93, 52, 44, 97, 101, 75, 28,
76, 25, 20, 13, 52, 44, 57, 23, 45, 91,
99, 14, 84, 48, 40, 71, 106, 41, 45, 61]
var entries: [ChartDataEntry] = Array()
var xValues: [String] = Array()
for (i, value) in values.enumerate()
{
entries.append(ChartDataEntry.init(value: value, xIndex: i))
xValues.append("\(i)")
}
dataSet = LineChartDataSet(yVals: entries, label: "First unit test data")
chart = LineChartView(frame: CGRectMake(0, 0, 480, 350))
chart.data = LineChartData(xVals: xValues, dataSet: dataSet)
}
override func tearDown()
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testDefaultValues()
{
FBSnapshotVerifyView(chart)
}
func testHidesValues()
{
dataSet.drawValuesEnabled = false
FBSnapshotVerifyView(chart)
}
func testDoesntDrawCircles()
{
dataSet.drawCirclesEnabled = false
FBSnapshotVerifyView(chart)
}
func testIsCubic()
{
dataSet.drawCubicEnabled = true
FBSnapshotVerifyView(chart)
}
func testDoesntDrawCircleHole()
{
dataSet.drawCircleHoleEnabled = false
FBSnapshotVerifyView(chart)
}
}