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

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