LabelTests ClassDelta Engine Documentation
Inheritance Hierarchy

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

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

The LabelTests type exposes the following members.

Constructors

  NameDescription
Public methodLabelTests
Initializes a new instance of the LabelTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodChangeTextOnce
Public methodChangeTextTwice
Public methodChangingLabelVisibilityChangesFontTextVisibility
Public methodColorDoesNotInterpolateAtCreation
Public methodDrawLoadedLabel
Public methodHiddenLabelDoesNotRender
Public methodInactiveLabelDoesNotRender
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodInitialText
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Public methodRenderGrowingLabel
Public methodRenderLabelAttachedToMouse
Public methodReportIfInsideRotatedLabel
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSaveAndLoad
Public methodSettingInvalidComponentHasNoEffect
Public methodSetUp
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void SettingInvalidComponentHasNoEffect()
{
    Assert.DoesNotThrow(() => label.Set(null));
}
[Test]
public void RenderGrowingLabel()
{
    label.Start<Grow>();
}
[Test, CloseAfterFirstFrame]
public void InitialText()
{
    Assert.AreEqual("Hello World", label.Text);
    Assert.AreEqual("Hello World", label.PreviousText);
}
[Test, CloseAfterFirstFrame]
public void ChangeTextOnce()
{
    label.Text = "Change 1";
    Assert.AreEqual("Change 1", label.Text);
    Assert.AreEqual("Hello World", label.PreviousText);
}
[Test, CloseAfterFirstFrame]
public void ChangeTextTwice()
{
    label.Text = "Change 1";
    label.Text = "Change 2";
    Assert.AreEqual("Change 2", label.Text);
    Assert.AreEqual("Change 1", label.PreviousText);
}
[Test, CloseAfterFirstFrame]
public void ChangingLabelVisibilityChangesFontTextVisibility()
{
    Assert.IsTrue(label.IsVisible);
    Assert.IsTrue(label.Get<FontText>().IsVisible);
    label.IsVisible = false;
    Assert.IsFalse(label.IsVisible);
    Assert.IsFalse(label.Get<FontText>().IsVisible);
}
[Test]
public void HiddenLabelDoesNotRender()
{
    label.IsVisible = false;
}
[Test]
public void InactiveLabelDoesNotRender()
{
    label.IsActive = false;
}
[Test]
public void RenderLabelAttachedToMouse()
{
    new Command(point => label.DrawArea = Rectangle.FromCenter(point, label.DrawArea.Size)).Add(
        new MouseMovementTrigger());
}
[Test]
public void ReportIfInsideRotatedLabel()
{
    label.Text = "";
    label.Rotation = 30;
    label.Start<ChangeLabelText>();
}
[Test, CloseAfterFirstFrame]
public void ColorDoesNotInterpolateAtCreation()
{
    Assert.AreEqual(label.Color, label.LastColor);
}
[Test, CloseAfterFirstFrame]
public void SaveAndLoad()
{
    var stream = BinaryDataExtensions.SaveToMemoryStream(label);
    var loadedLabel = (Label)stream.CreateFromMemoryStream();
    Assert.AreEqual(Rectangle.FromCenter(0.5f, 0.5f, 0.3f, 0.1f), loadedLabel.DrawArea);
    Assert.AreEqual("Hello World", loadedLabel.Text);
    Assert.AreEqual(label.children.Count, loadedLabel.children.Count);
}
[Test]
public void DrawLoadedLabel()
{
    label.Text = "Original";
    var stream = BinaryDataExtensions.SaveToMemoryStream(label);
    var loadedLabel = (Label)stream.CreateFromMemoryStream();
    loadedLabel.Text = "Loaded";
    loadedLabel.DrawArea = loadedLabel.DrawArea.Move(0.0f, 0.15f);
}
See Also