Browse Source

Path Geometry update fix for 4748 bug rerender on change for paths segments (#18025)

* Add failing Path Geometry update test

#4748 [BUG] Rerender on change for Paths, Segments and e.g.
Failing Test

* Fixes failing Path Geometry update test

Fixes #4748 [BUG] Rerender on change for Paths, Segments and e.g.
pull/18076/head
Evan Ruiz 1 year ago
committed by GitHub
parent
commit
3e3f11d84f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      src/Avalonia.Base/Media/PathGeometry.cs
  2. 32
      tests/Avalonia.Base.UnitTests/Media/PathGeometryTests.cs

2
src/Avalonia.Base/Media/PathGeometry.cs

@ -35,7 +35,7 @@ namespace Avalonia.Media
/// </summary>
public PathGeometry()
{
_figures = new PathFigures();
Figures = new PathFigures();
}
/// <summary>

32
tests/Avalonia.Base.UnitTests/Media/PathGeometryTests.cs

@ -0,0 +1,32 @@
using Avalonia.Media;
using Xunit;
namespace Avalonia.Base.UnitTests.Media;
public class PathGeometryTests
{
[Fact]
public void PathGeometry_Triggers_Invalidation_On_Figures_Add()
{
var segment = new PolyLineSegment()
{
Points = [new Point(1, 1), new Point(2, 2)]
};
var figure = new PathFigure()
{
Segments = [segment],
IsClosed = false,
IsFilled = false,
};
var target = new PathGeometry();
var changed = false;
target.Changed += (_, _) => { changed = true; };
target.Figures?.Add(figure);
Assert.True(changed);
}
}
Loading…
Cancel
Save