MaterialTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  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

public class MaterialTests : TestWithMocksOrVisually

The MaterialTests type exposes the following members.

Constructors

  NameDescription
Public methodMaterialTests
Initializes a new instance of the MaterialTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodLoad3DMaterial
Public methodLoadMaterialWithAnimation
Public methodLoadMaterialWithSpriteSheet
Public methodLoadSimpleMaterial
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSaveAndLoadAnimationMaterial
Public methodSaveAndLoadContentMaterial
Public methodSaveAndLoadCustomImageMaterial
Public methodSaveAndLoadCustomMaterial
Public methodSaveAndLoadImageMaterial
Public methodSaveAndLoadSpriteSheetMaterial
Public methodSkipImageDataLoadingIfNoImageNameWasSpecified
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
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