Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Input.Tests TouchDoubleTapTriggerTests
Namespace: DeltaEngine.Input.Tests
Assembly: DeltaEngine.Input.Tests (in DeltaEngine.Input.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The TouchDoubleTapTriggerTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
TouchDoubleTapTriggerTests | Initializes a new instance of the TouchDoubleTapTriggerTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
Create | ||
CreateFromAttributes | ||
CreateWithAttributes | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
InvokeDoubleTap | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
ShowRedCircleOnTouch |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void ShowRedCircleOnTouch() { 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(() => ellipse.Center = Vector2D.Half).Add(new TouchDoubleTapTrigger()); new Command(() => ellipse.Center = Vector2D.Zero).Add(new TouchPressTrigger(State.Released)); }
[Test, CloseAfterFirstFrame] public void Create() { Assert.DoesNotThrow(() => new TouchDoubleTapTrigger()); }
[Test, CloseAfterFirstFrame] public void CreateFromAttributes() { Assert.DoesNotThrow(() => new TouchDoubleTapTrigger(new Dictionary<string, string>())); Assert.Throws<TouchDoubleTapTrigger.TouchDoubleTapTriggerHasNoParameters>( () => new TouchDoubleTapTrigger(new Dictionary<string, string> { { "Button", "Right" } })); }
[Test] public void InvokeDoubleTap() { var touch = Resolve<Touch>() as MockTouch; if (touch == null) return; //ncrunch: no coverage var trigger = new TouchDoubleTapTrigger(); bool wasInvoked = false; new Command(() => wasInvoked = true).Add(trigger); touch.SetTouchState(0, State.Pressing, Vector2D.Half); AdvanceTimeAndUpdateEntities(); touch.SetTouchState(0, State.Releasing, Vector2D.Half); AdvanceTimeAndUpdateEntities(); touch.SetTouchState(0, State.Pressing, Vector2D.Half); AdvanceTimeAndUpdateEntities(); touch.SetTouchState(0, State.Releasing, Vector2D.Half); AdvanceTimeAndUpdateEntities(); Assert.IsTrue(wasInvoked); }
[Test, CloseAfterFirstFrame] public void CreateWithAttributes() { Assert.DoesNotThrow(() => new TouchDoubleTapTrigger(new Dictionary<string, string>())); Assert.Throws<TouchDoubleTapTrigger.TouchDoubleTapTriggerHasNoParameters>( () => new TouchDoubleTapTrigger(new Dictionary<string, string> { { "a", "b" } })); }
See Also