Namespace: DeltaEngine.Scenes.Controls
Assembly: DeltaEngine.Scenes (in DeltaEngine.Scenes.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Scenes.Tests.Controls.ControlTests
Tests: DeltaEngine.Scenes.Tests.Controls.ButtonTests
1 unit tests call DeltaEngine.Scenes.Controls.Control.Name
2 unit tests call DeltaEngine.Scenes.Controls.Control.Name
Assembly: DeltaEngine.Scenes (in DeltaEngine.Scenes.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Property Value
Type: StringRemarks
Remarks
Examples
[Test] public void EachControlShouldHaveAnUniqueName() { var button1 = new Button(new Theme(), new Rectangle()); Assert.IsTrue(button1.Name.StartsWith("Button")); var button2 = new Button(new Theme(), new Rectangle()); Assert.IsTrue(button2.Name.StartsWith("Button")); Assert.AreNotEqual(button1.Name, button2.Name); var picture1 = new Picture(new Theme(), new Material(Color.Red, ShaderFlags.Position2DColored), new Rectangle()); Assert.IsTrue(picture1.Name.StartsWith("Picture")); }
Examples
[Test, CloseAfterFirstFrame] public void DefaultNames() { var button2 = new Button(Center, "Click Me"); Assert.IsTrue(button.Name.StartsWith("Button")); Assert.IsTrue(button2.Name.StartsWith("Button")); Assert.Greater(int.Parse(button2.Name.Replace("Button", "")), int.Parse(button.Name.Replace("Button", ""))); }
[Test, CloseAfterFirstFrame] public void SaveAndLoad() { button.Name = "New Name"; var stream = BinaryDataExtensions.SaveToMemoryStream(button); var loadedButton = (Button)stream.CreateFromMemoryStream(); Assert.AreEqual(Center, loadedButton.DrawArea); Assert.AreEqual("Click Me", loadedButton.Text); Assert.AreEqual("New Name", loadedButton.Name); }
See Also