Grid2DTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.Rendering2D.Shapes.Tests Grid2DTests

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

public class Grid2DTests : TestWithMocksOrVisually

The Grid2DTests type exposes the following members.

Constructors

  NameDescription
Public methodGrid2DTests
Initializes a new instance of the Grid2DTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodChangeDimensionAndScale
Public methodDispose2DCamera
Public methodInactivatingInactivatesLines
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Public methodRenderQuadraticGridWithSizeOfOne
Public methodRenderQuadraticGridWithSizeOfTen
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetup2DCamera
Public methodTestDrawAreaOfGrid
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void RenderQuadraticGridWithSizeOfOne()
{
    var grid = new Grid2D(new Size(2), Vector2D.Half);
    AssertQuadraticGrid(2, grid);
    foreach (var line in grid.lines)
        Assert.IsTrue(line.IsActive);
}
[Test]
public void RenderQuadraticGridWithSizeOfTen()
{
    var grid = new Grid2D(new Size(10), Vector2D.Half, 0.05f);
    AssertQuadraticGrid(10, grid);
}
[Test, CloseAfterFirstFrame]
public void InactivatingInactivatesLines()
{
    var grid = new Grid2D(new Size(2), Vector2D.Half);
    grid.IsActive = false;
    foreach (var line in grid.lines)
        Assert.IsFalse(line.IsActive);
}
[Test, CloseAfterFirstFrame]
public void ChangeDimensionAndScale()
{
    var grid = new Grid2D(new Size(2), Vector2D.Half);
    grid.Dimension = new Size(4);
    grid.GridScale = 2;
    Assert.AreEqual(2, grid.GridScale);
}
[Test, CloseAfterFirstFrame]
public void TestDrawAreaOfGrid()
{
    var grid = new Grid2D(new Size(10), Vector2D.Half, 0.05f);
    var exceptedTopLeft = new Vector2D(0.25f, 0.25f);
    var exceptedBottomRight = new Vector2D(0.75f, 0.75f);
    Assert.AreEqual(Rectangle.FromCorners(exceptedTopLeft, exceptedBottomRight), grid.DrawArea);
}
See Also