TouchDragTriggerTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.Input.Tests TouchDragTriggerTests

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

public class TouchDragTriggerTests : TestWithMocksOrVisually

The TouchDragTriggerTests type exposes the following members.

Constructors

  NameDescription
Public methodTouchDragTriggerTests
Initializes a new instance of the TouchDragTriggerTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCreate
Public methodDragTouch
Public methodDragTouchHorizontal
Public methodDragTouchToCreateRectangles
Public methodDragTouchVertical
Public methodIfDistanceIsToSmallNothingWillHappen
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetUp
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void DragTouchToCreateRectangles()
{
    MouseDragTriggerTests.DragToCreateRectangles(new TouchDragTrigger());
}
[Test, CloseAfterFirstFrame]
public void DragTouch()
{
    if (touch == null)
        return; //ncrunch: no coverage 
    bool isFinished = false;
    new Command((start, end, done) => isFinished = done).Add(new TouchDragTrigger());
    SetTouchState(State.Pressing, Vector2D.Zero);
    SetTouchState(State.Pressed, Vector2D.One);
    SetTouchState(State.Releasing, Vector2D.One);
    Assert.IsTrue(isFinished);
}
[Test, CloseAfterFirstFrame]
public void IfDistanceIsToSmallNothingWillHappen()
{
    if (touch == null)
        return; //ncrunch: no coverage 
    bool isFinished = false;
    new Command((start, end, done) => isFinished = done).Add(new TouchDragTrigger());
    SetTouchState(State.Pressing, Vector2D.Zero);
    SetTouchState(State.Pressed, Vector2D.Zero);
    SetTouchState(State.Releasing, Vector2D.Zero);
    Assert.False(isFinished);
}
[Test, CloseAfterFirstFrame]
public void DragTouchHorizontal()
{
    if (touch == null)
        return; //ncrunch: no coverage 
    bool isFinished = false;
    new Command((start, end, done) => isFinished = done).Add(
        new TouchDragTrigger(DragDirection.Horizontal));
    SetTouchState(State.Pressing, Vector2D.Zero);
    SetTouchState(State.Pressed, new Vector2D(1,0));
    SetTouchState(State.Releasing, new Vector2D(1,0));
    Assert.IsTrue(isFinished);
}
[Test, CloseAfterFirstFrame]
public void DragTouchVertical()
{
    if (touch == null)
        return; //ncrunch: no coverage 
    bool isFinished = false;
    new Command((start, end, done) => isFinished = done).Add(
        new TouchDragTrigger(DragDirection.Vertical));
    SetTouchState(State.Pressing, Vector2D.Zero);
    SetTouchState(State.Pressed, new Vector2D(0, 1));
    SetTouchState(State.Releasing, new Vector2D(0, 1));
    Assert.IsTrue(isFinished);
}
[Test, CloseAfterFirstFrame]
public void Create()
{
    var trigger = new TouchDragTrigger();
    Assert.AreEqual(DragDirection.Free, trigger.Direction);
    trigger =
        new TouchDragTrigger(new Dictionary<string, string> { { "Direction", "Horizontal" } });
See Also