forked from ChartsOrg/Charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ChartsOrg#580 from alvesjtiago/bar-chart-tests
Bar chart tests
- Loading branch information
Showing
12 changed files
with
102 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
github "facebook/ios-snapshot-test-case" "2.0.5" | ||
github "facebook/ios-snapshot-test-case" "2.0.7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import XCTest | ||
import FBSnapshotTestCase | ||
@testable import Charts | ||
|
||
class BarChartTests: FBSnapshotTestCase | ||
{ | ||
|
||
var chart: BarChartView! | ||
var dataSet: BarChartDataSet! | ||
|
||
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(BarChartDataEntry.init(value: value, xIndex: i)) | ||
xValues.append("\(i)") | ||
} | ||
|
||
dataSet = BarChartDataSet(yVals: entries, label: "Bar chart unit test data") | ||
|
||
chart = BarChartView(frame: CGRectMake(0, 0, 480, 350)) | ||
chart.data = BarChartData(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 testHideLeftAxis() | ||
{ | ||
chart.leftAxis.drawAxisLineEnabled = false | ||
FBSnapshotVerifyView(chart) | ||
} | ||
|
||
func testHideRightAxis() | ||
{ | ||
chart.rightAxis.drawAxisLineEnabled = false | ||
FBSnapshotVerifyView(chart) | ||
} | ||
|
||
func testHideLeftAxisGridlines() | ||
{ | ||
chart.leftAxis.drawGridLinesEnabled = false | ||
FBSnapshotVerifyView(chart) | ||
} | ||
|
||
func testHideRightAxisGridlines() | ||
{ | ||
chart.rightAxis.drawGridLinesEnabled = false | ||
FBSnapshotVerifyView(chart) | ||
} | ||
} |
Binary file added
BIN
+63.4 KB
...artsTests/ReferenceImages_64/ChartsTests.BarChartTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+63.4 KB
...hartsTests/ReferenceImages_64/ChartsTests.BarChartTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+63.8 KB
...artsTests/ReferenceImages_64/ChartsTests.BarChartTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+49.7 KB
...ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.