public async Task When_Theme_Changed_Animated_Value() { using (UseFluentStyles()) { var checkBox = new MyCheckBox() { Content = "CheckBox", IsEnabled = false }; TestServices.WindowHelper.WindowContent = checkBox; await TestServices.WindowHelper.WaitForIdle(); Assert.IsNotNull(checkBox.ContentPresenter); var lightThemeForeground = TestsColorHelper.ToColor("#5C000000"); var darkThemeForeground = TestsColorHelper.ToColor("#5DFFFFFF"); Assert.AreEqual(lightThemeForeground, (checkBox.ContentPresenter.Foreground as SolidColorBrush).Color); using (UseDarkTheme()) { await TestServices.WindowHelper.WaitForIdle(); Assert.AreEqual(darkThemeForeground, (checkBox.ContentPresenter.Foreground as SolidColorBrush).Color); } } }
public async Task When_Fluent_And_Theme_Changed() { using (StyleHelper.UseFluentStyles()) { var textBox = new TextBox { PlaceholderText = "Enter..." }; WindowHelper.WindowContent = textBox; await WindowHelper.WaitForLoaded(textBox); var placeholderTextContentPresenter = textBox.FindFirstChild <TextBlock>(tb => tb.Name == "PlaceholderTextContentPresenter"); Assert.IsNotNull(placeholderTextContentPresenter); var lightThemeForeground = TestsColorHelper.ToColor("#99000000"); var darkThemeForeground = TestsColorHelper.ToColor("#99FFFFFF"); Assert.AreEqual(lightThemeForeground, (placeholderTextContentPresenter.Foreground as SolidColorBrush)?.Color); using (ThemeHelper.UseDarkTheme()) { Assert.AreEqual(darkThemeForeground, (placeholderTextContentPresenter.Foreground as SolidColorBrush)?.Color); } Assert.AreEqual(lightThemeForeground, (placeholderTextContentPresenter.Foreground as SolidColorBrush)?.Color); } }
public async Task When_Fluent_And_Theme_Changed() { using (StyleHelper.UseFluentStyles()) { var comboBox = new ComboBox { ItemsSource = new[] { 1, 2, 3 }, PlaceholderText = "Select..." }; WindowHelper.WindowContent = comboBox; await WindowHelper.WaitForLoaded(comboBox); var placeholderTextBlock = comboBox.FindFirstChild <TextBlock>(tb => tb.Name == "PlaceholderTextBlock"); Assert.IsNotNull(placeholderTextBlock); var lightThemeForeground = TestsColorHelper.ToColor("#9E000000"); var darkThemeForeground = TestsColorHelper.ToColor("#C5FFFFFF"); Assert.AreEqual(lightThemeForeground, (placeholderTextBlock.Foreground as SolidColorBrush)?.Color); using (ThemeHelper.UseDarkTheme()) { Assert.AreEqual(darkThemeForeground, (placeholderTextBlock.Foreground as SolidColorBrush)?.Color); } Assert.AreEqual(lightThemeForeground, (placeholderTextBlock.Foreground as SolidColorBrush)?.Color); } }