-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TabControl foreground color (#2639)
* WIP Work on fixing tab control styles * Fixes 2602 Addresses issues with tab control foreground not being set.
- Loading branch information
Showing
4 changed files
with
74 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
MaterialDesignThemes.UITests/WPF/TabControls/TabControlTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System.ComponentModel; | ||
using System.Threading.Tasks; | ||
using System.Windows.Controls; | ||
using System.Windows.Media; | ||
using XamlTest; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace MaterialDesignThemes.UITests.WPF.TabControls; | ||
|
||
public class TabControlTests : TestBase | ||
{ | ||
public TabControlTests(ITestOutputHelper output) | ||
: base(output) | ||
{ } | ||
|
||
[Fact] | ||
[Description("Issue 2602")] | ||
public async Task OnLoad_ThemeBrushesSet() | ||
{ | ||
await using var recorder = new TestRecorder(App); | ||
|
||
//Arrange | ||
IVisualElement<TabControl> tabControl = await LoadXaml<TabControl>(@" | ||
<TabControl | ||
materialDesign:ColorZoneAssist.Mode=""PrimaryMid"" | ||
Style=""{StaticResource MaterialDesignFilledTabControl}""> | ||
<TabItem Header=""TAB 1""> | ||
<TextBlock Margin=""8"" Text=""PrimaryMid Tab 1"" /> | ||
</TabItem> | ||
<TabItem Header=""TAB 2""> | ||
<TextBlock Margin=""8"" Text=""PrimaryMid Tab 2"" /> | ||
</TabItem> | ||
</TabControl> "); | ||
|
||
IVisualElement<TextBlock> textBlock = await tabControl.GetElement<TextBlock>(@"/TabItem[0]/TextBlock[0]"); | ||
|
||
//Act | ||
Color? foreground = await textBlock.GetForegroundColor(); | ||
Color? background = await textBlock.GetEffectiveBackground(); | ||
|
||
//Assert | ||
Assert.NotNull(foreground); | ||
Assert.NotNull(background); | ||
|
||
MaterialDesignSpec.AssertContrastRatio(foreground.Value, background.Value, MaterialDesignSpec.MinimumContrastSmallText); | ||
|
||
recorder.Success(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters