1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-11 23:13:06 +08:00

Add failing test case

This commit is contained in:
Salman Ahmed 2024-08-21 03:22:03 +09:00
parent f4b8fc6165
commit ae4fefeba1

View File

@ -7,6 +7,8 @@ using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
using osu.Game.Rulesets.Mods;
@ -157,6 +159,27 @@ namespace osu.Game.Tests.Visual.UserInterface
checkExpanded(false);
}
[Test]
public void TestDraggingKeepsPanelExpanded()
{
AddStep("add customisable mod", () =>
{
SelectedMods.Value = new[] { new OsuModDoubleTime() };
panel.Enabled.Value = true;
});
AddStep("hover header", () => InputManager.MoveMouseTo(header));
checkExpanded(true);
AddStep("hover slider bar nub", () => InputManager.MoveMouseTo(panel.ChildrenOfType<OsuSliderBar<double>>().First().ChildrenOfType<Nub>().Single()));
AddStep("hold", () => InputManager.PressButton(MouseButton.Left));
AddStep("drag outside", () => InputManager.MoveMouseTo(Vector2.Zero));
checkExpanded(true);
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
checkExpanded(false);
}
private void checkExpanded(bool expanded)
{
AddUntilStep(expanded ? "is expanded" : "not expanded", () => panel.ExpandedState.Value,