コード例 #1
0
        public async Task When_Visual_States_DoubleAnimation_Theme_Changed_Reapplied()
        {
            var page = new ThemeResource_In_Visual_States_Page();
            var app  = UnitTestsApp.App.EnsureApplication();

            app.HostView.Children.Add(page);

            await WaitForIdle();

            var control = page.VisualStatesTestControl;

            await GoTo("HighArduousness");

            Assert.AreEqual(29, control.InnerMyControl.Arduousness);

            await GoTo("NormalArduousness");

            await SwapSystemTheme();

            await GoTo("HighArduousness");

            Assert.AreEqual(47, control.InnerMyControl.Arduousness);

            async Task GoTo(string stateName)
            {
                var goToResult = VisualStateManager.GoToState(control, stateName, useTransitions: false);

                Assert.IsTrue(goToResult);
                await WaitForIdle();
            }
        }
コード例 #2
0
        public async Task When_ThemeResource_In_Visual_States_Setter_Theme_Changed()
        {
            var page = new ThemeResource_In_Visual_States_Page();
            var app  = UnitTestsApp.App.EnsureApplication();

            app.HostView.Children.Add(page);

            await WaitForIdle();

            var control = page.VisualStatesTestControl;

            if (page.Parent == null)
            {
                app.HostView.Children.Add(page);                 // On UWP the control may have been removed by another test after the async pause
            }

            GoTo("HighPilleability");
            await WaitForIdle();

            var lightPilleability = control.InnerMyControl.Pilleability;

            Assert.AreEqual(29, lightPilleability);
            await SwapSystemTheme();

            var darkPilleability = control.InnerMyControl.Pilleability;

            Assert.AreEqual(47, darkPilleability);

            void GoTo(string stateName)
            {
                var goToResult = VisualStateManager.GoToState(control, stateName, useTransitions: false);

                Assert.IsTrue(goToResult);
            }
        }
コード例 #3
0
        public async Task When_Visual_States_Keyframe_Theme_Changed_Reapplied()
        {
            var page = new ThemeResource_In_Visual_States_Page();
            var app  = UnitTestsApp.App.EnsureApplication();

            app.HostView.Children.Add(page);

            await WaitForIdle();

            var control = page.VisualStatesTestControl;

            await GoTo("ActiveMidground");

            Assert.AreEqual(Colors.DarkGreen, (control.InnerMyControl.Midground as SolidColorBrush).Color);

            await GoTo("NormalMidground");

            await SwapSystemTheme();

            await GoTo("ActiveMidground");

            Assert.AreEqual(Colors.LightGreen, (control.InnerMyControl.Midground as SolidColorBrush).Color);

            async Task GoTo(string stateName)
            {
                var goToResult = VisualStateManager.GoToState(control, stateName, useTransitions: false);

                Assert.IsTrue(goToResult);
                await WaitForIdle();
            }
        }