Inheritance Hierarchy
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
The TouchDragTriggerTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
TouchDragTriggerTests | Initializes a new instance of the TouchDragTriggerTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
Create | ||
DragTouch | ||
DragTouchHorizontal | ||
DragTouchToCreateRectangles | ||
DragTouchVertical | ||
IfDistanceIsToSmallNothingWillHappen | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
SetUp |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
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