Label Text Property Delta Engine Documentation

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

public string Text { get; set; }

Property Value

Type: String
Remarks

Tests: DeltaEngine.Scenes.Tests.Controls.LabelTests
Remarks

Tests: DeltaEngine.Scenes.Tests.Controls.ButtonTests
Remarks

Tests: DeltaEngine.Scenes.Tests.Controls.InteractiveButtonTests
Remarks

Tests: DeltaEngine.Scenes.Tests.Controls.RadioButtonTests
Remarks

Tests: DeltaEngine.Scenes.Tests.Controls.TextBoxTests
Examples

6 unit tests call DeltaEngine.Scenes.Controls.Label.Text
[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);
}
Examples

2 unit tests call DeltaEngine.Scenes.Controls.Label.Text
[Test]
public void DrawLoadedButton()
{
    button.Text = "Original";
    var stream = BinaryDataExtensions.SaveToMemoryStream(button);
    var loadedButton = (Button)stream.CreateFromMemoryStream();
    loadedButton.Text = "Loaded";
    loadedButton.DrawArea = loadedButton.DrawArea.Move(0.0f, 0.15f);
}
[Test, Ignore] //ncrunch: no coverage start 
public void LoadWithoutBinaryDataExtensions()
{
    var stream = BinaryDataExtensions.SaveToMemoryStream(button);
    button.Text = "Original";
    var loadedButton = new Button();
    loadedButton.LoadFromStream(stream);
    Assert.AreEqual(Center, loadedButton.DrawArea);
    Assert.AreEqual("Click Me", loadedButton.Text);
    loadedButton.DrawArea = loadedButton.DrawArea.Move(new Vector2D(0.0f, 0.2f));
}
Examples

2 unit tests call DeltaEngine.Scenes.Controls.Label.Text
[Test]
public void DrawLoadedButton()
{
    button.Text = "Original";
    var stream = BinaryDataExtensions.SaveToMemoryStream(button);
    var loadedButton = (InteractiveButton)stream.CreateFromMemoryStream();
    loadedButton.Text = "Loaded";
    loadedButton.DrawArea = loadedButton.DrawArea.Move(0.0f, 0.15f);
}
[Test, CloseAfterFirstFrame, Ignore]
public void LoadWithoutBinaryDataExtensions()
{
    var stream = BinaryDataExtensions.SaveToMemoryStream(button);
    button.Text = "Original";
    var loadedButton = new InteractiveButton();
    loadedButton.LoadFromStream(stream);
    Assert.AreEqual(Center, loadedButton.DrawArea);
    Assert.AreEqual("Click Me", loadedButton.Text);
    loadedButton.DrawArea = loadedButton.DrawArea.Move(new Vector2D(0.0f, 0.2f));
}
Examples

1 unit tests call DeltaEngine.Scenes.Controls.Label.Text
[Test]
public void SaveAndLoad()
{
    centerButton.Text = "Original";
    var stream = BinaryDataExtensions.SaveToMemoryStream(centerButton);
    var loadedButton = (RadioButton)stream.CreateFromMemoryStream();
    loadedButton.Text = "Loaded";
    Assert.AreEqual(Center, loadedButton.DrawArea);
    loadedButton.DrawArea = loadedButton.DrawArea.Move(new Vector2D(0.0f, 0.1f));
}
Examples

10 unit tests call DeltaEngine.Scenes.Controls.Label.Text
[Test, CloseAfterFirstFrame]
public void ClickingTextBoxGivesItFocus()
{
    if (!IsMockResolver)
        return; //ncrunch: no coverage
    Assert.IsFalse(topTextBox.State.HasFocus);
    PressAndReleaseMouse(Vector2D.One);
    Assert.IsFalse(topTextBox.State.HasFocus);
    PressAndReleaseMouse(Top.Center);
    Assert.IsTrue(topTextBox.State.HasFocus);
}
[Test, CloseAfterFirstFrame]
public void ClickingOneTextBoxCausesOtherTextBoxToLoseFocus()
{
    if (!IsMockResolver)
        return; //ncrunch: no coverage
    PressAndReleaseMouse(Top.Center);
    Assert.IsTrue(topTextBox.State.HasFocus);
    Assert.IsFalse(bottomTextBox.State.HasFocus);
    PressAndReleaseMouse(Bottom.Center);
    Assert.IsFalse(topTextBox.State.HasFocus);
    Assert.IsTrue(bottomTextBox.State.HasFocus);
    Assert.AreEqual(Color.Gray, topTextBox.Color);
    Assert.AreEqual(Color.LightGray, bottomTextBox.Color);
}
[Test, CloseAfterFirstFrame]
public void TypingHasNoEffectIfTextBoxDoesNotHaveFocus()
{
    topTextBox.Text = "";
    PressKey(Key.A);
    Assert.AreEqual("", topTextBox.Text);
}
See Also