diff options
author | Eric Maupin <ermaup@microsoft.com> | 2018-07-19 21:30:44 +0300 |
---|---|---|
committer | Eric Maupin <ermaup@microsoft.com> | 2018-07-19 21:35:41 +0300 |
commit | 865c057febe458fe004ddc7820b6e50616b7009a (patch) | |
tree | 72874a259f1da483d51986fba42e8dcb41829039 | |
parent | 2bd78ab81b5e6ff7b91e491d3851329ed504b637 (diff) |
[Tests] Move brush properties down
3 files changed, 11 insertions, 58 deletions
diff --git a/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs b/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs index 0c54145..32d8d6f 100644 --- a/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs +++ b/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs @@ -60,6 +60,13 @@ namespace Xamarin.PropertyEditing.Tests.MockControls canWrite: false); AddProperty<CommonBrush> (this.readOnlyBrushPropertyInfo); + this.colorPropertyInfo = new MockPropertyInfo<CommonColor> ( + name: "ColorNoBrush", + category: "Windows Only", + canWrite: true, + valueSources: ValueSources.Default | ValueSources.Local | ValueSources.Resource); + AddProperty<CommonColor> (this.colorPropertyInfo); + AddEvents ("Click", "Hover", "Focus"); } @@ -117,6 +124,7 @@ namespace Xamarin.PropertyEditing.Tests.MockControls private IPropertyInfo brushPropertyInfo; private IPropertyInfo materialDesignBrushPropertyInfo; private IPropertyInfo readOnlyBrushPropertyInfo; + private IPropertyInfo colorPropertyInfo; private bool brushSet = false; private bool materialDesignBrushSet = false; private bool readOnlyBrushSet = false; diff --git a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs index 7713ff8..28f69b7 100644 --- a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs +++ b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs @@ -41,9 +41,9 @@ namespace Xamarin.PropertyEditing.Windows.Standalone inspectedObject = mockedControl.MockedControl; if (mockedControl is MockedSampleControlButton mockedButton) { IObjectEditor editor = await this.panel.TargetPlatform.EditorProvider.GetObjectEditorAsync (inspectedObject); - await mockedButton.SetBrushInitialValueAsync (editor, new CommonSolidBrush (20, 120, 220, 240, "sRGB")); - await mockedButton.SetMaterialDesignBrushInitialValueAsync (editor, new CommonSolidBrush (0x65, 0x1F, 0xFF, 200)); - await mockedButton.SetReadOnlyBrushInitialValueAsync (editor, new CommonSolidBrush (240, 220, 15, 190)); + await mockedButton.MockedControl.SetBrushInitialValueAsync (editor, new CommonSolidBrush (20, 120, 220, 240, "sRGB")); + await mockedButton.MockedControl.SetMaterialDesignBrushInitialValueAsync (editor, new CommonSolidBrush (0x65, 0x1F, 0xFF, 200)); + await mockedButton.MockedControl.SetReadOnlyBrushInitialValueAsync (editor, new CommonSolidBrush (240, 220, 15, 190)); } } diff --git a/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs b/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs index 5514b53..1620969 100644 --- a/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs +++ b/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs @@ -9,61 +9,6 @@ namespace Xamarin.PropertyEditing.Windows.Standalone { public MockedSampleControlButton () : base (new MockSampleControl ()) { - // TODO: Move the declaration of this property to MockSampleControl once SolidBrush is supported on both platforms. - this.brushPropertyInfo = new MockBrushPropertyInfo ( - name: "SolidBrush", - category: "Windows Only", - canWrite: true, - colorSpaces: new[] { "RGB", "sRGB" }); - MockedControl.AddProperty<CommonBrush> (this.brushPropertyInfo); - - this.materialDesignBrushPropertyInfo = new MockBrushPropertyInfo ( - name: "MaterialDesignBrush", - category: "Windows Only", - canWrite: true); - MockedControl.AddProperty<CommonBrush> (this.materialDesignBrushPropertyInfo); - - this.readOnlyBrushPropertyInfo = new MockBrushPropertyInfo ( - name: "ReadOnlySolidBrush", - category: "Windows Only", - canWrite: false); - MockedControl.AddProperty<CommonBrush> (this.readOnlyBrushPropertyInfo); - - this.colorPropertyInfo = new MockPropertyInfo<CommonColor> ( - name: "ColorNoBrush", - category: "Windows Only", - canWrite: true, - valueSources: ValueSources.Default | ValueSources.Local | ValueSources.Resource); - MockedControl.AddProperty<CommonColor> (this.colorPropertyInfo); } - - public async Task SetBrushInitialValueAsync (IObjectEditor editor, CommonBrush brush) - { - if (this.brushSet) return; - await editor.SetValueAsync (this.brushPropertyInfo, new ValueInfo<CommonBrush> { Value = brush }); - this.brushSet = true; - } - - public async Task SetMaterialDesignBrushInitialValueAsync (IObjectEditor editor, CommonBrush brush) - { - if (this.materialDesignBrushSet) return; - await editor.SetValueAsync (this.materialDesignBrushPropertyInfo, new ValueInfo<CommonBrush> { Value = brush }); - this.materialDesignBrushSet = true; - } - - public async Task SetReadOnlyBrushInitialValueAsync (IObjectEditor editor, CommonBrush brush) - { - if (this.readOnlyBrushSet) return; - await editor.SetValueAsync (this.readOnlyBrushPropertyInfo, new ValueInfo<CommonBrush> { Value = brush }); - this.readOnlyBrushSet = true; - } - - private readonly IPropertyInfo brushPropertyInfo; - private readonly IPropertyInfo materialDesignBrushPropertyInfo; - private readonly IPropertyInfo readOnlyBrushPropertyInfo; - private readonly IPropertyInfo colorPropertyInfo; - private bool brushSet = false; - private bool materialDesignBrushSet = false; - private bool readOnlyBrushSet = false; } } |