AutoArrangingMenuTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.Scenes.Tests AutoArrangingMenuTests

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

public class AutoArrangingMenuTests : TestWithMocksOrVisually

The AutoArrangingMenuTests type exposes the following members.

Constructors

  NameDescription
Public methodAutoArrangingMenuTests
Initializes a new instance of the AutoArrangingMenuTests class
Top
Methods

  NameDescription
Public methodAddControlContentTwice
Public methodAddingMenuOptionAddsButton
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodChangingButtonSize
Public methodChangingCenterForSetOfButtons
Public methodChangingMenuRenderLayerChangesRenderLayerOfControls
Public methodClearClearsButtons
Public methodClearMenuOptionsLeavesOtherControlsAlone
Public methodControlEnableAndDisable
Public methodCreateNewMenuWithContentName
Public methodCreatingSetsButtonSizeAndMenuCenter
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodMenuRenderLayerIsAppliedToControls
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetUp
Public methodShowMenuWithThreeButtons
Public methodShowMenuWithThreeTextButtons
Public methodShowMenuWithTwoButtons
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void CreateNewMenuWithContentName()
{
    AutoArrangingMenu menuByName = ContentLoader.Load<MenuXml>("TestMenuXml");
    Assert.AreEqual(menuByName.Name, "TestMenuXml");
}
[Test, ApproveFirstFrameScreenshot]
public void ShowMenuWithTwoButtons()
{
    menu.AddMenuOption(() => { text.Text = "Clicked Top Button"; });
[Test]
public void ShowMenuWithThreeButtons()
{
    menu.AddMenuOption(() => { text.Text = "Clicked Top Button"; });
[Test]
public void ShowMenuWithThreeTextButtons()
{
    menu.AddMenuOption(new Theme(), () => { text.Text = "Clicked Top Button"; }, "Top Button");
    menu.AddMenuOption(new Theme(), () => { text.Text = "Clicked Middle Button"; },
        "Middle Button");
    menu.AddMenuOption(new Theme(), () => { text.Text = "Clicked Bottom Button"; },
        "Bottom Button");
    menu.Show();
}
[Test, CloseAfterFirstFrame]
public void CreatingSetsButtonSizeAndMenuCenter()
{
    Assert.AreEqual(ButtonSize, menu.ButtonSize);
    Assert.AreEqual(Vector2D.Half, menu.Center);
}
[Test, CloseAfterFirstFrame, Timeout(2000)]
public void ChangingButtonSize()
{
    menu.ButtonSize = Size.Half;
    Assert.AreEqual(Size.Half, menu.ButtonSize);
}
[Test, CloseAfterFirstFrame]
public void ChangingCenterForSetOfButtons()
{
    menu.Center = Vector2D.One;
    Assert.AreEqual(Vector2D.One, menu.Center);
}
[Test, CloseAfterFirstFrame]
public void AddingMenuOptionAddsButton()
{
    menu.Center = new Vector2D(0.6f, 0.6f);
    menu.AddMenuOption(() => { });
[Test, CloseAfterFirstFrame]
public void AddControlContentTwice()
{
    var control = new TestControl();
    control.IsActive = false;
    Assert.AreEqual(false, control.IsActive);
    control.IsActive = true;
    Assert.AreEqual(false, control.IsActive);
}
[Test, CloseAfterFirstFrame]
public void ControlEnableAndDisable()
{
    menu.AddMenuOption(() => { });
[Test, CloseAfterFirstFrame]
public void ClearClearsButtons()
{
    menu.AddMenuOption(() => { });
[Test, CloseAfterFirstFrame]
public void ClearMenuOptionsLeavesOtherControlsAlone()
{
    var logo = new Material(ShaderFlags.Position2DTextured, "DeltaEngineLogo");
    menu.Add(new Sprite(logo, Rectangle.One));
    menu.AddMenuOption(() => { });
[Test, CloseAfterFirstFrame]
public void MenuRenderLayerIsAppliedToControls()
{
    menu.AddMenuOption(() => { });
[Test, CloseAfterFirstFrame]
public void ChangingMenuRenderLayerChangesRenderLayerOfControls()
{
    menu.AddMenuOption(() => { });
See Also