MaterialTests LoadSavedMaterial Method Delta Engine Documentation

Namespace: DeltaEngine.Graphics.Tests
Assembly: DeltaEngine.Graphics.Tests (in DeltaEngine.Graphics.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void LoadSavedMaterial()
Examples

[Test, CloseAfterFirstFrame]
public void LoadSavedMaterial()
{
    var loadedMaterial = ContentLoader.Load<Material>("DefaultMaterial");
    Assert.AreEqual("DefaultMaterial", loadedMaterial.Name);
    Assert.IsTrue(loadedMaterial.Shader.Name.Contains(loadedMaterial.Shader.Flags.ToString()),
        loadedMaterial.Shader.Name);
    Assert.AreEqual("DeltaEngineLogo", loadedMaterial.DiffuseMap.Name);
    Assert.AreEqual(Color.White, loadedMaterial.DefaultColor);
}
[Test, CloseAfterFirstFrame]
public void LoadSavedMaterialWithPadding()
{
    var loadedMaterial = ContentLoader.Load<Material>("DefaultMaterial");
    loadedMaterial.RenderingCalculator = new RenderingCalculator(new AtlasRegion
    {
        PadLeft = 0.5f,
        PadRight = 0.5f,
        PadTop = 0.5f,
        PadBottom = 0.5f,
        IsRotated = false
    });
    RenderingData result = loadedMaterial.RenderingCalculator.GetUVAndDrawArea(
        Rectangle.HalfCentered, Rectangle.One);
    Assert.AreEqual(result.RequestedUserUV, Rectangle.HalfCentered);
}
[Test, CloseAfterFirstFrame]
public void LoadSavedMaterialWithClearPadding()
{
    var loadedMaterial = ContentLoader.Load<Material>("DefaultMaterial");
    loadedMaterial.RenderingCalculator = new RenderingCalculator(new AtlasRegion
    {
        PadLeft = 0,
        PadRight = 0,
        PadTop = 0,
        PadBottom = 0,
        IsRotated = false
    });
    var result = loadedMaterial.RenderingCalculator.GetUVAndDrawArea(Rectangle.HalfCentered,
        Rectangle.One);
    Assert.AreEqual(result.RequestedUserUV, Rectangle.HalfCentered);
}
See Also