Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Input.Tests TouchPositionTriggerTests
Namespace: DeltaEngine.Input.Tests
Assembly: DeltaEngine.Input.Tests (in DeltaEngine.Input.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The TouchPositionTriggerTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
TouchPositionTriggerTests | Initializes a new instance of the TouchPositionTriggerTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
Create | ||
CreateFromAttributes | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
InvokeTouch | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
ShowRedCircleOnTouchWithMovement | ||
TouchPositionTriggerState |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void ShowRedCircleOnTouchWithMovement() { var ellipse = new Ellipse(new Rectangle(-0.1f, -0.1f, 0.1f, 0.1f), Color.Red); new Command(pos => ellipse.Center = pos).Add(new TouchPositionTrigger(State.Pressed)); }
[Test, CloseAfterFirstFrame] public void Create() { var trigger = new TouchPositionTrigger(State.Pressed); Assert.AreEqual(State.Pressed, trigger.State); }
[Test, CloseAfterFirstFrame] public void CreateFromAttributes() { var trigger = new TouchPositionTrigger(new Dictionary<string, string> { { "State", "Pressed" } });
[Test] public void InvokeTouch() { var touch = Resolve<Touch>() as MockTouch; if (touch == null) return; //ncrunch: no coverage var trigger = new TouchPositionTrigger(State.Pressed); bool wasInvoked = false; new Command(() => wasInvoked = true).Add(trigger); touch.SetTouchState(0, State.Pressed, Vector2D.Half); AdvanceTimeAndUpdateEntities(); Assert.IsTrue(wasInvoked); }
[Test] public void TouchPositionTriggerState() { var trigger = new TouchPositionTrigger(new Dictionary<string, string>()); Assert.AreEqual(State.Pressing, trigger.State); }
See Also