-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Points collection observability support for Polygon and Polyline (#…
…15030) * Add Points binding observability support for Polygon and Polyline * Add simple tests for Polygon and Polyline Points updating * Revert "Add Points binding observability support for Polygon and Polyline" This reverts commit e16d987. * Move Geometry.Changed handler to Shape class to make it available to all inheritors * Fixes the event subscriptions * Fix tests * Add memory leak tests
- Loading branch information
Showing
8 changed files
with
149 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Collections.ObjectModel; | ||
using Avalonia.Controls.Shapes; | ||
using Avalonia.UnitTests; | ||
using Xunit; | ||
|
||
namespace Avalonia.Controls.UnitTests.Shapes; | ||
|
||
public class PolygonTests | ||
{ | ||
[Fact] | ||
public void Polygon_Will_Update_Geometry_On_Shapes_Collection_Content_Change() | ||
{ | ||
using var app = UnitTestApplication.Start(TestServices.MockPlatformRenderInterface); | ||
var points = new ObservableCollection<Point>(); | ||
|
||
var target = new Polygon() { Points = points }; | ||
target.Measure(new Size()); | ||
Assert.True(target.IsMeasureValid); | ||
|
||
var root = new TestRoot(target); | ||
|
||
points.Add(new Point()); | ||
|
||
Assert.False(target.IsMeasureValid); | ||
|
||
root.Child = null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Collections.ObjectModel; | ||
using Avalonia.Controls.Shapes; | ||
using Avalonia.UnitTests; | ||
using Xunit; | ||
|
||
namespace Avalonia.Controls.UnitTests.Shapes; | ||
|
||
public class PolylineTests | ||
{ | ||
[Fact] | ||
public void Polyline_Will_Update_Geometry_On_Shapes_Collection_Content_Change() | ||
{ | ||
using var app = UnitTestApplication.Start(TestServices.MockPlatformRenderInterface); | ||
var points = new ObservableCollection<Point>(); | ||
|
||
var target = new Polyline { Points = points }; | ||
target.Measure(new Size()); | ||
Assert.True(target.IsMeasureValid); | ||
|
||
var root = new TestRoot(target); | ||
|
||
points.Add(new Point()); | ||
|
||
Assert.False(target.IsMeasureValid); | ||
|
||
root.Child = null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters