diff options
author | Eric Maupin <ermaup@microsoft.com> | 2018-05-01 21:48:51 +0300 |
---|---|---|
committer | Eric Maupin <ermaup@microsoft.com> | 2018-05-01 21:48:51 +0300 |
commit | 22d52b87dae67027b4fb0aecd688008812535c5b (patch) | |
tree | 2dbf8059bd4892b376c310e9a958866d15b9ecc1 /Xamarin.PropertyEditing.Tests | |
parent | 6f02e9bac95be36b7a22168cf275fa1205711e3d (diff) |
[Core] Fix grouped properties not properly adding at the end
Diffstat (limited to 'Xamarin.PropertyEditing.Tests')
-rw-r--r-- | Xamarin.PropertyEditing.Tests/PanelViewModelTests.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Xamarin.PropertyEditing.Tests/PanelViewModelTests.cs b/Xamarin.PropertyEditing.Tests/PanelViewModelTests.cs index 1525c35..53e3078 100644 --- a/Xamarin.PropertyEditing.Tests/PanelViewModelTests.cs +++ b/Xamarin.PropertyEditing.Tests/PanelViewModelTests.cs @@ -644,6 +644,39 @@ namespace Xamarin.PropertyEditing.Tests } [Test] + [Description ("Bug coverage for grouped property failing to add if last")] + public void AddGroupedAtEnd () + { + var normalProp = new Mock<IPropertyInfo> (); + normalProp.SetupGet (p => p.Type).Returns (typeof(string)); + normalProp.SetupGet (p => p.Category).Returns ("Category"); + normalProp.SetupGet (p => p.Name).Returns ("name"); + + var groupProp = new Mock<IPropertyInfo> (); + groupProp.SetupGet (p => p.Type).Returns (typeof(int)); + + var target = new object(); + + var provider = new Mock<IEditorProvider> (); + provider.Setup (p => p.GetObjectEditorAsync (target)) + .ReturnsAsync (new MockObjectEditor (normalProp.Object, groupProp.Object)); + + var platform = new TargetPlatform (provider.Object) { + GroupedTypes = new Dictionary<Type, string> { + { typeof(int), "ints" } + } + }; + + var vm = new PanelViewModel (platform) { + ArrangeMode = PropertyArrangeMode.Category, + AutoExpand = true + }; + vm.SelectedObjects.Add (target); + + Assert.That (vm.ArrangedEditors.Any (g => g.Key == "ints"), Is.True, "Does not have grouped editors category"); + } + + [Test] public async Task AutoExpand () { var provider = new ReflectionEditorProvider (); |