GraphTests ClassDelta Engine Documentation
Inheritance Hierarchy

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

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 GraphTests : TestWithMocksOrVisually

The GraphTests type exposes the following members.

Constructors

  NameDescription
Public methodGraphTests
Initializes a new instance of the GraphTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodChangeArePercentileLabelsInteger
Public methodChangeAxesVisibility
Public methodChangeAxisColor
Public methodChangeBackgroundColor
Public methodChangeKeyVisibility
Public methodChangeMaximumNumberOfPoints
Public methodChangeNumberOfPercentiles
Public methodChangeOrigin
Public methodChangePercentileColor
Public methodChangePercentileLabelColor
Public methodChangePercentileLabelsVisibility
Public methodChangePercentilePrefix
Public methodChangePercentileSuffix
Public methodChangePercentilesVisibility
Public methodChangeViewport
Public methodGraphsArePauseable
Public methodGraphUpdatePauseable
Public methodHiddenGraphDisplaysNothing
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Public methodRemovingGraphLineRemovesItsLines
Public methodRenderFpsWithFivePercentiles
Public methodRenderGraphIncludingKey
Public methodRenderGraphWithAxes
Public methodRenderGraphWithFourLines
Public methodRenderOffCenterGraphWithAxesAndClipping
Public methodRenderResizedGraph
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetUp
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void RenderGraphWithFourLines()
{
    CreateGraphWithFourLines();
    graph.AxesIsVisible = false;
}
[Test]
public void RenderResizedGraph()
{
    CreateGraphWithFourLines();
    graph.DrawArea = Rectangle.HalfCentered;
}
[Test]
public void RenderGraphWithAxes()
{
    CreateGraphWithFourLines();
}
[Test]
public void RenderOffCenterGraphWithAxesAndClipping()
{
    CreateGraphWithFourLines();
    graph.Origin = Vector2D.Half;
    graph.Viewport = new Rectangle(0.2f, 0.3f, 1.0f, 1.0f);
}
[Test]
public void RenderFpsWithFivePercentiles()
{
    graph.Viewport = new Rectangle(0.0f, 0.0f, 10.0f, 60.0f);
    graph.NumberOfPercentiles = 5;
    graph.PercentileSuffix = "%";
    GraphLine line = graph.CreateLine("", LineColor);
    var fps = new FontText(Font.Default, "",
        new Rectangle(0.5f, 0.7f, 1.0f, 0.1f));
    graph.Add(line);
    graph.Add(fps);
    graph.Start<AddValueEveryFrame>();
}
[Test, CloseAfterFirstFrame]
public void ChangeAxesVisibility()
{
    Assert.IsTrue(graph.AxesIsVisible);
    graph.AxesIsVisible = false;
    Assert.IsFalse(graph.AxesIsVisible);
}
[Test, CloseAfterFirstFrame]
public void ChangePercentilesVisibility()
{
    Assert.IsFalse(graph.PercentilesIsVisible);
    graph.PercentilesIsVisible = true;
    graph.NumberOfPercentiles = 2;
    Assert.IsTrue(graph.PercentilesIsVisible);
}
[Test, CloseAfterFirstFrame]
public void ChangePercentileLabelsVisibility()
{
    Assert.IsFalse(graph.PercentileLabelsIsVisible);
    graph.PercentileLabelsIsVisible = true;
    graph.ArePercentileLabelsInteger = true;
    Assert.IsTrue(graph.PercentileLabelsIsVisible);
}
[Test, CloseAfterFirstFrame, Timeout(2000)]
public void ChangeKeyVisibility()
{
    graph.CreateLine("TestLine", Color.Red);
    graph.CreateLine("TestLine2", Color.Red);
    Assert.IsFalse(graph.KeyVisibility);
    graph.KeyVisibility = true;
    Assert.IsTrue(graph.KeyVisibility);
    graph.RefreshKey();

}
[Test, CloseAfterFirstFrame]
public void ChangeOrigin()
{
    Assert.AreEqual(Vector2D.Zero, graph.Origin);
    graph.Origin = Origin;
    graph.Origin = Origin;
    Assert.AreEqual(Origin, graph.Origin);
}
[Test, CloseAfterFirstFrame]
public void ChangeAxisColor()
{
    Assert.AreEqual(Color.White, graph.AxisColor);
    graph.AxisColor = Color.Blue;
    graph.AxisColor = Color.Blue;
    Assert.AreEqual(Color.Blue, graph.AxisColor);
}
[Test, CloseAfterFirstFrame]
public void ChangeViewport()
{
    graph.Viewport = Rectangle.One;
    Assert.AreEqual(Rectangle.One, graph.Viewport);
}
[Test, CloseAfterFirstFrame]
public void ChangeBackgroundColor()
{
    Assert.AreEqual(Graph.HalfBlack, graph.Color);
    graph.Color = Color.White;
    Assert.AreEqual(Color.White, graph.Color);
}
[Test, CloseAfterFirstFrame]
public void ChangeNumberOfPercentiles()
{
    Assert.AreEqual(0, graph.NumberOfPercentiles);
    graph.NumberOfPercentiles = 2;
    graph.NumberOfPercentiles = 2;
    Assert.AreEqual(2, graph.NumberOfPercentiles);
}
[Test, CloseAfterFirstFrame]
public void ChangeMaximumNumberOfPoints()
{
    Assert.AreEqual(0, graph.MaximumNumberOfPoints);
    graph.MaximumNumberOfPoints = 2;
    graph.MaximumNumberOfPoints = 2;
    Assert.AreEqual(2, graph.MaximumNumberOfPoints);
}
[Test, CloseAfterFirstFrame]
public void ChangePercentileColor()
{
    Assert.AreEqual(Color.Gray, graph.PercentileColor);
    graph.PercentileColor = Color.White;
    graph.PercentileColor = Color.White;
    Assert.AreEqual(Color.White, graph.PercentileColor);
}
[Test, CloseAfterFirstFrame]
public void ChangePercentileSuffix()
{
    Assert.AreEqual("", graph.PercentileSuffix);
    graph.PercentileSuffix = "%";
    graph.PercentileSuffix = "%";
    Assert.AreEqual("%", graph.PercentileSuffix);
}
[Test, CloseAfterFirstFrame]
public void ChangePercentilePrefix()
{
    Assert.AreEqual("", graph.PercentilePrefix);
    graph.PercentilePrefix = "$";
    graph.PercentilePrefix = "$";
    Assert.AreEqual("$", graph.PercentilePrefix);
}
[Test, CloseAfterFirstFrame]
public void ChangePercentileLabelColor()
{
    Assert.AreEqual(Color.White, graph.PercentileLabelColor);
    graph.PercentileLabelColor = Color.Gray;
    graph.PercentileLabelColor = Color.Gray;
    Assert.AreEqual(Color.Gray, graph.PercentileLabelColor);
}
[Test, CloseAfterFirstFrame]
public void ChangeArePercentileLabelsInteger()
{
    Assert.IsFalse(graph.ArePercentileLabelsInteger);
    graph.ArePercentileLabelsInteger = true;
    graph.ArePercentileLabelsInteger = true;
    Assert.IsTrue(graph.ArePercentileLabelsInteger);
}
[Test]
public void HiddenGraphDisplaysNothing()
{
    graph.NumberOfPercentiles = 5;
    GraphLine line = graph.CreateLine("", LineColor);
    line.AddPoint(new Vector2D(-1.0f, -1.0f));
    line.AddPoint(new Vector2D(0.1f, 0.5f));
    graph.IsVisible = false;
}
[Test, CloseAfterFirstFrame]
public void RemovingGraphLineRemovesItsLines()
{
    GraphLine line = graph.CreateLine("", LineColor);
    line.AddPoint(new Vector2D(-1.0f, -1.0f));
    line.AddPoint(new Vector2D(0.1f, 0.5f));
    Assert.AreEqual(1, graph.Lines.Count);
    Assert.AreEqual(1, line.lines.Count);
    graph.RemoveLine(line);
    Assert.AreEqual(0, graph.Lines.Count);
    Assert.AreEqual(0, line.lines.Count);
}
[Test]
public void GraphsArePauseable()
{
    Assert.IsTrue(graph.IsPauseable);
}
[Test, CloseAfterFirstFrame]
public void RenderGraphIncludingKey()
{
    graph.CreateLine("key", LineColor);
    graph.KeyVisibility = true;
    graph.RefreshKey();
    graph.KeyVisibility = true;
    graph.PercentileLabelsIsVisible = false;
    graph.PercentilesIsVisible = false;
    graph.Origin = graph.Origin;
    AdvanceTimeAndUpdateEntities();
}
[Test,CloseAfterFirstFrame]
public void GraphUpdatePauseable()
{
    Assert.IsTrue(graph.IsPauseable);
}
See Also