コード例 #1
0
 private static void CheckMouseEvent(TestWindow window, IInputElement button, RoutedEvent routedEvent, bool shouldBeHandled)
 {
     var args = new MouseButtonEventArgs(Mouse.PrimaryDevice, (int) DateTime.Now.Ticks, MouseButton.Left);
     args.RoutedEvent = routedEvent;
     button.RaiseEvent(args);
     window.ProcessEvents();
     Assert.AreEqual(shouldBeHandled, args.Handled);
 }
コード例 #2
0
ファイル: UITestBase.cs プロジェクト: p69/magellan-framework
        public void Setup()
        {
            Window = new TestWindow() { Width = 300, Height = 300 };
            Window.Show();
            Window.Activate();
            Window.ProcessEvents();

            AfterSetup();
        }
コード例 #3
0
        public void Setup()
        {
            Window = new TestWindow()
            {
                Width = 300, Height = 300
            };
            Window.Show();
            Window.Activate();
            Window.ProcessEvents();

            AfterSetup();
        }
コード例 #4
0
        public void CanCreateNavigatorForASourceElementWhenInATree()
        {
            var frame = new Frame();
            var button = new Button();
            frame.Content = button;

            var window = new TestWindow(frame);
            window.Show();
            window.ProcessEvents();

            var resolver = new Mock<IRouteResolver>();
            var factory = new NavigatorFactory(resolver.Object);
            var navigator = factory.GetOwningNavigator(button);
            navigator.ResetHistory();

            window.Close();
        }
コード例 #5
0
        public void ToggleSuppressInputTest()
        {
            var button = new Button();
            var window = new TestWindow(button);
            window.Show();
            
            CheckMouseEvent(window, button, UIElement.PreviewMouseUpEvent, false);
            CheckMouseEvent(window, button, UIElement.PreviewMouseDownEvent, false);
            
            window.ToggleSuppressInput(true);

            CheckMouseEvent(window, button, UIElement.PreviewMouseUpEvent, true);
            CheckMouseEvent(window, button, UIElement.PreviewMouseDownEvent, true);
            
            window.ToggleSuppressInput(false);

            CheckMouseEvent(window, button, UIElement.PreviewMouseUpEvent, false);
            CheckMouseEvent(window, button, UIElement.PreviewMouseDownEvent, false);
            
            window.Close();
        }