private void PerformSingleDrag(MouseDragElementBehavior behavior, Point from, Point to) { using (TestDragToken token = new TestDragToken(behavior, from)) { token.PerformDrag(to); } }
public void IsConstrainedTrue_DragDownSide_MovesAlongUnboundedAxis() { Rectangle rect = CreateRectangleInGrid(); MouseDragElementBehavior behavior = CreateAndAttachMouseDragElementBehavior(rect); behavior.ConstrainToParentBounds = true; using (TestDragToken token = new TestDragToken(behavior, new Point(5, 5))) { token.PerformDrag(new Point(-5, 25)); this.VerifyOffset(rect.RenderTransform, 0, 20); token.PerformDrag(new Point(-5, 120)); this.VerifyOffset(rect.RenderTransform, 0, 90); } }
public void IsConstrainedTrue_DragOutAndBackIn_DoesNotMoveUntilBackAtStartPoint() { Rectangle rect = CreateRectangleInGrid(); MouseDragElementBehavior behavior = CreateAndAttachMouseDragElementBehavior(rect); behavior.ConstrainToParentBounds = true; using (TestDragToken token = new TestDragToken(behavior, new Point(5, 5))) { token.PerformDrag(new Point(-50, 5)); this.VerifyOffset(rect.RenderTransform, 0, 0); token.PerformDrag(new Point(-25, 5)); this.VerifyOffset(rect.RenderTransform, 0, 0); token.PerformDrag(new Point(-1, 5)); this.VerifyOffset(rect.RenderTransform, 0, 0); token.PerformDrag(new Point(4, 5)); this.VerifyOffset(rect.RenderTransform, 0, 0); token.PerformDrag(new Point(6, 5)); this.VerifyOffset(rect.RenderTransform, 1, 0); } }