TouchTests ClassDelta Engine Documentation
Inheritance Hierarchy

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

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

public class TouchTests : TestWithMocksOrVisually

The TouchTests type exposes the following members.

Constructors

  NameDescription
Public methodTouchTests
Initializes a new instance of the TouchTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
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 methodShowRedCircleOnTouchAtTouchPosition
Public methodTestPositionAndState
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void ShowRedCircleOnTouchAtTouchPosition()
{
    new FontText(Font.Default, "Touch screen to show red circle", Rectangle.One);
    var ellipse = new Ellipse(new Rectangle(0.1f, 0.1f, 0.1f, 0.1f), Color.Red);
    new Command(() => TranslateOnTouch(ellipse)).Add(new TouchPressTrigger(State.Pressed));
}
[Test, CloseAfterFirstFrame]
public void TestPositionAndState()
{
    bool isTouched = false;
    new Command(() => isTouched = true).Add(new TouchPressTrigger(State.Pressed));
    Assert.IsFalse(isTouched);
    var mockTouch = Resolve<Touch>() as MockTouch;
    if (mockTouch == null)
        return; //ncrunch: no coverage
    Assert.NotNull(mockTouch);
    Assert.AreEqual(State.Released, mockTouch.GetState(0));
    Assert.True(mockTouch.IsAvailable);
}
See Also