TilemapTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.Scenes.Tests.Controls TilemapTests

Namespace: DeltaEngine.Scenes.Tests.Controls
Assembly: DeltaEngine.Scenes.Tests (in DeltaEngine.Scenes.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class TilemapTests : TestWithMocksOrVisually

The TilemapTests type exposes the following members.

Constructors

  NameDescription
Public methodTilemapTests
Initializes a new instance of the TilemapTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodMoveToLeft
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Public methodRenderColoredLogoTilemap
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodTestBorderIntersection
Public methodTestUpdate
Public methodTestWithMockKeyboard
Public methodTestWithMouseDrag
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test, Category("Slow")] //ncrunch: no coverage start 
public void RenderColoredLogoTilemap()
{
    CreateBorder();
    var tilemap = new ColoredLogoTilemap(World, Map) { DrawArea = Center };
    tilemap.Add(new FontText(Font.Default, "", new Rectangle(0.3f, 0.6f, 0.2f, 0.2f))
    {
        HorizontalAlignment = HorizontalAlignment.Left,
        RenderLayer = 2
    });
    tilemap.Start<RenderDragInfo>();
}
[Test]
public void TestWithMouseDrag()
{
    var tilemap = new ColoredLogoTilemap(World, Map);
    tilemap.State.DragStart = new Vector2D(0.5f, 0.5f);
    tilemap.State.DragEnd = new Vector2D(0.7f, 0.9f);
    tilemap.Update();
    Assert.IsTrue(tilemap.State.DragDelta.IsNearlyEqual(new Vector2D(0.2f, 0.4f)));
}
[Test]
public void TestWithMockKeyboard()
{
    new ColoredLogoTilemap(World, Map);
    if (!IsMockResolver)
        return; //ncrunch: no coverage 
    var keyboard = Resolve<MockKeyboard>();
    keyboard.SetKeyboardState(Key.A, State.Pressed);
    AdvanceTimeAndUpdateEntities();
    keyboard.SetKeyboardState(Key.D, State.Pressed);
    AdvanceTimeAndUpdateEntities();
    keyboard.SetKeyboardState(Key.W, State.Pressed);
    AdvanceTimeAndUpdateEntities();
    keyboard.SetKeyboardState(Key.S, State.Pressed);
    AdvanceTimeAndUpdateEntities();
}
[Test]
public void TestUpdate()
{
    var tilemap = new ColoredLogoTilemap(World, Map);
    tilemap.DrawArea = Rectangle.One;
    tilemap.State.DragStart = new Vector2D(10.5f, 10.5f);
    tilemap.State.DragEnd = new Vector2D(0.5f, 0.5f);
    tilemap.Update();
    Assert.AreEqual(new Vector2D(-10, -10), tilemap.State.DragDelta);
}
[Test, Category("Slow")]
public void MoveToLeft()
{
    new ColoredLogoTilemap(World, Map);
    if (!IsMockResolver)
        return;
    var keyboard = Resolve<MockKeyboard>();
    keyboard.SetKeyboardState(Key.D, State.Pressed);
    AdvanceTimeAndUpdateEntities(1);
}
[Test, Category("Slow")]
public void TestBorderIntersection()
{
    new ColoredLogoTilemap(new Size(1), new Size(1));
    if (!IsMockResolver)
        return;
    var keyboard = Resolve<MockKeyboard>();
    keyboard.SetKeyboardState(Key.D, State.Pressed);
    AdvanceTimeAndUpdateEntities(1);
    keyboard.SetKeyboardState(Key.S, State.Pressed);
    AdvanceTimeAndUpdateEntities(1);
} // ncrunch: no coverage end
See Also