Ejemplo n.º 1
0
        public static void Flick(UIObject obj, int distance, Direction direction)
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5))
            {
                Log.Error("Touch input is not available on OS versions less than RS5, and there is no mouse fallback for flick. This test should be disabled pre-RS5.");
                return;
            }

            Log.Comment("Flick on {0} over {1} pixels in the {2} direction.", obj.GetIdentifier(), distance, direction);
            using (var waiter = GetWaiterForInputEvent(obj, InputEvent.Flick))
            {
                obj.Flick(distance, DirectionToAngle(direction));
            }
            Wait.ForIdle();
        }
Ejemplo n.º 2
0
        internal static ResponseStatus SendTouchFlick(
            UIObject mainElement,
            int xSpeed,
            int ySpeed)
        {
            var responseStatus = ResponseStatus.UnknownError;

            try {
                mainElement.SetFocus();
                mainElement.Flick(startPoint: GetRelativeClickablePoint(element: mainElement), distance: (int)Math.Max(val1: Math.Sqrt(d: xSpeed * xSpeed + ySpeed * ySpeed), val2: SinglePointGesture.MinimumPanFlickDistance), direction: (float)(Math.Atan2(y: ySpeed, x: xSpeed) * (180.0 / Math.PI)));
                responseStatus = ResponseStatus.Success;
            } catch {
            }

            return(responseStatus);
        }
Ejemplo n.º 3
0
        internal static ResponseStatus SendTouchFlick(
            int flickXOffset,
            int flickYOffset,
            UIObject flickElement)
        {
            var responseStatus = ResponseStatus.UnknownError;

            try {
                var relativeClickablePoint = GetRelativeClickablePoint(element: flickElement);
                var endPoint = new PointI(x: relativeClickablePoint.X + flickXOffset, y: relativeClickablePoint.Y + flickYOffset);
                flickElement.Flick(startPoint: relativeClickablePoint, endPoint: endPoint);
                responseStatus = ResponseStatus.Success;
            } catch {
            }

            return(responseStatus);
        }