Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Input.Tests MouseZoomTriggerTests
Namespace: DeltaEngine.Input.Tests
Assembly: DeltaEngine.Input.Tests (in DeltaEngine.Input.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The MouseZoomTriggerTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MouseZoomTriggerTests | Initializes a new instance of the MouseZoomTriggerTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
EmptyMouseZoomTriggerShouldDoNothing | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
MouseWheelZoomDown | ||
MouseWheelZoomUp | ||
MouseWheelZoomUsingCommandName | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
ResizeEllipseByZoomTrigger | ||
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
UsingParametersForMouseZoomTriggerShouldThrowException |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void ResizeEllipseByZoomTrigger() { var ellipse = new Ellipse(Vector2D.Half, 0.1f, 0.1f, Color.Red); new Command(zoomAmount => { ellipse.Radius += zoomAmount * 0.02f; }).Add( new MouseZoomTrigger()); }
[Test, CloseAfterFirstFrame] public void EmptyMouseZoomTriggerShouldDoNothing() { Assert.DoesNotThrow(() => new MouseZoomTrigger(new Dictionary<string, string>())); }
[Test, CloseAfterFirstFrame] public void UsingParametersForMouseZoomTriggerShouldThrowException() { Assert.Throws<MouseZoomTrigger.MouseZoomTriggerHasNoParameters>( () => new MouseZoomTrigger(new Dictionary<string, string> { { "Bla", "DeltaEngine" } })); }
[Test, CloseAfterFirstFrame] public void MouseWheelZoomUp() { var mouse = Resolve<Mouse>() as MockMouse; if (mouse == null) return; //ncrunch: no coverage bool isZoomed = false; new Command((float zoomAmount) => isZoomed = true).Add(new MouseZoomTrigger()); mouse.ScrollUp(); AdvanceTimeAndUpdateEntities(); Assert.IsTrue(isZoomed); }
[Test, CloseAfterFirstFrame] public void MouseWheelZoomDown() { var mouse = Resolve<Mouse>() as MockMouse; if (mouse == null) return; //ncrunch: no coverage bool isZoomed = false; new Command((float zoomAmount) => isZoomed = true).Add(new MouseZoomTrigger()); mouse.ScrollDown(); AdvanceTimeAndUpdateEntities(); Assert.IsTrue(isZoomed); }
[Test, CloseAfterFirstFrame] public void MouseWheelZoomUsingCommandName() { var mouse = Resolve<Mouse>() as MockMouse; if (mouse == null) return; //ncrunch: no coverage bool isZoomed = false; new Command(Command.Zoom, (float zoomAmount) => isZoomed = true); mouse.ScrollUp(); AdvanceTimeAndUpdateEntities(); Assert.IsTrue(isZoomed); }
See Also