Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/Avalonia.Base/Media/PathGeometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static PathGeometry()
/// </summary>
public PathGeometry()
{
_figures = new PathFigures();
Figures = new PathFigures();
}

/// <summary>
Expand Down
32 changes: 32 additions & 0 deletions tests/Avalonia.Base.UnitTests/Media/PathGeometryTests.cs
Original file line number Diff line number Diff line change
@@ -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