diff options
author | Eric Maupin <ermaup@microsoft.com> | 2019-09-30 20:52:55 +0300 |
---|---|---|
committer | Eric Maupin <ermaup@microsoft.com> | 2019-09-30 20:58:42 +0300 |
commit | 3d5b178f9fd086888a3d17a390e1f06a8bad8076 (patch) | |
tree | 649b003451382e2ab62a791c249922f2576b0492 /Xamarin.PropertyEditing.Tests | |
parent | 2b789a918bcfe3ad9fcbe5443839d9c7bebd5b3c (diff) |
[Tests] Don't erase variant on reset
Diffstat (limited to 'Xamarin.PropertyEditing.Tests')
-rw-r--r-- | Xamarin.PropertyEditing.Tests/MockObjectEditor.cs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Xamarin.PropertyEditing.Tests/MockObjectEditor.cs b/Xamarin.PropertyEditing.Tests/MockObjectEditor.cs index ffd7261..5666533 100644 --- a/Xamarin.PropertyEditing.Tests/MockObjectEditor.cs +++ b/Xamarin.PropertyEditing.Tests/MockObjectEditor.cs @@ -205,7 +205,16 @@ namespace Xamarin.PropertyEditing.Tests if (value.Source != ValueSource.Local && ValueEvaluator != null) { value.Value = (T)ValueEvaluator (property, value.ValueDescriptor, value.SourceDescriptor); } else if (value.Source == ValueSource.Unset || (property.ValueSources.HasFlag (ValueSources.Default) && Equals (value.Value, default(T))) && value.ValueDescriptor == null && value.SourceDescriptor == null) { - if (propertyValues.Remove (variations ?? NeutralVariations)) { + bool changed = false; + if (variations == NeutralVariations) { + propertyValues.Remove (NeutralVariations); + changed = true; + } else if (variations != null) { + propertyValues[variations] = value; + changed = true; + } + + if (changed) { PropertyChanged?.Invoke (this, new EditorPropertyChangedEventArgs (property, variations)); return Task.CompletedTask; } |