1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 20:37:19 +08:00
osu-lazer/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

83 lines
2.7 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 18:19:50 +09:00
2022-06-17 16:37:17 +09:00
#nullable disable
2022-05-09 13:44:18 +03:00
using System.Linq;
2018-03-02 15:34:31 +09:00
using NUnit.Framework;
2022-10-13 16:04:38 +09:00
using osu.Framework.Allocation;
2017-09-18 22:32:49 +09:00
using osu.Framework.Graphics;
2022-05-09 13:44:18 +03:00
using osu.Framework.Testing;
2017-09-18 22:32:49 +09:00
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
2022-05-09 13:44:18 +03:00
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
2022-10-13 16:04:38 +09:00
using osuTK;
2022-05-09 13:44:18 +03:00
using osuTK.Input;
2018-04-13 18:19:50 +09:00
namespace osu.Game.Tests.Visual.UserInterface
2017-09-18 22:32:49 +09:00
{
2018-03-02 15:34:31 +09:00
[TestFixture]
2022-05-09 13:44:18 +03:00
public partial class TestSceneSettingsToolboxGroup : OsuManualInputManagerTestScene
2017-09-18 22:32:49 +09:00
{
private SettingsToolboxGroup group;
2018-04-13 18:19:50 +09:00
2022-10-13 16:04:38 +09:00
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
[SetUp]
public void SetUp() => Schedule(() =>
{
Child = group = new SettingsToolboxGroup("example")
2017-09-18 22:32:49 +09:00
{
2022-10-13 16:04:38 +09:00
Scale = new Vector2(3),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
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",
}
},
};
});
2018-04-13 18:19:50 +09:00
2023-01-05 14:41:26 +03:00
[Test]
public void TestDisplay()
{
AddRepeatStep("toggle expanded state", () =>
{
InputManager.MoveMouseTo(group.ChildrenOfType<IconButton>().Single());
InputManager.Click(MouseButton.Left);
}, 5);
}
2022-05-09 13:44:18 +03:00
[Test]
public void TestClickExpandButtonMultipleTimes()
{
AddAssert("group expanded by default", () => group.Expanded.Value);
2022-05-09 13:44:18 +03:00
AddStep("click expand button multiple times", () =>
{
InputManager.MoveMouseTo(group.ChildrenOfType<IconButton>().Single());
Scheduler.AddDelayed(() => InputManager.Click(MouseButton.Left), 100);
Scheduler.AddDelayed(() => InputManager.Click(MouseButton.Left), 200);
Scheduler.AddDelayed(() => InputManager.Click(MouseButton.Left), 300);
});
AddAssert("group contracted", () => !group.Expanded.Value);
}
2017-09-18 22:32:49 +09:00
}
}