MouseDragTriggerTests DragMouseHorizontally 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 DragMouseHorizontally()
Examples

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