MouseDragTriggerTests DragMouseVertically Method Delta Engine Documentation

Namespace: DeltaEngine.Input.Tests
Assembly: DeltaEngine.Input.Tests (in DeltaEngine.Input.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void DragMouseVertically()
Examples

[Test]
public void DragMouseVertically()
{
    if (!IsMockResolver)
        return; //ncrunch: no coverage 
    var mouse = (MockMouse)Resolve<Mouse>();
    var trigger = new MouseDragTrigger(MouseButton.Left, DragDirection.Vertical);
    new Command(() => {}).Add(trigger);
    mouse.SetNativePosition(new Vector2D(0.3f, ScreenSpace.Current.Top + 0.1f));
    mouse.SetButtonState(MouseButton.Left, State.Pressing);
    AdvanceTimeAndUpdateEntities();
    mouse.SetNativePosition(new Vector2D(0.3f, ScreenSpace.Current.Bottom - 0.1f));
    AdvanceTimeAndUpdateEntities();
    Assert.AreEqual(mouse.Position, trigger.Movement);
    mouse.SetButtonState(MouseButton.Left, State.Releasing);
    AdvanceTimeAndUpdateEntities();
    Assert.IsTrue(trigger.DoneDragging);
}
See Also