Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Input.Tests MousePositionTriggerTests
Namespace: DeltaEngine.Input.Tests
Assembly: DeltaEngine.Input.Tests (in DeltaEngine.Input.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The MousePositionTriggerTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MousePositionTriggerTests | Initializes a new instance of the MousePositionTriggerTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
CheckMouseAndTriggerPosition | ||
Create | ||
CreateFromAttributes | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
ShowRedCircleOnMouseClickWithMovement |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void ShowRedCircleOnMouseClickWithMovement() { var ellipse = new Ellipse(new Rectangle(-0.1f, -0.1f, 0.1f, 0.1f), Color.Red); new Command(pos => ellipse.Center = pos).Add(new MousePositionTrigger(MouseButton.Left, State.Pressed)); }
[Test, CloseAfterFirstFrame] public void Create() { var trigger = new MousePositionTrigger(MouseButton.Right, State.Pressed); Assert.AreEqual(MouseButton.Right, trigger.Button); Assert.AreEqual(State.Pressed, trigger.State); }
[Test, CloseAfterFirstFrame] public void CreateFromAttributes() { var trigger = new MousePositionTrigger(new Dictionary<string, string> { { "Button", "Right" }, { "State", "Pressed" } }); Assert.AreEqual(MouseButton.Right, trigger.Button); Assert.AreEqual(State.Pressed, trigger.State); Assert.DoesNotThrow(() => new MousePositionTrigger(new Dictionary<string, string>())); } [Test, CloseAfterFirstFrame] public void CheckMouseAndTriggerPosition() { var mouse = Resolve<Mouse>() as MockMouse; if (mouse == null) return; //ncrunch: no coverage var trigger = new MousePositionTrigger(MouseButton.Right, State.Pressed); trigger.Movement = Vector2D.Zero; mouse.SetNativePosition(trigger.Movement); Assert.AreEqual(mouse.Position, trigger.Movement); } }
[Test, CloseAfterFirstFrame] public void CheckMouseAndTriggerPosition() { var mouse = Resolve<Mouse>() as MockMouse; if (mouse == null) return; //ncrunch: no coverage var trigger = new MousePositionTrigger(MouseButton.Right, State.Pressed); trigger.Movement = Vector2D.Zero; mouse.SetNativePosition(trigger.Movement); Assert.AreEqual(mouse.Position, trigger.Movement); }
See Also