diff options
author | Eric Maupin <me@ermau.com> | 2019-02-21 18:39:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-21 18:39:46 +0300 |
commit | 188bdd4e8d3f200b5506ae473743cdf8a0aa0872 (patch) | |
tree | 339db39469d3148a37476603af97d4081e368e88 /Xamarin.PropertyEditing.Tests | |
parent | 74cd11cc4e3972b8ca00eacd5c5015e796eac375 (diff) | |
parent | af9ca3b7b44d4a9d00ec76e9116a2c9d204ae501 (diff) |
Merge pull request #541 from xamarin/ermau-type-selector-editor
Type selector editor
Diffstat (limited to 'Xamarin.PropertyEditing.Tests')
3 files changed, 10 insertions, 4 deletions
diff --git a/Xamarin.PropertyEditing.Tests/MockControls/MockControl.cs b/Xamarin.PropertyEditing.Tests/MockControls/MockControl.cs index 66795a8..585bb7f 100644 --- a/Xamarin.PropertyEditing.Tests/MockControls/MockControl.cs +++ b/Xamarin.PropertyEditing.Tests/MockControls/MockControl.cs @@ -15,7 +15,7 @@ namespace Xamarin.PropertyEditing.Tests.MockControls bool canWrite = true, bool flag = false, IEnumerable<Type> converterTypes = null, string description = null, bool constrained = true, ValueSources valueSources = ValueSources.Local | ValueSources.Default | ValueSources.Binding, - IReadOnlyList<InputMode> inputModes = null, PropertyVariationOption[] options = null, bool isUncommon = false) + IReadOnlyList<InputMode> inputModes = null, PropertyVariationOption[] options = null, bool isUncommon = false, ITypeInfo realType = null) { IPropertyInfo propertyInfo; if (typeof(T).IsEnum) { @@ -26,7 +26,7 @@ namespace Xamarin.PropertyEditing.Tests.MockControls } else if (inputModes != null) { propertyInfo = new MockPropertyInfoWithInputTypes<T> (name, inputModes, description, category, canWrite, converterTypes, valueSources, options); } else { - propertyInfo = new MockPropertyInfo<T> (name, description, category, canWrite, converterTypes, valueSources, options, isUncommon); + propertyInfo = new MockPropertyInfo<T> (name, description, category, canWrite, converterTypes, valueSources, options, isUncommon, realType); } AddProperty<T> (propertyInfo); diff --git a/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs b/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs index b92fb13..7e1a8a8 100644 --- a/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs +++ b/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs @@ -37,6 +37,7 @@ namespace Xamarin.PropertyEditing.Tests.MockControls AddProperty<CommonThickness> ("Thickness", ReadWrite); AddProperty<object> ("Object", ReadWrite); AddProperty<IList> ("Collection", ReadWrite); + AddProperty<ITypeInfo> ("Type", ReadWrite, realType: typeof(Type).ToTypeInfo()); AddReadOnlyProperty<bool> ("ReadOnlyBoolean", ReadOnly); AddReadOnlyProperty<int> ("ReadOnlyInteger", ReadOnly); diff --git a/Xamarin.PropertyEditing.Tests/MockPropertyInfo/MockPropertyInfo.cs b/Xamarin.PropertyEditing.Tests/MockPropertyInfo/MockPropertyInfo.cs index 9a3ea41..c155b90 100644 --- a/Xamarin.PropertyEditing.Tests/MockPropertyInfo/MockPropertyInfo.cs +++ b/Xamarin.PropertyEditing.Tests/MockPropertyInfo/MockPropertyInfo.cs @@ -23,7 +23,7 @@ namespace Xamarin.PropertyEditing.Tests.MockPropertyInfo public class MockPropertyInfo<T> : IPropertyInfo, IPropertyConverter, IEquatable<MockPropertyInfo<T>> { - public MockPropertyInfo (string name, string description = null, string category = null, bool canWrite = true, IEnumerable<Type> converterTypes = null, ValueSources valueSources = ValueSources.Local | ValueSources.Default, PropertyVariationOption[] options = null, bool isUncommon = false) + public MockPropertyInfo (string name, string description = null, string category = null, bool canWrite = true, IEnumerable<Type> converterTypes = null, ValueSources valueSources = ValueSources.Local | ValueSources.Default, PropertyVariationOption[] options = null, bool isUncommon = false, ITypeInfo realType = null) { Name = name; Description = description; @@ -43,13 +43,18 @@ namespace Xamarin.PropertyEditing.Tests.MockPropertyInfo } Variations = options ?? EmptyVariationOptions; + RealType = realType ?? typeof (T).ToTypeInfo (); } public string Name { get; } public string Description { get; } public virtual Type Type => typeof (T); - public virtual ITypeInfo RealType => typeof(T).ToTypeInfo (); + public ITypeInfo RealType + { + get; + private set; + } public string Category { get; } public bool CanWrite { get; } |