Grid3DTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.Rendering3D.Shapes.Tests Grid3DTests

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

public class Grid3DTests : TestWithMocksOrVisually

The Grid3DTests type exposes the following members.

Constructors

  NameDescription
Public methodGrid3DTests
Initializes a new instance of the Grid3DTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCheckGridDimension
Public methodCheckGridScale
Public methodInactivatingInactivatesLines
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodRedrawGridIfItChanges
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Public methodRenderGridWithCenterInOtherPosition
Public methodRenderQuadraticGridWithSizeOfOne
Public methodRenderQuadraticGridWithSizeOfTen
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetupCameraFortyFiveDegreesView
Public methodUpdateCenterOfGrid
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void RenderQuadraticGridWithSizeOfOne()
{
    var grid = CreateQuadraticGrid(1);
    new Line3D(Vector3D.Zero, Vector3D.UnitZ, Color.Red);
    AssertQuadraticGrid(1, grid);
    foreach (var line in grid.lines)
        Assert.IsTrue(line.IsActive);
}
[Test]
public void RenderQuadraticGridWithSizeOfTen()
{
    var grid = CreateQuadraticGrid(10);
    AssertQuadraticGrid(10, grid);
}
[Test, CloseAfterFirstFrame]
public void InactivatingInactivatesLines()
{
    var grid = CreateQuadraticGrid(2);
    grid.IsActive = false;
    foreach (var line in grid.lines)
        Assert.IsFalse(line.IsActive);
}
[Test]
public void CheckGridScale()
{
    var grid = CreateQuadraticGrid(10);
    Assert.AreEqual(0.2f, grid.GridScale);
    grid.GridScale = 1.0f;
    Assert.AreEqual(1.0f, grid.GridScale);
}
[Test]
public void CheckGridDimension()
{
    var grid = CreateQuadraticGrid(10);
    Assert.AreEqual(new Size(10, 10), grid.Dimension);
    grid.Dimension = new Size(20, 20);
    Assert.AreEqual(new Size(20, 20), grid.Dimension);
}
[Test]
public void RenderGridWithCenterInOtherPosition()
{
    var grid = new Grid3D(new Vector3D(5, 5, 0), new Size(1));
    new Line3D(Vector3D.Zero, Vector3D.UnitX, Color.Red);
    new Line3D(Vector3D.Zero, Vector3D.UnitY, Color.Green);
    new Line3D(Vector3D.Zero, Vector3D.UnitZ, Color.Blue);
    AssertQuadraticGrid(1, grid);
    new Line3D(new Vector3D(5, 5, 0), new Vector3D(5, 5, 1), Color.Blue);
    foreach (var line in grid.lines)
        Assert.IsTrue(line.IsActive);
    Assert.AreEqual(new Vector3D(5, 5, 0), grid.Position);
}
[Test]
public void RedrawGridIfItChanges()
{
    var grid = new Grid3D(new Size(1));
    Assert.AreEqual(4, EntitiesRunner.Current.GetEntitiesOfType<Line3D>().Count);
    grid.Dimension = new Size(10);
    Assert.AreEqual(22, EntitiesRunner.Current.GetEntitiesOfType<Line3D>().Count);
}
[Test]
public void UpdateCenterOfGrid()
{
    var grid = new Grid3D(new Size(1));
    Assert.AreEqual(Vector3D.Zero, grid.Position);
    grid.Position = new Vector3D(1, 1, 0);
    Assert.AreEqual(4, EntitiesRunner.Current.GetEntitiesOfType<Line3D>().Count);
    Assert.AreEqual(new Vector3D(1, 1, 0), grid.Position);
}
See Also