Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Rendering2D.Graphs.Tests AutogrowViewportTests
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
The AutogrowViewportTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
AutogrowViewportTests | Initializes a new instance of the AutogrowViewportTests class |
Methods
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void RenderGraph() { line.AddPoint(new Vector2D(-1.0f, -1.0f)); line.AddPoint(new Vector2D(0.0f, 0.5f)); line.AddPoint(new Vector2D(1.0f, 1.0f)); line.AddPoint(new Vector2D(1.5f, -2.0f)); }
[Test] public void RenderRandomGraph() { graph.Add(line); graph.Start<AddValueEverySecond>(); }
[Test, Timeout(2000)] public void RenderFps() { graph.Add(line); graph.Add(new FontText(Font.Default, "", new Rectangle(0.5f, 0.7f, 0.2f, 0.1f))); graph.Start<AddFpsEverySecond>(); }
[Test] public void RenderNumberOfEntities() { graph.Viewport = new Rectangle(-1, -1, 1, 1); graph.Add(line); graph.Add(new FontText(Font.Default, "", new Rectangle(0.5f, 0.7f, 0.2f, 0.1f))); graph.Start<AddNumberOfEntitiesEverySecond>(); }
[Test] public void RenderTwoRandomLinesWithKey() { GraphLine line2 = graph.CreateLine("Two", Color.Red); graph.Add(new List<GraphLine> { line, line2 });
[Test, CloseAfterFirstFrame] public void ViewportStartsZero() { Assert.AreEqual(Rectangle.Zero, graph.Viewport); }
[Test, CloseAfterFirstFrame] public void WhenOnlyOnePointHasBeenAddedViewportPositionsToThatPoint() { line.AddPoint(new Vector2D(1.0f, -2.5f)); AdvanceTimeAndUpdateEntities(); Assert.AreEqual(new Rectangle(1.0f, -2.5f, 0.0f, 0.0f), graph.Viewport); }
[Test, CloseAfterFirstFrame] public void WhenMultiplePointsHaveBeenAddedViewportPositionsAndSizesToContainThem() { line.AddPoint(new Vector2D(0.0f, -2.5f)); line.AddPoint(new Vector2D(2.0f, -1.0f)); line.AddPoint(new Vector2D(-1.0f, -3.0f)); AdvanceTimeAndUpdateEntities(); Assert.IsTrue(graph.Viewport.IsNearlyEqual(new Rectangle(-1.15f, -3.1f, 3.3f, 2.2f))); }
[Test, CloseAfterFirstFrame] public void IfViewportDoesNotNeedToChangeToAccomodateNewPointsItDoesnt() { line.AddPoint(new Vector2D(0, -2.5f)); line.AddPoint(new Vector2D(2, -1.0f)); line.AddPoint(new Vector2D(1, -1.5f)); AdvanceTimeAndUpdateEntities(); Assert.IsTrue(graph.Viewport.IsNearlyEqual(new Rectangle(-0.1f, -2.575f, 2.2f, 1.65f))); }
See Also