-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18910 from unoplatform/dev/jela/overflow-perf
perf: Don't use multicast delegates for DependencyObjectCollection.VectorChanged
- Loading branch information
Showing
2 changed files
with
120 additions
and
2 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_DependencyObjectCollection.cs
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,31 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.ObjectiveC; | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml; | ||
|
||
[TestClass] | ||
public class Given_DependencyObjectCollection | ||
{ | ||
[TestMethod] | ||
public void When_Add_Multiple_And_Invoke() | ||
{ | ||
DependencyObjectCollection c = new(); | ||
|
||
List<string> list = []; | ||
|
||
void One(object sender, object args) => list.Add("One"); | ||
void Two(object sender, object args) => list.Add("Two"); | ||
|
||
c.VectorChanged += One; | ||
c.VectorChanged += Two; | ||
c.VectorChanged += One; | ||
c.VectorChanged -= One; | ||
|
||
c.Add(c); | ||
|
||
Assert.IsTrue(list.SequenceEqual(["One", "Two"])); | ||
} | ||
} |
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