PictureTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.Scenes.Tests.Controls PictureTests

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

public class PictureTests : TestWithMocksOrVisually

The PictureTests type exposes the following members.

Constructors

  NameDescription
Public methodPictureTests
Initializes a new instance of the PictureTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodDrawLoadedPicture
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSaveAndLoad
Public methodSetAppearance
Public methodSetAppearanceWithNullShouldReturn
Public methodSetAppearanceWithoutInterpolation
Public methodSetAppearanceWithoutInterpolationWithNullShouldReturn
Public methodSetUp
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test, CloseAfterFirstFrame]
public void SaveAndLoad()
{
    var stream = BinaryDataExtensions.SaveToMemoryStream(picture);
    var loadedPicture = (Picture)stream.CreateFromMemoryStream();
    Assert.AreEqual("DeltaEngineLogo", loadedPicture.Material.DiffuseMap.Name);
    Assert.AreEqual("DeltaEngineLogo", loadedPicture.Get<Theme>().SliderPointer.DiffuseMap.Name);
    Assert.AreEqual(Rectangle.HalfCentered, loadedPicture.DrawArea);
}
[Test]
public void DrawLoadedPicture()
{
    picture.IsActive = false;
    picture = new Picture(new Theme(), material, Rectangle.HalfCentered);
    var stream = BinaryDataExtensions.SaveToMemoryStream(picture);
    picture.IsActive = false;
    stream.CreateFromMemoryStream();
}
[Test]
public void SetAppearance()
{
    material = new Material(Color.Red);
    picture.SetAppearance(material);
    Assert.AreEqual(material, picture.Material);
    Assert.AreEqual(material.DefaultColor, picture.Color);
}
[Test]
public void SetAppearanceWithNullShouldReturn()
{
    Assert.DoesNotThrow(() => picture.SetAppearance(null));
}
[Test]
public void SetAppearanceWithoutInterpolationWithNullShouldReturn()
{
    Assert.DoesNotThrow(() => picture.SetAppearanceWithoutInterpolation(null));
}
[Test]
public void SetAppearanceWithoutInterpolation()
{
    var newMaterial = new Material(Color.Red);
    picture.SetAppearanceWithoutInterpolation(newMaterial);
    Assert.AreEqual(newMaterial, picture.Material);
    Assert.AreEqual(newMaterial.DefaultColor, picture.Color);
}
See Also