Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Rendering3D.Tests.Cameras PathCameraTests
Namespace: DeltaEngine.Rendering3D.Tests.Cameras
Assembly: DeltaEngine.Rendering3D.Tests (in DeltaEngine.Rendering3D.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The PathCameraTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
PathCameraTests | Initializes a new instance of the PathCameraTests class |
Methods
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test, CloseAfterFirstFrame] public void ThrowExceptionIfNoTrackPositionIsSpecified() { Assert.Throws<PathCamera.NoTrackSpecified>(() => CreatePathCamera(null)); Assert.Throws<PathCamera.NoTrackSpecified>(() => CreatePathCamera(new Matrix[0])); Assert.Throws<PathCamera.NoTrackSpecified>(() => CreatePathCamera(new[] { Matrix.Identity })); }
[Test] public void CameraCanBeMovedOnLinearTrackWithScrollWheel() { new Grid3D(new Size(GridDimension)); PathCamera camera = CreatePathCamera(GetLinearViewMatrixTrack(GridDimension)); Command.Register(Command.Zoom, new MouseZoomTrigger()); new Command(Command.Zoom, zoomAmount => camera.CurrentFrame += (int)(zoomAmount * 10)); }
[Test] public void AutomatedCameraMoveOnLinearTrackOnMiddleClick() { var linearTrack = GetLinearViewMatrixTrack(GridDimension); MoveCameraAutomatedOnTrack(linearTrack); }
[Test] public void AutomatedCameraMoveOnCircularTrackOnMiddleClick() { var circlePoints = GetCirclePoints(10f, 5f); DrawPoints(circlePoints); var circularCameraTrack = VectorsToMatricesWithLookAtCenter(circlePoints); MoveCameraAutomatedOnTrack(circularCameraTrack.ToArray()); }
[Test, CloseAfterFirstFrame] public void CurrentFrameDoesNotChangeWhenNotMoving() { PathCamera camera = CreatePathCamera(GetLinearViewMatrixTrack(GridDimension)); AdvanceTimeAndUpdateEntities(); Assert.AreEqual(0, camera.CurrentFrame); }
[Test, CloseAfterFirstFrame] public void CurrentFrameChangesWhenMoving() { PathCamera camera = CreatePathCamera(GetLinearViewMatrixTrack(GridDimension)); camera.IsMoving = true; AdvanceTimeAndUpdateEntities(); Assert.IsTrue(camera.CurrentFrame > 0); }
[Test, CloseAfterFirstFrame] public void SetCurrentFrame() { PathCamera camera = CreatePathCamera(GetLinearViewMatrixTrack(GridDimension)); camera.CurrentFrame = 1; Assert.AreEqual(1, camera.CurrentFrame); }
[Test, CloseAfterFirstFrame] public void SetCurrentFramePastEnd() { PathCamera camera = CreatePathCamera(GetLinearViewMatrixTrack(GridDimension)); camera.CurrentFrame = 1000; Assert.AreEqual(99, camera.CurrentFrame); }
[Test, CloseAfterFirstFrame] public void GetCurrentViewMatrix() { var matrices = GetLinearViewMatrixTrack(GridDimension); PathCamera camera = CreatePathCamera(matrices); camera.CurrentFrame = 5; Assert.AreEqual(matrices[5], camera.GetCurrentViewMatrix()); }
[Test, CloseAfterFirstFrame] public void CreatePathCameraWithDefaultPath() { Assert.DoesNotThrow(() => { new PathCamera(Resolve<Device>(), Resolve<Window>()); });
See Also