TouchRotateTriggerTests ClassDelta Engine Documentation
Inheritance Hierarchy

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

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

public class TouchRotateTriggerTests : TestWithMocksOrVisually

The TouchRotateTriggerTests type exposes the following members.

Constructors

  NameDescription
Public methodTouchRotateTriggerTests
Initializes a new instance of the TouchRotateTriggerTests class
Top
Methods

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

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void ShowRedSquare()
{
    new FontText(Font.Default, "Pinch screen to show red circle", Rectangle.One);
    var rect = new FilledRect(new Rectangle(0.1f, 0.1f, 0.1f, 0.1f), Color.Red);
    var trigger = new TouchRotateTrigger();
    var touch = Resolve<Touch>();
    new Command(() =>
    //ncrunch: no coverage start
    {
        rect.Center = touch.GetPosition(0);
        rect.RotationCenter = rect.Center;
        rect.Rotation = trigger.Angle;
    }).Add(trigger);
    //ncrunch: no coverage end
}
[Test, CloseAfterFirstFrame]
public void Angle()
{
    var touch = Resolve<Touch>() as MockTouch;
    if (touch == null)
        return; //ncrunch: no coverage 
    var trigger = new TouchRotateTrigger();
        touch.SetTouchState(0, State.Pressing, new Vector2D(0.5f, 0.1f));
    touch.SetTouchState(1, State.Pressed, new Vector2D(0.5f, 0.7f));
    touch.Update(new[] { trigger });
[Test, CloseAfterFirstFrame]
public void Creation()
{
    Assert.DoesNotThrow(() => new TouchRotateTrigger());
    Assert.Throws<TouchRotateTrigger.TouchRotateTriggerHasNoParameters>(
        () => new TouchRotateTrigger(new Dictionary<string, string> { { "Button", "Left" } }));
}
See Also