Skip to content

Commit

Permalink
beta 16
Browse files Browse the repository at this point in the history
  • Loading branch information
beto-rodriguez committed Jun 14, 2021
1 parent fdd091d commit 055a8c8
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/LiveChartsCore/CartesianChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ protected override void Measure()
.Cast<ICartesianSeries<TDrawingContext>>()
.ToArray();

Sections = _chartView.Sections.ToArray();
Sections = _chartView.Sections?.ToArray() ?? new Section<TDrawingContext>[0];

#endregion

Expand Down
2 changes: 1 addition & 1 deletion src/LiveChartsCore/LiveChartsCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<TargetFrameworks>net462;netstandard2.0;netcoreapp2.0;</TargetFrameworks>
<AssemblyName>LiveChartsCore</AssemblyName>
<RootNamespace>LiveChartsCore</RootNamespace>
<Version>2.0.0-beta.15</Version>
<Version>2.0.0-beta.16</Version>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
<TargetFrameworks>netcoreapp2.0;netstandard2.0;net462;</TargetFrameworks>
<AssemblyName>LiveChartsCore.SkiaSharpView.Avalonia</AssemblyName>
<RootNamespace>LiveChartsCore.SkiaSharpView.Avalonia</RootNamespace>
<Version>2.0.0-beta.15</Version>
<Version>2.0.0-beta.16</Version>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<Nullable>enable</Nullable>
Expand All @@ -7,7 +7,7 @@
<TargetFrameworks>net462;netcoreapp3.0</TargetFrameworks>
<AssemblyName>LiveChartsCore.SkiaSharpView.WPF</AssemblyName>
<RootNamespace>LiveChartsCore.SkiaSharpView.WPF</RootNamespace>
<Version>2.0.0-beta.15</Version>
<Version>2.0.0-beta.16</Version>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<TargetFrameworks>net462;netcoreapp3.0</TargetFrameworks>
<AssemblyName>LiveChartsCore.SkiaSharpView.WinForms</AssemblyName>
<RootNamespace>LiveChartsCore.SkiaSharpView.WinForms</RootNamespace>
<Version>2.0.0-beta.15</Version>
<Version>2.0.0-beta.16</Version>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<TargetFrameworks>netstandard2.0;</TargetFrameworks>
<AssemblyName>LiveChartsCore.SkiaSharpView.XamarinForms</AssemblyName>
<RootNamespace>LiveChartsCore.SkiaSharpView.XamarinForms</RootNamespace>
<Version>2.0.0-beta.15</Version>
<Version>2.0.0-beta.16</Version>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<TargetFrameworks>net462;netstandard2.0;netcoreapp2.0;</TargetFrameworks>
<AssemblyName>LiveChartsCore.SkiaSharpView</AssemblyName>
<RootNamespace>LiveChartsCore.SkiaSharpView</RootNamespace>
<Version>2.0.0-beta.15</Version>
<Version>2.0.0-beta.16</Version>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

Expand Down
96 changes: 96 additions & 0 deletions tests/LiveChartsCore.UnitTesting/ChangingPaintTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ISeries>
{
new LineSeries<int> { Values = new List<int> { 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<ISeries>
{
new LineSeries<int> { Values = new List<int> { 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());
}

}
}

0 comments on commit 055a8c8

Please sign in to comment.