Skip to content

Commit

Permalink
Remove usage of player settings in TestSceneSettingsToolboxGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte committed May 9, 2022
1 parent 96ea4ee commit beb86a7
Showing 1 changed file with 29 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,51 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Play.PlayerSettings;
using osu.Game.Overlays.Settings;
using osuTK.Input;

namespace osu.Game.Tests.Visual.UserInterface
{
[TestFixture]
public class TestSceneSettingsToolboxGroup : OsuManualInputManagerTestScene
{
public TestSceneSettingsToolboxGroup()
{
ExampleContainer container;

Add(new PlayerSettingsOverlay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
State = { Value = Visibility.Visible }
});

Add(container = new ExampleContainer());

AddStep(@"Add button", () => container.Add(new TriangleButton
{
RelativeSizeAxes = Axes.X,
Text = @"Button",
}));

AddStep(@"Add checkbox", () => container.Add(new PlayerCheckbox
{
LabelText = "Checkbox",
}));
private SettingsToolboxGroup group;

AddStep(@"Add textbox", () => container.Add(new FocusedTextBox
[SetUp]
public void SetUp() => Schedule(() =>
{
Child = group = new SettingsToolboxGroup("example")
{
RelativeSizeAxes = Axes.X,
Height = 30,
PlaceholderText = "Textbox",
HoldFocus = false,
}));
}
Children = new Drawable[]
{
new RoundedButton
{
RelativeSizeAxes = Axes.X,
Text = @"Button",
Enabled = { Value = true },
},
new OsuCheckbox
{
LabelText = @"Checkbox",
},
new OutlinedTextBox
{
RelativeSizeAxes = Axes.X,
Height = 30,
PlaceholderText = @"Textbox",
}
},
};
});

[Test]
public void TestClickExpandButtonMultipleTimes()
{
SettingsToolboxGroup group = null;

AddAssert("group expanded by default", () => (group = this.ChildrenOfType<SettingsToolboxGroup>().First()).Expanded.Value);
AddAssert("group expanded by default", () => group.Expanded.Value);
AddStep("click expand button multiple times", () =>
{
InputManager.MoveMouseTo(group.ChildrenOfType<IconButton>().Single());
Expand All @@ -65,13 +58,5 @@ public void TestClickExpandButtonMultipleTimes()
});
AddAssert("group contracted", () => !group.Expanded.Value);
}

private class ExampleContainer : PlayerSettingsGroup
{
public ExampleContainer()
: base("example")
{
}
}
}
}

0 comments on commit beb86a7

Please sign in to comment.