Browse Source

fix #5033: always run snapshot tests in light mode

Pierre-Marc Airoldi 2 years ago
parent
commit
51468ce3a8

+ 8 - 0
ChartsDemo-iOS/Swift/Demos/PieChartViewController.swift

@@ -106,6 +106,14 @@ class PieChartViewController: DemoBaseViewController {
         
         chartView.data = data
         chartView.highlightValues(nil)
+      
+      
+      var highlights: [Highlight] = []
+      for entry in entries {
+        let highlight = Highlight(x: entry.x, y: entry.y, dataSetIndex: 0)
+          highlights.append(highlight)
+      }
+      chartView.highlightValues(highlights)
     }
     
     override func optionTapped(_ option: Option) {

+ 1 - 1
Tests/ChartsTests/Utilities.swift

@@ -44,7 +44,7 @@ func assertChartSnapshot<Value: ChartViewBase>(
 
     let failure = verifySnapshot(
         matching: try value(),
-        as: .image,
+        as: .image(traits: .init(userInterfaceStyle: .light)),
         record: recording,
         snapshotDirectory: snapshotDirectory,
         timeout: timeout,