Inheritance Hierarchy
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
The TilemapTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
TilemapTests | Initializes a new instance of the TilemapTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
MoveToLeft | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
RenderColoredLogoTilemap | ||
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
TestBorderIntersection | ||
TestUpdate | ||
TestWithMockKeyboard | ||
TestWithMouseDrag |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
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