Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Rendering2D.Tests MaterialTests
Namespace: DeltaEngine.Rendering2D.Tests
Assembly: DeltaEngine.Rendering2D.Tests (in DeltaEngine.Rendering2D.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The MaterialTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MaterialTests | Initializes a new instance of the MaterialTests class |
Methods
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test, CloseAfterFirstFrame] public void LoadSimpleMaterial() { Assert.IsNotNull(ContentLoader.Load<Material>("Earth")); }
[Test, CloseAfterFirstFrame] public void SkipImageDataLoadingIfNoImageNameWasSpecified() { var noImageMaterial = ContentLoader.Load<Material>("NoImageMaterial"); Assert.IsNull(noImageMaterial.DiffuseMap); Assert.IsNull(noImageMaterial.Animation); Assert.IsNull(noImageMaterial.SpriteSheet); }
[Test, CloseAfterFirstFrame] public void LoadMaterialWithAnimation() { ContentLoader.Load<ImageAnimation>("MyImageAnimation"); var noImageMaterial = ContentLoader.Load<Material>("MaterialWithImageAnimation"); Assert.IsNotNull(noImageMaterial.Animation); Assert.IsNull(noImageMaterial.SpriteSheet); }
[Test, CloseAfterFirstFrame] public void LoadMaterialWithSpriteSheet() { ContentLoader.Load<SpriteSheetAnimation>("MySpriteSheet"); var noImageMaterial = ContentLoader.Load<Material>("MaterialWithSpriteSheet"); Assert.IsNotNull(noImageMaterial.SpriteSheet); }
[Test, CloseAfterFirstFrame] public void Load3DMaterial() { var material = ContentLoader.Load<Material>("Material3D"); var shader = material.Shader as ShaderWithFormat; Assert.IsTrue(shader.Format.Is3D); }
[Test, CloseAfterFirstFrame] public void SaveAndLoadContentMaterial() { SaveAndLoadMaterialAndCompare(ContentLoader.Load<Material>("Earth")); }
[Test, CloseAfterFirstFrame] public void SaveAndLoadImageMaterial() { SaveAndLoadMaterialAndCompare(new Material(ShaderFlags.Position2DTextured, "EarthSpriteSheet")); }
[Test, CloseAfterFirstFrame] public void SaveAndLoadCustomMaterial() { var shader = ContentLoader.Create<Shader>( new ShaderCreationData(ShaderFlags.Position2DTextured)); var image = ContentLoader.Load<Image>("EarthImages"); SaveAndLoadMaterialAndCompare(new Material(shader, image)); }
[Test, CloseAfterFirstFrame] public void SaveAndLoadAnimationMaterial() { var shader = ContentLoader.Create<Shader>( new ShaderCreationData(ShaderFlags.Position2DTextured)); var animation = ContentLoader.Load<ImageAnimation>("MyImageAnimation"); SaveAndLoadMaterialAndCompare(new Material(shader, null) { Animation = animation }); }
[Test, CloseAfterFirstFrame] public void SaveAndLoadSpriteSheetMaterial() { SaveAndLoadMaterialAndCompare(new Material(ShaderFlags.Position2DTextured, "MySpriteSheet")); }
[Test, CloseAfterFirstFrame] public void SaveAndLoadCustomImageMaterial() { var shader = ContentLoader.Create<Shader>( new ShaderCreationData(ShaderFlags.Position2DTextured)); SaveAndLoadMaterialAndCompare(new Material(shader, null)); }
See Also