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 branch 'master' of https://github.com/danielgindi/Charts
* 'master' of https://github.com/danielgindi/Charts: add pie chart unit tests (ChartsOrg#3297) ChartsOrg#3287: align Objc and Swift demos balloon marker update changelog Min and Max reset when clearing ChartDataSet (Fixes ChartsOrg#3260) # Conflicts: # Source/Charts/Mark/BalloonMarker.swift
- Loading branch information
Showing
15 changed files
with
568 additions
and
72 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,73 @@ | ||
import XCTest | ||
import FBSnapshotTestCase | ||
@testable import Charts | ||
|
||
class PieChartTests: FBSnapshotTestCase | ||
{ | ||
|
||
var chart: PieChartView! | ||
var dataSet: PieChartDataSet! | ||
|
||
override func setUp() | ||
{ | ||
super.setUp() | ||
|
||
// Set to `true` to re-capture all snapshots | ||
self.recordMode = false | ||
|
||
// Sample data | ||
let values: [Double] = [11, 33, 81, 52, 97, 101, 75] | ||
|
||
var entries: [PieChartDataEntry] = Array() | ||
|
||
for value in values | ||
{ | ||
entries.append(PieChartDataEntry(value: value, icon: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil))) | ||
} | ||
|
||
dataSet = PieChartDataSet(values: entries, label: "First unit test data") | ||
dataSet.drawIconsEnabled = false | ||
dataSet.iconsOffset = CGPoint(x: 0, y: 20.0) | ||
|
||
dataSet.colors = ChartColorTemplates.vordiplom() | ||
+ ChartColorTemplates.joyful() | ||
+ ChartColorTemplates.colorful() | ||
+ ChartColorTemplates.liberty() | ||
+ ChartColorTemplates.pastel() | ||
+ [UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)] | ||
|
||
chart = PieChartView(frame: CGRect(x: 0, y: 0, width: 480, height: 350)) | ||
chart.backgroundColor = NSUIColor.clear | ||
chart.centerText = "PieChart Unit Test" | ||
chart.data = PieChartData(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, identifier: Snapshot.identifier(UIScreen.main.bounds.size), tolerance: Snapshot.tolerance) | ||
} | ||
|
||
func testHidesValues() | ||
{ | ||
dataSet.drawValuesEnabled = false | ||
FBSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), tolerance: Snapshot.tolerance) | ||
} | ||
|
||
func testDrawIcons() | ||
{ | ||
dataSet.drawIconsEnabled = true | ||
FBSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), tolerance: Snapshot.tolerance) | ||
} | ||
|
||
func testHideCenterLabel() | ||
{ | ||
chart.drawCenterTextEnabled = false | ||
FBSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), tolerance: Snapshot.tolerance) | ||
} | ||
} |
Binary file added
BIN
+56.2 KB
...nceImages_64/ChartsTests.PieChartTests/testDefaultValues_iOS_375.0_667.0@2x.png
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
+24.8 KB
...nceImages_64/ChartsTests.PieChartTests/testDefaultValues_tvOS_1920.0_1080.0.png
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
+56.2 KB
...eImages_64/ChartsTests.PieChartTests/testDrawCenterLabel_iOS_375.0_667.0@2x.png
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
+65.7 KB
...ferenceImages_64/ChartsTests.PieChartTests/testDrawIcons_iOS_375.0_667.0@2x.png
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
+32.6 KB
...ferenceImages_64/ChartsTests.PieChartTests/testDrawIcons_tvOS_1920.0_1080.0.png
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
+53.5 KB
...eImages_64/ChartsTests.PieChartTests/testHideCenterLabel_iOS_375.0_667.0@2x.png
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
+23.4 KB
...eImages_64/ChartsTests.PieChartTests/testHideCenterLabel_tvOS_1920.0_1080.0.png
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 KB
...renceImages_64/ChartsTests.PieChartTests/testHidesValues_iOS_375.0_667.0@2x.png
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
+21.8 KB
...renceImages_64/ChartsTests.PieChartTests/testHidesValues_tvOS_1920.0_1080.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.