Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Input.Tests TouchDragDropTriggerTests
Namespace: DeltaEngine.Input.Tests
Assembly: DeltaEngine.Input.Tests (in DeltaEngine.Input.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The TouchDragDropTriggerTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
TouchDragDropTriggerTests | Initializes a new instance of the TouchDragDropTriggerTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
Create | ||
CreateFromAttributes | ||
CreateTouchDragDropTriggerFromString | ||
DragDropCloseToStartPointWillDoNothing | ||
DragDropTouchInsideStartArea | ||
DragDropTouchOutsideStartArea | ||
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, CloseAfterFirstFrame] public void DragDropTouchOutsideStartArea() { if (touch == null) return; //ncrunch: no coverage Vector2D startPoint = -Vector2D.One; new Command(position => { startPoint = position; }).Add( new TouchDragDropTrigger(Rectangle.HalfCentered)); SetTouchState(State.Pressing, Vector2D.Zero); SetTouchState(State.Pressed, Vector2D.One); SetTouchState(State.Releasing, Vector2D.One); SetTouchState(State.Released, Vector2D.One); Assert.AreEqual(-Vector2D.One, startPoint); }
[Test, CloseAfterFirstFrame] public void DragDropTouchInsideStartArea() { if (touch == null) return; //ncrunch: no coverage Vector2D startPoint = -Vector2D.One; new Command(position => { startPoint = position; }).Add( new TouchDragDropTrigger(Rectangle.HalfCentered)); SetTouchState(State.Pressing, Vector2D.Half); SetTouchState(State.Pressed, Vector2D.One); SetTouchState(State.Releasing, Vector2D.One); Assert.AreEqual(Vector2D.Half, startPoint); }
[Test, CloseAfterFirstFrame] public void Create() { var trigger = new TouchDragDropTrigger(Rectangle.One); Assert.AreEqual(Rectangle.One, trigger.StartArea); Assert.AreEqual(Vector2D.Unused, trigger.StartDragPosition); }
[Test, CloseAfterFirstFrame] public void CreateFromAttributes() { var trigger = new TouchDragDropTrigger(new Dictionary<string, string> { { "StartArea", new Rectangle(0.1f, 0.2f, 0.3f, 0.4f).ToString() } }); Assert.AreEqual(new Rectangle(0.1f, 0.2f, 0.3f, 0.4f), trigger.StartArea); Assert.AreEqual(Vector2D.Unused, trigger.StartDragPosition); }
[Test, CloseAfterFirstFrame] public void DragDropCloseToStartPointWillDoNothing() { if (touch == null) return; //ncrunch: no coverage Vector2D startPoint = -Vector2D.One; new Command(position => //ncrunch: no coverage start { startPoint = position; }).Add(new TouchDragDropTrigger(Rectangle.HalfCentered)); //ncrunch: no coverage end SetTouchState(State.Pressing, Vector2D.Half); SetTouchState(State.Pressed, Vector2D.Half); SetTouchState(State.Releasing, Vector2D.Half); Assert.AreEqual(-Vector2D.One, startPoint); } [Test, CloseAfterFirstFrame] public void CreateTouchDragDropTriggerFromString() { var startArea = Rectangle.One; var trigger = new TouchDragDropTrigger(new Dictionary<string, string> { { "StartArea", startArea.ToString() } }); Assert.AreEqual(startArea, trigger.StartArea); } }
[Test, CloseAfterFirstFrame] public void CreateTouchDragDropTriggerFromString() { var startArea = Rectangle.One; var trigger = new TouchDragDropTrigger(new Dictionary<string, string> { { "StartArea", startArea.ToString() } }); Assert.AreEqual(startArea, trigger.StartArea); }
See Also