PathCameraTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  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

public class PathCameraTests : TestWithMocksOrVisually

The PathCameraTests type exposes the following members.

Constructors

  NameDescription
Public methodPathCameraTests
Initializes a new instance of the PathCameraTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodAutomatedCameraMoveOnCircularTrackOnMiddleClick
Public methodAutomatedCameraMoveOnLinearTrackOnMiddleClick
Public methodCameraCanBeMovedOnLinearTrackWithScrollWheel
Public methodCreatePathCameraWithDefaultPath
Public methodCurrentFrameChangesWhenMoving
Public methodCurrentFrameDoesNotChangeWhenNotMoving
Public methodGetCurrentViewMatrix
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetCurrentFrame
Public methodSetCurrentFramePastEnd
Public methodThrowExceptionIfNoTrackPositionIsSpecified
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
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