ThemeTests ClassDelta Engine Documentation
Inheritance Hierarchy

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

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 ThemeTests : TestWithMocksOrVisually

The ThemeTests type exposes the following members.

Constructors

  NameDescription
Public methodThemeTests
Initializes a new instance of the ThemeTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodLoadTheme
Public methodLoadThemeFromFile
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSaveAndLoadDefaultTheme
Public methodSaveAndLoadModifiedTheme
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test, CloseAfterFirstFrame]
public void SaveAndLoadDefaultTheme()
{
    var theme = new Theme();
    var stream = BinaryDataExtensions.SaveToMemoryStream(theme);
    var loadedTheme = (Theme)stream.CreateFromMemoryStream();
    Assert.IsTrue(AreMaterialsEqual(theme.ButtonMouseover, loadedTheme.ButtonMouseover));
    Assert.IsTrue(AreMaterialsEqual(theme.ScrollbarPointer, loadedTheme.ScrollbarPointer));
    Assert.IsTrue(AreMaterialsEqual(theme.TextBoxFocused, loadedTheme.TextBoxFocused));
}
[Test, CloseAfterFirstFrame]
public void SaveAndLoadModifiedTheme()
{
    var theme = new Theme();
    theme.Slider = new Material(ShaderFlags.Position2DColoredTextured, "DeltaEngineLogo")
    {
        DefaultColor = Color.Red
    };
    var stream = BinaryDataExtensions.SaveToMemoryStream(theme);
    var loadedTheme = (Theme)stream.CreateFromMemoryStream();
    Assert.IsTrue(AreMaterialsEqual(theme.Slider, loadedTheme.Slider));
}
[Test, CloseAfterFirstFrame]
public void LoadTheme()
{
    Theme theme = CreateSampleTheme();
    var loadedData = new ThemeLoader().LoadValidData(dataStream);
    AssertLoadedThemeData(theme, loadedData);
}
[Test, CloseAfterFirstFrame]
public void LoadThemeFromFile()
{
    Theme theme = CreateSampleTheme();
    var loadedData = new Theme();
    loadedData.LoadFromFile(dataStream);
    AssertLoadedThemeData(theme, loadedData);
}
See Also