-
-
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.
Merge pull request #12146 from MrJul/fixes/composition-resources-inva…
…lidation Fix composition render resources invalidation
- Loading branch information
Showing
3 changed files
with
78 additions
and
12 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
53 changes: 53 additions & 0 deletions
53
tests/Avalonia.Base.UnitTests/Utilities/InlineDictionaryTests.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,53 @@ | ||
#nullable enable | ||
|
||
using System.Collections.Generic; | ||
using Avalonia.Utilities; | ||
using Xunit; | ||
|
||
namespace Avalonia.Base.UnitTests.Utilities; | ||
|
||
public class InlineDictionaryTests | ||
{ | ||
[Fact] | ||
public void Enumeration_After_Add_With_Internal_Array_Works() | ||
{ | ||
var dic = new InlineDictionary<string, int>(); | ||
dic.Add("foo", 1); | ||
dic.Add("bar", 2); | ||
dic.Add("baz", 3); | ||
|
||
Assert.Equal( | ||
new[] { | ||
new KeyValuePair<string, int>("foo", 1), | ||
new KeyValuePair<string, int>("bar", 2), | ||
new KeyValuePair<string, int>("baz", 3) | ||
}, | ||
dic); | ||
} | ||
|
||
[Fact] | ||
public void Enumeration_After_Remove_With_Internal_Array_Works() | ||
{ | ||
var dic = new InlineDictionary<string, int>(); | ||
dic.Add("foo", 1); | ||
dic.Add("bar", 2); | ||
dic.Add("baz", 3); | ||
|
||
Assert.Equal( | ||
new[] { | ||
new KeyValuePair<string, int>("foo", 1), | ||
new KeyValuePair<string, int>("bar", 2), | ||
new KeyValuePair<string, int>("baz", 3) | ||
}, | ||
dic); | ||
|
||
dic.Remove("bar"); | ||
|
||
Assert.Equal( | ||
new[] { | ||
new KeyValuePair<string, int>("foo", 1), | ||
new KeyValuePair<string, int>("baz", 3) | ||
}, | ||
dic); | ||
} | ||
} |