Skip to content

Commit 196202d

Browse files
committed
Added tests for BarChartView
1 parent 29e4f58 commit 196202d

File tree

5 files changed

+33
-1
lines changed

5 files changed

+33
-1
lines changed

Source/Charts/Charts/ChartViewBase.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
456456
}
457457

458458
// set the indices to highlight
459-
highlighted = [h]
459+
highlighted = [h]
460460

461461
if callDelegate
462462
{

Tests/ChartsTests/BarChartTests.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,4 +367,36 @@ class BarChartTests: XCTestCase {
367367
chart.notifyDataSetChanged()
368368
assertChartSnapshot(matching: chart)
369369
}
370+
371+
func testBarShadow() {
372+
let dataEntries = setupDefaultValuesDataEntries()
373+
let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries)
374+
let chart = setupDefaultChart(dataSets: [dataSet])
375+
dataSet.barShadowColor = NSUIColor(red: 255.0/255.0, green: 187.0/255.0, blue: 115.0/255.0, alpha: 1.0)
376+
chart.drawBarShadowEnabled = true
377+
chart.notifyDataSetChanged()
378+
assertChartSnapshot(matching: chart)
379+
}
380+
381+
func testHighlightSingleValue() {
382+
let dataEntries = setupDefaultValuesDataEntries()
383+
let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries)
384+
let chart = setupDefaultChart(dataSets: [dataSet])
385+
chart.notifyDataSetChanged()
386+
chart.highlightValue(x: dataEntries[0].x, dataSetIndex: 0, callDelegate: false)
387+
assertChartSnapshot(matching: chart)
388+
}
389+
390+
func testHighlightMultipleValue() {
391+
let dataEntries = setupDefaultValuesDataEntries()
392+
let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries)
393+
let chart = setupDefaultChart(dataSets: [dataSet])
394+
chart.notifyDataSetChanged()
395+
chart.highlightValues(
396+
[.init(x: dataEntries[0].x, y: dataEntries[0].y, dataSetIndex: 0),
397+
.init(x: dataEntries[4].x, y: dataEntries[4].y, dataSetIndex: 0),
398+
.init(x: dataEntries[5].x, y: dataEntries[5].y, dataSetIndex: 0)]
399+
)
400+
assertChartSnapshot(matching: chart)
401+
}
370402
}
141 KB
Loading
103 KB
Loading
103 KB
Loading

0 commit comments

Comments
 (0)