Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion tests/SnapshotTests/LineSeriesTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LiveChartsCore.Defaults;
using System.Collections.ObjectModel;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.Painting;
using LiveChartsCore.SkiaSharpView.SKCharts;
Expand Down Expand Up @@ -85,4 +85,43 @@ public void Curved()

chart.AssertSnapshotMatches($"{nameof(LineSeriesTests)}_{nameof(Curved)}");
}

[TestMethod]
public void Gaps()
{
var points = new ObservableCollection<int?>([1, 1]);

var chart = new SKCartesianChart
{
Series = [
new LineSeries<int?>
{
Values = points,
Fill = null
}
],
Width = 600,
Height = 600
};

_ = chart.GetImage();

var count = 0;
int?[] toAdd = [null, 1];

void Push()
{
points.Add(toAdd[count++ % toAdd.Length]);
points.RemoveAt(0);

_ = chart.GetImage();
}
Comment on lines +326 to +337

Copilot AI Mar 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SKCartesianChart.GetImage() returns an SKImage that holds unmanaged resources and should be disposed. These calls discard the returned image without disposing it, which can leak native memory during the test run. Consider disposing the returned image (or switching to SaveImage, which already disposes internally) for the warm-up render and for each Push() render.

Copilot uses AI. Check for mistakes.

Push();
Push();
Push();
Push();

chart.AssertSnapshotMatches($"{nameof(LineSeriesTests)}_{nameof(Gaps)}");
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading