Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Graphics.Tests ShaderWithFormatTests
Namespace: DeltaEngine.Graphics.Tests
Assembly: DeltaEngine.Graphics.Tests (in DeltaEngine.Graphics.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The ShaderWithFormatTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ShaderWithFormatTests | Initializes a new instance of the ShaderWithFormatTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
AllowDynamicCreationViaCreationData | ||
CreateColoredFogShader | ||
CreateTextureLightMapShader | ||
CreationOfShaderWithInvalidShaderCodeMustFail | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
InvalidShaderFlagsThrowsException | ||
InvalidVertexAndPixelCode | ||
InvalidVertexFormat | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test, CloseAfterFirstFrame] public void InvalidVertexFormat() { var invalidData = new ShaderWithFormatCreationData(ShaderFlags.None, "", "", "", "", null); Assert.Throws<ShaderWithFormat.InvalidVertexFormat>( () => ContentLoader.Create<Shader>(invalidData)); var emptyFormat = new ShaderWithFormatCreationData(ShaderFlags.None, "", "", "", "", new VertexFormat(new VertexElement[0])); Assert.Throws<ShaderWithFormat.InvalidVertexFormat>( () => ContentLoader.Create<Shader>(emptyFormat)); }
[Test, CloseAfterFirstFrame] public void InvalidVertexAndPixelCode() { var data = new ShaderWithFormatCreationData(ShaderFlags.None, "", "", "", "", VertexFormat.Position2DColor); Assert.Throws<ShaderWithFormat.NoShaderCodeSpecifiedForOpenGLAndDirectX>( () => ContentLoader.Create<Shader>(data)); }
[Test, CloseAfterFirstFrame] public void AllowDynamicCreationViaCreationData() { var data = new ShaderWithFormatCreationData(ShaderFlags.None, "AnyData", "AnyData", "AnyData", "AnyData", VertexFormat.Position2DColor); var shader = ContentLoader.Create<NoDataShaderWithFormat>(data); Assert.DoesNotThrow(() => shader.ReloadCreationData(data)); }
[Test, CloseAfterFirstFrame] public void InvalidShaderFlagsThrowsException() { Assert.Throws<ShaderWithFormat.ShaderFlagsNotSupported>( () => new InvalidShaderWithFormat(Resolve<Device>())); }
[Test, CloseAfterFirstFrame] public void CreationOfShaderWithInvalidShaderCodeMustFail() { var creationData = new ShaderWithFormatCreationData(ShaderFlags.Colored, "BadGLVertexCode", "BadGLFragmentCode", "BadDX11Code", "BadDX9Code", VertexFormat.Position3DColor); AssertShaderCreationException(creationData); creationData = new ShaderWithFormatCreationData(ShaderFlags.Colored, "AnyData", "BadGLFragmentCode", "BadDX11Code", "BadDX9Code", VertexFormat.Position3DColor); AssertShaderCreationException(creationData); creationData = new ShaderWithFormatCreationData(ShaderFlags.Colored, "AnyData", "AnyData", "BadDX11Code", "BadDX9Code", VertexFormat.Position3DColor); AssertShaderCreationException(creationData); creationData = new ShaderWithFormatCreationData(ShaderFlags.Colored, "AnyData", "AnyData", "AnyData", "BadDX9Code", VertexFormat.Position3DColor); AssertShaderCreationException(creationData); }
[Test, CloseAfterFirstFrame] public void CreateTextureLightMapShader() { var shader = new TextureLightMapShaderWithFormat(Resolve<Device>()); Assert.IsTrue(shader.Format.HasLightmap); Assert.IsTrue(shader.Format.HasUV); }
[Test, CloseAfterFirstFrame] public void CreateColoredFogShader() { var shader = new ColoredFogShaderWithFormat(Resolve<Device>()); Assert.IsTrue(shader.Format.HasColor); Assert.IsTrue(shader.Format.Is3D); }
See Also