/// <summary> /// Returns top-left position /// </summary> /// <param name="relatedTouches"></param> /// <returns></returns> public IReturnType Calculate(ValidSetOfTouchPoints set) { if (set.Count > 0) { int len = set[0].Stroke.StylusPoints.Count; Position p = new Position(); p.X = set[0].Stroke.StylusPoints[len - 1].X; p.Y = set[0].Stroke.StylusPoints[len - 1].Y; return p; } else { return null; } }
public void Drag() { bool gestureDetected = false; Position storedP = new Position(); PositionChanged storedPositionChanged = new PositionChanged(); var threadHolder = new AutoResetEvent(false); GestureTestFramework.Validate("Drag", "Drag", // On successful gesture detection (sender, e) => { gestureDetected = true; if (e.Error == null) { var position = e.Values.Get<Position>(); var positionChanged = e.Values.Get<PositionChanged>(); Assert.IsNotNull(positionChanged, "Failed to retrieve return value: position-changed"); Assert.IsNotNull(position, "Failed to retrieve return value: position"); Assert.IsTrue(!position.Equals(storedP), "The position of the drag did not change, incorrect movement"); Assert.IsTrue(!positionChanged.Equals(storedPositionChanged), "The position changed did not change, incorrect movement"); storedP = position; storedPositionChanged = positionChanged; } else { Assert.Fail(e.Error.Message); } }, // On gesture playback completion () => { threadHolder.Set(); }); threadHolder.WaitOne(); Assert.IsTrue(gestureDetected, "Failed to detect the gesture!"); }