AutogrowViewportTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.Rendering2D.Graphs.Tests AutogrowViewportTests

Namespace: DeltaEngine.Rendering2D.Graphs.Tests
Assembly: DeltaEngine.Rendering2D.Graphs.Tests (in DeltaEngine.Rendering2D.Graphs.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class AutogrowViewportTests : TestWithMocksOrVisually

The AutogrowViewportTests type exposes the following members.

Constructors

  NameDescription
Public methodAutogrowViewportTests
Initializes a new instance of the AutogrowViewportTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodIfViewportDoesNotNeedToChangeToAccomodateNewPointsItDoesnt
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Public methodRenderFps
Public methodRenderGraph
Public methodRenderNumberOfEntities
Public methodRenderRandomGraph
Public methodRenderTwoRandomLinesWithKey
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetUp
Public methodViewportStartsZero
Public methodWhenMultiplePointsHaveBeenAddedViewportPositionsAndSizesToContainThem
Public methodWhenOnlyOnePointHasBeenAddedViewportPositionsToThatPoint
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void RenderGraph()
{
    line.AddPoint(new Vector2D(-1.0f, -1.0f));
    line.AddPoint(new Vector2D(0.0f, 0.5f));
    line.AddPoint(new Vector2D(1.0f, 1.0f));
    line.AddPoint(new Vector2D(1.5f, -2.0f));
}
[Test]
public void RenderRandomGraph()
{
    graph.Add(line);
    graph.Start<AddValueEverySecond>();
}
[Test, Timeout(2000)]
public void RenderFps()
{
    graph.Add(line);
    graph.Add(new FontText(Font.Default, "", new Rectangle(0.5f, 0.7f, 0.2f, 0.1f)));
    graph.Start<AddFpsEverySecond>();
}
[Test]
public void RenderNumberOfEntities()
{
    graph.Viewport = new Rectangle(-1, -1, 1, 1);
    graph.Add(line);
    graph.Add(new FontText(Font.Default, "", new Rectangle(0.5f, 0.7f, 0.2f, 0.1f)));
    graph.Start<AddNumberOfEntitiesEverySecond>();
}
[Test]
public void RenderTwoRandomLinesWithKey()
{
    GraphLine line2 = graph.CreateLine("Two", Color.Red);
    graph.Add(new List<GraphLine> { line, line2 });
[Test, CloseAfterFirstFrame]
public void ViewportStartsZero()
{
    Assert.AreEqual(Rectangle.Zero, graph.Viewport);
}
[Test, CloseAfterFirstFrame]
public void WhenOnlyOnePointHasBeenAddedViewportPositionsToThatPoint()
{
    line.AddPoint(new Vector2D(1.0f, -2.5f));
    AdvanceTimeAndUpdateEntities();
    Assert.AreEqual(new Rectangle(1.0f, -2.5f, 0.0f, 0.0f), graph.Viewport);
}
[Test, CloseAfterFirstFrame]
public void WhenMultiplePointsHaveBeenAddedViewportPositionsAndSizesToContainThem()
{
    line.AddPoint(new Vector2D(0.0f, -2.5f));
    line.AddPoint(new Vector2D(2.0f, -1.0f));
    line.AddPoint(new Vector2D(-1.0f, -3.0f));
    AdvanceTimeAndUpdateEntities();
    Assert.IsTrue(graph.Viewport.IsNearlyEqual(new Rectangle(-1.15f, -3.1f, 3.3f, 2.2f)));
}
[Test, CloseAfterFirstFrame]
public void IfViewportDoesNotNeedToChangeToAccomodateNewPointsItDoesnt()
{
    line.AddPoint(new Vector2D(0, -2.5f));
    line.AddPoint(new Vector2D(2, -1.0f));
    line.AddPoint(new Vector2D(1, -1.5f));
    AdvanceTimeAndUpdateEntities();
    Assert.IsTrue(graph.Viewport.IsNearlyEqual(new Rectangle(-0.1f, -2.575f, 2.2f, 1.65f)));
}
See Also