コード例 #1
0
        public void TapElementsInSequence()
        {
            using var app = Application.AttachOrLaunch(ExeFileName, this.windowName);
            var window    = app.MainWindow;
            var button1   = window.FindButton("Button 1");
            var button2   = window.FindButton("Button 2");
            var textBlock = window.FindTextBlock("TextBlock 1");
            var label     = window.FindLabel("Label 1");

            Touch.Tap(button1.Bounds.Center());
            AssertToolTip.IsOpen(true, button1);
            AssertToolTip.IsOpen(false, button2);
            AssertToolTip.IsOpen(false, textBlock);
            AssertToolTip.IsOpen(false, label);

            Touch.Tap(button2.Bounds.Center());
            AssertToolTip.IsOpen(false, button1);
            AssertToolTip.IsOpen(true, button2);
            AssertToolTip.IsOpen(false, textBlock);
            AssertToolTip.IsOpen(false, label);

            Touch.Tap(textBlock.Bounds.Center());
            AssertToolTip.IsOpen(false, button1);
            AssertToolTip.IsOpen(false, button2);
            AssertToolTip.IsOpen(true, textBlock);
            AssertToolTip.IsOpen(false, label);

            Touch.Tap(label.Bounds.Center());
            AssertToolTip.IsOpen(false, button1);
            AssertToolTip.IsOpen(false, button2);
            AssertToolTip.IsOpen(false, textBlock);
            AssertToolTip.IsOpen(true, label);
        }
コード例 #2
0
        public void TapThenTapLoseFocus(string name)
        {
            using var app = Application.AttachOrLaunch(ExeFileName, this.windowName);
            var window  = app.MainWindow;
            var element = window.FindFirstChild(Conditions.ByName(name), x => new UiElement(x));

            Touch.Tap(element.Bounds.Center());
            AssertToolTip.IsOpen(true, element);

            Touch.Tap(window.FindButton("Lose focus").Bounds.Center());
            AssertToolTip.IsOpen(false, element);
        }
コード例 #3
0
        public void MouseOver(string name)
        {
            using var app = Application.AttachOrLaunch(ExeFileName, this.windowName);
            var window  = app.MainWindow;
            var element = window.FindFirstChild(Conditions.ByName(name), x => new UiElement(x));

            Mouse.Position = element.Bounds.Center();
            AssertToolTip.IsOpen(true, element);

            window.FindButton("Lose focus").Click(moveMouse: true);
            AssertToolTip.IsOpen(false, element);
        }
コード例 #4
0
        public void TapTwiceLoop(string name)
        {
            using var app = Application.AttachOrLaunch(ExeFileName, this.windowName);
            var window  = app.MainWindow;
            var element = window.FindFirstChild(Conditions.ByName(name), x => new UiElement(x));

            for (var i = 0; i < 4; i++)
            {
                Touch.Tap(element.Bounds.Center());
                AssertToolTip.IsOpen(true, element);

                Touch.Tap(element.Bounds.Center());
                AssertToolTip.IsOpen(false, element);
            }
        }