Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
        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);

                Assert.AreEqual(Color.FromArgb(102, 0, 0, 0), (checkBox.ContentPresenter.Foreground as SolidColorBrush).Color);

                using (UseDarkTheme())
                {
                    await TestServices.WindowHelper.WaitForIdle();

                    Assert.AreEqual(Color.FromArgb(102, 255, 255, 255), (checkBox.ContentPresenter.Foreground as SolidColorBrush).Color);
                }
            }
        }