|
1 | 1 | using System.Windows.Media;
|
2 | 2 |
|
3 |
| -namespace MaterialDesignThemes.UITests.WPF.Buttons |
| 3 | +namespace MaterialDesignThemes.UITests.WPF.Buttons; |
| 4 | + |
| 5 | +public class OutlineButtonTests : TestBase |
4 | 6 | {
|
5 |
| - public class OutlineButtonTests : TestBase |
6 |
| - { |
7 |
| - public OutlineButtonTests(ITestOutputHelper output) |
8 |
| - : base(output) |
9 |
| - { } |
| 7 | + public OutlineButtonTests(ITestOutputHelper output) |
| 8 | + : base(output) |
| 9 | + { } |
10 | 10 |
|
11 |
| - [Fact] |
12 |
| - public async Task OutlinedButton_UsesThemeColorForBorder() |
13 |
| - { |
14 |
| - await using var recorder = new TestRecorder(App); |
| 11 | + [Fact] |
| 12 | + public async Task OutlinedButton_UsesThemeColorForBorder() |
| 13 | + { |
| 14 | + await using var recorder = new TestRecorder(App); |
15 | 15 |
|
16 |
| - //Arrange |
17 |
| - IVisualElement<Button> button = await LoadXaml<Button>( |
18 |
| - @"<Button Content=""Button"" Style=""{StaticResource MaterialDesignOutlinedButton}""/>"); |
19 |
| - Color midColor = await GetThemeColor("PrimaryHueMidBrush"); |
20 |
| - IVisualElement<Border> internalBorder = await button.GetElement<Border>("border"); |
| 16 | + //Arrange |
| 17 | + IVisualElement<Button> button = await LoadXaml<Button>( |
| 18 | + @"<Button Content=""Button"" Style=""{StaticResource MaterialDesignOutlinedButton}""/>"); |
| 19 | + Color midColor = await GetThemeColor("PrimaryHueMidBrush"); |
| 20 | + IVisualElement<Border> internalBorder = await button.GetElement<Border>("border"); |
21 | 21 |
|
22 |
| - //Act |
23 |
| - Color? borderColor = await button.GetBorderBrushColor(); |
24 |
| - Color? internalBorderColor = await internalBorder.GetBorderBrushColor(); |
| 22 | + //Act |
| 23 | + Color? borderColor = await button.GetBorderBrushColor(); |
| 24 | + Color? internalBorderColor = await internalBorder.GetBorderBrushColor(); |
25 | 25 |
|
26 |
| - //Assert |
27 |
| - Assert.Equal(midColor, borderColor); |
28 |
| - Assert.Equal(midColor, internalBorderColor); |
| 26 | + //Assert |
| 27 | + Assert.Equal(midColor, borderColor); |
| 28 | + Assert.Equal(midColor, internalBorderColor); |
29 | 29 |
|
30 |
| - recorder.Success(); |
31 |
| - } |
| 30 | + recorder.Success(); |
| 31 | + } |
32 | 32 |
|
33 |
| - [Fact] |
34 |
| - public async Task OutlinedButton_BorderCanBeOverridden() |
35 |
| - { |
36 |
| - await using var recorder = new TestRecorder(App); |
| 33 | + [Fact] |
| 34 | + public async Task OutlinedButton_BorderCanBeOverridden() |
| 35 | + { |
| 36 | + await using var recorder = new TestRecorder(App); |
37 | 37 |
|
38 |
| - //Arrange |
39 |
| - var button = await LoadXaml<Button>( |
40 |
| - @"<Button Content=""Button"" |
| 38 | + //Arrange |
| 39 | + var button = await LoadXaml<Button>( |
| 40 | + @"<Button Content=""Button"" |
41 | 41 | Style=""{StaticResource MaterialDesignOutlinedButton}""
|
42 | 42 | BorderThickness=""5""
|
43 | 43 | BorderBrush=""Red""
|
44 | 44 | />");
|
45 |
| - Color midColor = await GetThemeColor("PrimaryHueMidBrush"); |
46 |
| - IVisualElement<Border> internalBorder = await button.GetElement<Border>("border"); |
| 45 | + Color midColor = await GetThemeColor("PrimaryHueMidBrush"); |
| 46 | + IVisualElement<Border> internalBorder = await button.GetElement<Border>("border"); |
47 | 47 |
|
48 |
| - //Act |
49 |
| - Thickness borderThickness = await internalBorder.GetBorderThickness(); |
50 |
| - Color? borderBrush = await internalBorder.GetBorderBrushColor(); |
| 48 | + //Act |
| 49 | + Thickness borderThickness = await internalBorder.GetBorderThickness(); |
| 50 | + Color? borderBrush = await internalBorder.GetBorderBrushColor(); |
51 | 51 |
|
52 |
| - //Assert |
53 |
| - Assert.Equal(new Thickness(5), borderThickness); |
54 |
| - Assert.Equal(Colors.Red, borderBrush); |
| 52 | + //Assert |
| 53 | + Assert.Equal(new Thickness(5), borderThickness); |
| 54 | + Assert.Equal(Colors.Red, borderBrush); |
| 55 | + |
| 56 | + recorder.Success(); |
| 57 | + } |
| 58 | + |
| 59 | + [Fact] |
| 60 | + public async Task OutlinedButton_OnMouseOver_UsesThemeBrush() |
| 61 | + { |
| 62 | + await using var recorder = new TestRecorder(App); |
55 | 63 |
|
56 |
| - recorder.Success(); |
57 |
| - } |
| 64 | + //Arrange |
| 65 | + IVisualElement<Button> button = await LoadXaml<Button>( |
| 66 | + @"<Button Content=""Button"" Style=""{StaticResource MaterialDesignOutlinedButton}""/>"); |
| 67 | + Color midColor = await GetThemeColor("PrimaryHueMidBrush"); |
| 68 | + IVisualElement<Border> internalBorder = await button.GetElement<Border>("border"); |
58 | 69 |
|
59 |
| - [Fact] |
60 |
| - public async Task OutlinedButton_OnMouseOver_UsesThemeBrush() |
| 70 | + //Act |
| 71 | + await button.MoveCursorTo(Position.Center); |
| 72 | + await Wait.For(async () => |
61 | 73 | {
|
62 |
| - await using var recorder = new TestRecorder(App); |
63 |
| - |
64 |
| - //Arrange |
65 |
| - IVisualElement<Button> button = await LoadXaml<Button>( |
66 |
| - @"<Button Content=""Button"" Style=""{StaticResource MaterialDesignOutlinedButton}""/>"); |
67 |
| - Color midColor = await GetThemeColor("PrimaryHueMidBrush"); |
68 |
| - IVisualElement<Border> internalBorder = await button.GetElement<Border>("border"); |
69 |
| - |
70 |
| - //Act |
71 |
| - await button.MoveCursorTo(Position.Center); |
72 |
| - await Wait.For(async () => |
73 |
| - { |
74 |
| - SolidColorBrush? internalBorderBackground = (await internalBorder.GetBackground()) as SolidColorBrush; |
75 |
| - |
76 |
| - //Assert |
77 |
| - Assert.Equal(midColor, internalBorderBackground?.Color); |
78 |
| - }); |
79 |
| - |
80 |
| - recorder.Success(); |
81 |
| - } |
| 74 | + SolidColorBrush? internalBorderBackground = (await internalBorder.GetBackground()) as SolidColorBrush; |
| 75 | + |
| 76 | + //Assert |
| 77 | + Assert.Equal(midColor, internalBorderBackground?.Color); |
| 78 | + }); |
| 79 | + |
| 80 | + recorder.Success(); |
82 | 81 | }
|
83 | 82 | }
|
0 commit comments