Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Graphics.Tests DrawingTests
Namespace: DeltaEngine.Graphics.Tests
Assembly: DeltaEngine.Graphics.Tests (in DeltaEngine.Graphics.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The DrawingTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DrawingTests | Initializes a new instance of the DrawingTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
DrawEmptyLine | ||
DrawRedLine | ||
IncreaseNumberOfLinesOverTime | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
LineMaterialShouldNotUseDiffuseMap | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
ShowYellowLineFullscreen | ||
TestViewportPixelSize | ||
WrapLinesRandomly |
Via Lerp we can do fun things like update all lines to new positions each update tick and
the drawing will interpolate between them. Here we use just 2 update ticks per second.
View code on GitHub |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test, ApproveFirstFrameScreenshot] public void DrawRedLine() { new Line(Vector2D.Zero, new Vector2D(1280, 720), Color.Red); RunAfterFirstFrame( () => Assert.AreEqual(2, Resolve<Drawing>().NumberOfDynamicVerticesDrawnThisFrame)); }
[Test] public void IncreaseNumberOfLinesOverTime() { new LineAdder(Vector2D.Zero, new Vector2D(100, 80), Color.Red); }
/// <summary> /// Via Lerp we can do fun things like update all lines to new positions each update tick and /// the drawing will interpolate between them. Here we use just 2 update ticks per second. /// </summary> [Test] public void WrapLinesRandomly() { EntitiesRunner.Current.ChangeUpdateTimeStep(0.5f); new RandomLines(100); }
[Test, ApproveFirstFrameScreenshot] public void ShowYellowLineFullscreen() { var settings = Resolve<Settings>(); settings.StartInFullscreen = true; settings.Resolution = new Size(1920, 1080); new Line(Vector2D.Zero, settings.Resolution, Color.Yellow); settings.StartInFullscreen = false; settings.Resolution = Settings.DefaultResolution; }
[Test, CloseAfterFirstFrame] public void LineMaterialShouldNotUseDiffuseMap() { var drawing = Resolve<Drawing>(); var shader = ContentLoader.Create<Shader>( new ShaderCreationData(ShaderFlags.Position2DTextured)); var image = ContentLoader.Create<Image>(new ImageCreationData(Size.One)); var generatedMaterial = new Material(shader, image); Assert.Throws<Drawing.LineMaterialShouldNotUseDiffuseMap>( () => drawing.AddLines(generatedMaterial, new VertexPosition2DColor[4])); }
[Test, CloseAfterFirstFrame] public void TestViewportPixelSize() { var drawing = Resolve<Drawing>(); var window = Resolve<Window>(); window.ViewportPixelSize = new Size(800, 600); Assert.AreEqual(new Size(800, 600), drawing.ViewportPixelSize); }
[Test, CloseAfterFirstFrame] public void DrawEmptyLine() { var line = new Line(Vector2D.Zero, Vector2D.Zero, Color.White); line.Set(new VertexPosition2DColor[0]); }
See Also