From 055a8c8bc3c6c09a1080fe918dae63e7a1bece0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Rodr=C3=ADguez?= Date: Mon, 14 Jun 2021 12:41:16 -0500 Subject: [PATCH] beta 16 --- src/LiveChartsCore/CartesianChart.cs | 2 +- src/LiveChartsCore/LiveChartsCore.csproj | 2 +- ...veChartsCore.SkiaSharpView.Avalonia.csproj | 4 +- .../LiveChartsCore.SkiaSharpView.WPF.csproj | 4 +- ...veChartsCore.SkiaSharpView.WinForms.csproj | 2 +- ...artsCore.SkiaSharpView.XamarinForms.csproj | 2 +- .../LiveChartsCore.SkiaSharpView.csproj | 2 +- .../ChangingPaintTasks.cs | 96 +++++++++++++++++++ 8 files changed, 105 insertions(+), 9 deletions(-) diff --git a/src/LiveChartsCore/CartesianChart.cs b/src/LiveChartsCore/CartesianChart.cs index 8658ce9a8..3ab88281f 100644 --- a/src/LiveChartsCore/CartesianChart.cs +++ b/src/LiveChartsCore/CartesianChart.cs @@ -387,7 +387,7 @@ protected override void Measure() .Cast>() .ToArray(); - Sections = _chartView.Sections.ToArray(); + Sections = _chartView.Sections?.ToArray() ?? new Section[0]; #endregion diff --git a/src/LiveChartsCore/LiveChartsCore.csproj b/src/LiveChartsCore/LiveChartsCore.csproj index f4308a8a2..a9e27dca0 100644 --- a/src/LiveChartsCore/LiveChartsCore.csproj +++ b/src/LiveChartsCore/LiveChartsCore.csproj @@ -6,7 +6,7 @@ net462;netstandard2.0;netcoreapp2.0; LiveChartsCore LiveChartsCore - 2.0.0-beta.15 + 2.0.0-beta.16 icon.png diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj index f89257b86..8cc04a4bd 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Avalonia/LiveChartsCore.SkiaSharpView.Avalonia.csproj @@ -1,4 +1,4 @@ - + Library 9.0 @@ -6,7 +6,7 @@ netcoreapp2.0;netstandard2.0;net462; LiveChartsCore.SkiaSharpView.Avalonia LiveChartsCore.SkiaSharpView.Avalonia - 2.0.0-beta.15 + 2.0.0-beta.16 icon.png diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj index 27ea0ea17..ff5e7a5e6 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WPF/LiveChartsCore.SkiaSharpView.WPF.csproj @@ -1,4 +1,4 @@ - + enable @@ -7,7 +7,7 @@ net462;netcoreapp3.0 LiveChartsCore.SkiaSharpView.WPF LiveChartsCore.SkiaSharpView.WPF - 2.0.0-beta.15 + 2.0.0-beta.16 icon.png diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj index c634a05a6..e48412636 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.WinForms/LiveChartsCore.SkiaSharpView.WinForms.csproj @@ -9,7 +9,7 @@ net462;netcoreapp3.0 LiveChartsCore.SkiaSharpView.WinForms LiveChartsCore.SkiaSharpView.WinForms - 2.0.0-beta.15 + 2.0.0-beta.16 icon.png diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp.Xamarin.Forms/LiveChartsCore.SkiaSharpView.XamarinForms.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp.Xamarin.Forms/LiveChartsCore.SkiaSharpView.XamarinForms.csproj index 5f68257d1..e3d6bff95 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp.Xamarin.Forms/LiveChartsCore.SkiaSharpView.XamarinForms.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp.Xamarin.Forms/LiveChartsCore.SkiaSharpView.XamarinForms.csproj @@ -6,7 +6,7 @@ netstandard2.0; LiveChartsCore.SkiaSharpView.XamarinForms LiveChartsCore.SkiaSharpView.XamarinForms - 2.0.0-beta.15 + 2.0.0-beta.16 icon.png diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj b/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj index c643dd8a5..af4024bce 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/LiveChartsCore.SkiaSharpView.csproj @@ -6,7 +6,7 @@ net462;netstandard2.0;netcoreapp2.0; LiveChartsCore.SkiaSharpView LiveChartsCore.SkiaSharpView - 2.0.0-beta.15 + 2.0.0-beta.16 icon.png diff --git a/tests/LiveChartsCore.UnitTesting/ChangingPaintTasks.cs b/tests/LiveChartsCore.UnitTesting/ChangingPaintTasks.cs index 5947e8f44..3ad6eb108 100644 --- a/tests/LiveChartsCore.UnitTesting/ChangingPaintTasks.cs +++ b/tests/LiveChartsCore.UnitTesting/ChangingPaintTasks.cs @@ -383,5 +383,101 @@ void DrawChart() drawables == canvas.DrawablesCount && geometries == canvas.CountGeometries()); } + + [TestMethod] + public void SectionBrushChanged() + { + var section = new RectangularSection + { + Fill = new SolidColorPaintTask() + }; + + var chart = new TestCartesianChartView + { + Series = new List + { + new LineSeries { Values = new List { 1, 6, 4, 2 } }, + }, + XAxes = new[] { new Axis() }, + YAxes = new[] { new Axis() }, + Sections = new[] { section } + }; + + var canvas = chart.CoreCanvas; + + void DrawChart() + { + while (!canvas.IsValid) + { + canvas.DrawFrame( + new SkiaSharpDrawingContext( + canvas, + new SKImageInfo(100, 100), + SKSurface.CreateNull(100, 100), + new SKCanvas(new SKBitmap()))); + } + } + + chart.Core.Update(new ChartUpdateParams { Throttling = false }); + DrawChart(); + + var drawables = canvas.DrawablesCount; + var geometries = canvas.CountGeometries(); + + section.Fill = new SolidColorPaintTask(); + + chart.Core.Update(new ChartUpdateParams { Throttling = false }); + DrawChart(); + + Assert.IsTrue( + drawables == canvas.DrawablesCount && + geometries == canvas.CountGeometries()); + } + + [TestMethod] + public void SectionsInstanceChanged() + { + var chart = new TestCartesianChartView + { + Series = new List + { + new LineSeries { Values = new List { 1, 6, 4, 2 } }, + }, + XAxes = new[] { new Axis() }, + YAxes = new[] { new Axis() }, + Sections = new[] { new RectangularSection() } + }; + + var canvas = chart.CoreCanvas; + + void DrawChart() + { + while (!canvas.IsValid) + { + canvas.DrawFrame( + new SkiaSharpDrawingContext( + canvas, + new SKImageInfo(100, 100), + SKSurface.CreateNull(100, 100), + new SKCanvas(new SKBitmap()))); + } + } + + chart.Core.Update(new ChartUpdateParams { Throttling = false }); + DrawChart(); + + var drawables = canvas.DrawablesCount; + var geometries = canvas.CountGeometries(); + + chart.Sections = new[] { new RectangularSection() }; + + chart.Core.Update(new ChartUpdateParams { Throttling = false }); + DrawChart(); + + Assert.IsTrue( + drawables == canvas.DrawablesCount && + geometries == canvas.CountGeometries()); + } + } }