From f38cd3b60afc7b7c6bef62757aa5776a88cd18bb Mon Sep 17 00:00:00 2001 From: EvanRuiz Date: Wed, 22 Jan 2025 12:04:53 -0500 Subject: [PATCH 1/2] Add failing Path Geometry update test #4748 [BUG] Rerender on change for Paths, Segments and e.g. Failing Test --- .../Media/PathGeometryTests.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/Avalonia.Base.UnitTests/Media/PathGeometryTests.cs diff --git a/tests/Avalonia.Base.UnitTests/Media/PathGeometryTests.cs b/tests/Avalonia.Base.UnitTests/Media/PathGeometryTests.cs new file mode 100644 index 00000000000..9648187e61e --- /dev/null +++ b/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); + } +} From 2e36a872256a7ef6df8d7da2e00e7402517a725b Mon Sep 17 00:00:00 2001 From: EvanRuiz Date: Wed, 22 Jan 2025 12:08:48 -0500 Subject: [PATCH 2/2] Fixes failing Path Geometry update test Fixes #4748 [BUG] Rerender on change for Paths, Segments and e.g. --- src/Avalonia.Base/Media/PathGeometry.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Base/Media/PathGeometry.cs b/src/Avalonia.Base/Media/PathGeometry.cs index bdfbfadce4d..c07535c00b3 100644 --- a/src/Avalonia.Base/Media/PathGeometry.cs +++ b/src/Avalonia.Base/Media/PathGeometry.cs @@ -35,7 +35,7 @@ static PathGeometry() /// public PathGeometry() { - _figures = new PathFigures(); + Figures = new PathFigures(); } ///